mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
tests/shader_runner_metal: Implement clears.
This commit is contained in:
parent
004a6d3055
commit
b7203b0bbe
Notes:
Henri Verbeet
2024-11-30 14:35:45 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1286
@ -318,7 +318,42 @@ static bool metal_runner_dispatch(struct shader_runner *r, unsigned int x, unsig
|
|||||||
|
|
||||||
static void metal_runner_clear(struct shader_runner *r, struct resource *res, const struct vec4 *clear_value)
|
static void metal_runner_clear(struct shader_runner *r, struct resource *res, const struct vec4 *clear_value)
|
||||||
{
|
{
|
||||||
return;
|
struct metal_resource *resource = metal_resource(res);
|
||||||
|
struct metal_runner *runner = metal_runner(r);
|
||||||
|
id<MTLRenderCommandEncoder> encoder;
|
||||||
|
id<MTLCommandBuffer> command_buffer;
|
||||||
|
MTLRenderPassDescriptor *descriptor;
|
||||||
|
|
||||||
|
@autoreleasepool
|
||||||
|
{
|
||||||
|
descriptor = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||||
|
command_buffer = [runner->queue commandBuffer];
|
||||||
|
|
||||||
|
switch (resource->r.desc.type)
|
||||||
|
{
|
||||||
|
case RESOURCE_TYPE_RENDER_TARGET:
|
||||||
|
descriptor.colorAttachments[0].texture = resource->texture;
|
||||||
|
descriptor.colorAttachments[0].loadAction = MTLLoadActionClear;
|
||||||
|
descriptor.colorAttachments[0].storeAction = MTLStoreActionStore;
|
||||||
|
descriptor.colorAttachments[0].clearColor =
|
||||||
|
MTLClearColorMake(clear_value->x, clear_value->y, clear_value->z, clear_value->w);
|
||||||
|
break;
|
||||||
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
||||||
|
descriptor.depthAttachment.texture = resource->texture;
|
||||||
|
descriptor.depthAttachment.loadAction = MTLLoadActionClear;
|
||||||
|
descriptor.depthAttachment.storeAction = MTLStoreActionStore;
|
||||||
|
descriptor.depthAttachment.clearDepth = clear_value->x;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fatal_error("Clears are not implemented for resource type %#x.\n", resource->r.desc.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
encoder = [command_buffer renderCommandEncoderWithDescriptor:descriptor];
|
||||||
|
[encoder endEncoding];
|
||||||
|
|
||||||
|
[command_buffer commit];
|
||||||
|
[command_buffer waitUntilCompleted];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool metal_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY topology,
|
static bool metal_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY topology,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user