diff options
Diffstat (limited to 'doc/WGPU_HELPERS.md')
| -rw-r--r-- | doc/WGPU_HELPERS.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/WGPU_HELPERS.md b/doc/WGPU_HELPERS.md index 5642eef..f1d83d5 100644 --- a/doc/WGPU_HELPERS.md +++ b/doc/WGPU_HELPERS.md @@ -133,6 +133,45 @@ TextureWithView output = gpu_create_storage_texture_2d( --- +#### `gpu_create_post_process_texture` +```cpp +TextureWithView gpu_create_post_process_texture( + WGPUDevice device, uint32_t width, uint32_t height, + WGPUTextureFormat format); +``` + +**Purpose:** Create texture for post-processing effects (render target + input + readback). + +**Parameters:** +- `device` - WGPU device handle +- `width`, `height` - Texture dimensions +- `format` - Pixel format (typically `WGPUTextureFormat_RGBA8Unorm`) + +**Returns:** `TextureWithView` with usage flags: +- `WGPUTextureUsage_RenderAttachment` - Can render to it +- `WGPUTextureUsage_TextureBinding` - Can sample from it +- `WGPUTextureUsage_CopySrc` - Can read back pixels + +**Example:** +```cpp +// Create ping-pong buffers for multi-pass post-processing +TextureWithView buffer_a = gpu_create_post_process_texture( + device, 1920, 1080, WGPUTextureFormat_RGBA8Unorm); +TextureWithView buffer_b = gpu_create_post_process_texture( + device, 1920, 1080, WGPUTextureFormat_RGBA8Unorm); + +// Pass 1: Render to buffer_a +// Pass 2: Sample buffer_a, render to buffer_b +// Pass 3: Copy buffer_b to screen +``` + +**Common Use Cases:** +- Post-process ping-pong buffers +- Off-screen render targets that need sampling +- Test fixtures requiring texture readback + +--- + #### `gpu_create_mip_view` ```cpp WGPUTextureView gpu_create_mip_view(WGPUTexture texture, |
