diff --git a/libs/wgpu/include/psemek/wgpu/render_pass_encoder.hpp b/libs/wgpu/include/psemek/wgpu/render_pass_encoder.hpp index 56dc34d8..2a6dbe4b 100644 --- a/libs/wgpu/include/psemek/wgpu/render_pass_encoder.hpp +++ b/libs/wgpu/include/psemek/wgpu/render_pass_encoder.hpp @@ -50,7 +50,7 @@ namespace psemek::wgpu struct depth_stencil_attachment { texture_view view; - load_op depth_load_pp; + load_op depth_load_op; store_op depth_store_op; float depth_clear_value; bool depth_read_only; diff --git a/libs/wgpu/source/command_encoder.cpp b/libs/wgpu/source/command_encoder.cpp index 2b2a959a..4a26fdc5 100644 --- a/libs/wgpu/source/command_encoder.cpp +++ b/libs/wgpu/source/command_encoder.cpp @@ -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]}; } + 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 = {}; if (desc.timestamp_writes) { @@ -49,6 +63,7 @@ namespace psemek::wgpu descriptor.label = desc.label.data(); descriptor.colorAttachmentCount = color_attachments.size(); descriptor.colorAttachments = color_attachments.data(); + descriptor.depthStencilAttachment = desc.depth_stencil_attachment ? &depth_stencil_attachment : nullptr; descriptor.occlusionQuerySet = (WGPUQuerySet)desc.occlusion_query_set.get(); descriptor.timestampWrites = desc.timestamp_writes ? ×tamp_writes : nullptr;