summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gpu.h')
-rw-r--r--src/gpu/gpu.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h
index 8814cbc..b71e144 100644
--- a/src/gpu/gpu.h
+++ b/src/gpu/gpu.h
@@ -110,6 +110,16 @@ struct ResourceBinding {
// WGPUBufferBindingType_Storage
};
+// Cross-platform helper for color attachment initialization
+inline void gpu_init_color_attachment(WGPURenderPassColorAttachment& attachment, WGPUTextureView view) {
+ attachment.view = view;
+ attachment.loadOp = WGPULoadOp_Clear;
+ attachment.storeOp = WGPUStoreOp_Store;
+#if !defined(DEMO_CROSS_COMPILE_WIN32)
+ attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
+#endif
+}
+
GpuBuffer gpu_create_buffer(WGPUDevice device, size_t size, uint32_t usage,
const void* data = nullptr);
ComputePass gpu_create_compute_pass(WGPUDevice device, const char* shader_code,