diff options
Diffstat (limited to 'src/backend_mtl.m')
-rw-r--r-- | src/backend_mtl.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend_mtl.m b/src/backend_mtl.m index 48e0ab0..2564ff0 100644 --- a/src/backend_mtl.m +++ b/src/backend_mtl.m @@ -128,6 +128,11 @@ buf_handle ral_buffer_create(u64 size, const void *data) { return handle; } +void ral_buffer_upload_data(buf_handle buf, u64 size, const void *data) { + metal_buffer* b = buf_pool_get(&ctx.bufpool, buf); + memcpy(b->id.contents, data, size); +} + tex_handle ral_texture_create(texture_desc desc, bool create_view, const void *data) { tex_handle handle; metal_texture* texture = tex_pool_alloc(&ctx.texpool, &handle); @@ -229,11 +234,21 @@ void ral_encode_bind_pipeline(gpu_encoder *enc, pipeline_handle pipeline) { [enc->cmd_encoder setRenderPipelineState:p->pso]; } +void ral_set_default_settings(gpu_encoder* enc) { + [enc->cmd_encoder setFrontFacingWinding:MTLWindingCounterClockwise]; + [enc->cmd_encoder setCullMode:MTLCullModeBack]; +} + void ral_encode_set_vertex_buf(gpu_encoder *enc, buf_handle vbuf) { metal_buffer* b = buf_pool_get(&ctx.bufpool, vbuf); [enc->cmd_encoder setVertexBuffer:b->id offset:0 atIndex:0 ]; } +void ral_bind_buffer(gpu_encoder *enc, buf_handle buf, u32 index) { + metal_buffer* b = buf_pool_get(&ctx.bufpool, buf); + [enc->cmd_encoder setVertexBuffer:b->id offset:0 atIndex:index ]; +} + void ral_encode_set_texture(gpu_encoder* enc, tex_handle texture, u32 slot) { metal_texture* t = tex_pool_get(&ctx.texpool, texture); [enc->cmd_encoder setFragmentTexture:t->id atIndex:slot]; |