[mtl canvas] tmp fix of clear color (revisit one we re-introduce texturing)
This commit is contained in:
parent
8af4e4eddc
commit
eee158ff85
|
@ -2977,7 +2977,8 @@ void mg_flush_commands(int primitiveCount, mg_primitive* primitives, mg_path_elt
|
||||||
|
|
||||||
if(canvas->backend && canvas->backend->render)
|
if(canvas->backend && canvas->backend->render)
|
||||||
{
|
{
|
||||||
canvas->backend->render(canvas->backend, primitiveCount, primitives, canvas->path.startIndex + canvas->path.count, pathElements);
|
int eltCount = canvas->path.startIndex + canvas->path.count;
|
||||||
|
canvas->backend->render(canvas->backend, canvas->clearColor, primitiveCount, primitives, eltCount, pathElements);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,7 @@ typedef struct mg_primitive
|
||||||
} mg_primitive;
|
} mg_primitive;
|
||||||
|
|
||||||
typedef void (*mg_canvas_backend_render_proc)(mg_canvas_backend* backend,
|
typedef void (*mg_canvas_backend_render_proc)(mg_canvas_backend* backend,
|
||||||
|
mg_color clearColor,
|
||||||
u32 primitiveCount,
|
u32 primitiveCount,
|
||||||
mg_primitive* primitives,
|
mg_primitive* primitives,
|
||||||
u32 eltCount,
|
u32 eltCount,
|
||||||
|
|
|
@ -62,6 +62,7 @@ static void mg_update_path_extents(vec4* extents, vec2 p)
|
||||||
}
|
}
|
||||||
|
|
||||||
void mg_mtl_canvas_render(mg_canvas_backend* interface,
|
void mg_mtl_canvas_render(mg_canvas_backend* interface,
|
||||||
|
mg_color clearColor,
|
||||||
u32 primitiveCount,
|
u32 primitiveCount,
|
||||||
mg_primitive* primitives,
|
mg_primitive* primitives,
|
||||||
u32 eltCount,
|
u32 eltCount,
|
||||||
|
@ -69,8 +70,7 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface,
|
||||||
{
|
{
|
||||||
mg_mtl_canvas_backend* backend = (mg_mtl_canvas_backend*)interface;
|
mg_mtl_canvas_backend* backend = (mg_mtl_canvas_backend*)interface;
|
||||||
|
|
||||||
//TODO: update rolling buffers
|
//NOTE: update rolling buffers
|
||||||
|
|
||||||
dispatch_semaphore_wait(backend->bufferSemaphore, DISPATCH_TIME_FOREVER);
|
dispatch_semaphore_wait(backend->bufferSemaphore, DISPATCH_TIME_FOREVER);
|
||||||
backend->bufferIndex = (backend->bufferIndex + 1) % MG_MTL_INPUT_BUFFERS_COUNT;
|
backend->bufferIndex = (backend->bufferIndex + 1) % MG_MTL_INPUT_BUFFERS_COUNT;
|
||||||
|
|
||||||
|
@ -264,7 +264,8 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface,
|
||||||
//TODO: clear here?
|
//TODO: clear here?
|
||||||
MTLRenderPassDescriptor* renderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor];
|
MTLRenderPassDescriptor* renderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||||
renderPassDescriptor.colorAttachments[0].texture = surface->drawable.texture;
|
renderPassDescriptor.colorAttachments[0].texture = surface->drawable.texture;
|
||||||
renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionLoad;
|
renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear;
|
||||||
|
renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
|
||||||
renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore;
|
renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore;
|
||||||
|
|
||||||
id<MTLRenderCommandEncoder> renderEncoder = [surface->commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
|
id<MTLRenderCommandEncoder> renderEncoder = [surface->commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
|
||||||
|
|
Loading…
Reference in New Issue