summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-14 14:15:07 +0100
committerskal <pascal.massimino@gmail.com>2026-02-14 14:15:07 +0100
commit12f83d4615a38cb0b1ed8a3eb436c4acca170479 (patch)
treef9058b6e526ff3015b10da2d20ac5e0b15638706 /src/gpu/gpu.cc
parent61ced8aa1946cc32de4328cc75b5faf6b77723be (diff)
Refactor: add gpu_create_post_process_texture helper
Adds new helper for common post-process texture pattern (RenderAttachment | TextureBinding | CopySrc usage). Refactors test_post_process_helper.cc to use gpu_create_buffer() and gpu_create_post_process_texture(), eliminating 91 lines of boilerplate. - New: gpu_create_post_process_texture() in gpu.{h,cc} - Refactor: test_post_process_helper.cc uses helpers instead of raw WGPU - Doc: Updated WGPU_HELPERS.md with usage examples - Verified: All tests passing (test_post_process_helper, test_demo_effects) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/gpu.cc')
-rw-r--r--src/gpu/gpu.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 535de67..afbba90 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -84,6 +84,16 @@ TextureWithView gpu_create_storage_texture_2d(WGPUDevice device, uint32_t width,
WGPUTextureUsage_StorageBinding | WGPUTextureUsage_TextureBinding, 1);
}
+TextureWithView gpu_create_post_process_texture(WGPUDevice device,
+ uint32_t width, uint32_t height,
+ WGPUTextureFormat format) {
+ return gpu_create_texture_2d(
+ device, width, height, format,
+ WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding |
+ WGPUTextureUsage_CopySrc,
+ 1);
+}
+
WGPUTextureView gpu_create_mip_view(WGPUTexture texture,
WGPUTextureFormat format,
uint32_t mip_level) {