Add missing render pass encoder depth stencil attachment handling

This commit is contained in:
Nikita Lisitsa 2024-01-02 17:53:48 +03:00
parent 78a131952b
commit 3e10b1e294
2 changed files with 16 additions and 1 deletions

View file

@ -50,7 +50,7 @@ namespace psemek::wgpu
struct depth_stencil_attachment struct depth_stencil_attachment
{ {
texture_view view; texture_view view;
load_op depth_load_pp; load_op depth_load_op;
store_op depth_store_op; store_op depth_store_op;
float depth_clear_value; float depth_clear_value;
bool depth_read_only; bool depth_read_only;

View file

@ -36,6 +36,20 @@ namespace psemek::wgpu
dst.clearValue = {src.clear_value[0], src.clear_value[1], src.clear_value[2], src.clear_value[3]}; dst.clearValue = {src.clear_value[0], src.clear_value[1], src.clear_value[2], src.clear_value[3]};
} }
WGPURenderPassDepthStencilAttachment depth_stencil_attachment = {};
if (desc.depth_stencil_attachment)
{
depth_stencil_attachment.view = (WGPUTextureView)desc.depth_stencil_attachment->view.get();
depth_stencil_attachment.depthLoadOp = (WGPULoadOp)desc.depth_stencil_attachment->depth_load_op;
depth_stencil_attachment.depthStoreOp = (WGPUStoreOp)desc.depth_stencil_attachment->depth_store_op;
depth_stencil_attachment.depthClearValue = desc.depth_stencil_attachment->depth_clear_value;
depth_stencil_attachment.depthReadOnly = desc.depth_stencil_attachment->depth_read_only;
depth_stencil_attachment.stencilLoadOp = (WGPULoadOp)desc.depth_stencil_attachment->stencil_load_op;
depth_stencil_attachment.stencilStoreOp = (WGPUStoreOp)desc.depth_stencil_attachment->stencil_store_op;
depth_stencil_attachment.stencilClearValue = desc.depth_stencil_attachment->stencil_clear_value;
depth_stencil_attachment.stencilReadOnly = desc.depth_stencil_attachment->stencil_clear_value;
}
WGPURenderPassTimestampWrites timestamp_writes = {}; WGPURenderPassTimestampWrites timestamp_writes = {};
if (desc.timestamp_writes) if (desc.timestamp_writes)
{ {
@ -49,6 +63,7 @@ namespace psemek::wgpu
descriptor.label = desc.label.data(); descriptor.label = desc.label.data();
descriptor.colorAttachmentCount = color_attachments.size(); descriptor.colorAttachmentCount = color_attachments.size();
descriptor.colorAttachments = color_attachments.data(); descriptor.colorAttachments = color_attachments.data();
descriptor.depthStencilAttachment = desc.depth_stencil_attachment ? &depth_stencil_attachment : nullptr;
descriptor.occlusionQuerySet = (WGPUQuerySet)desc.occlusion_query_set.get(); descriptor.occlusionQuerySet = (WGPUQuerySet)desc.occlusion_query_set.get();
descriptor.timestampWrites = desc.timestamp_writes ? &timestamp_writes : nullptr; descriptor.timestampWrites = desc.timestamp_writes ? &timestamp_writes : nullptr;