Expand description
Storage-texture output kernel support for OxiGDAL GPU.
This module enables compute shaders to write their output directly to a
2-D storage texture (WGSL texture_storage_2d<format, write>), bypassing
the round-trip to a CPU-visible staging buffer. The resulting texture lives
on the GPU and can be consumed by subsequent render passes, image-processing
pipelines, or downloaded via read_texture_to_vec_f32 when the host
needs the data.
§Typical workflow
- Create a storage texture with
new_storage_texture. - Build a compute kernel from WGSL source with
build_storage_texture_kernel. - Upload input data as a
GpuBufferusing the standard buffer API. - Execute the kernel with
StorageTextureKernel::dispatch_to_texture. - Optionally download results with
read_texture_to_vec_f32.
§Supported formats
wgpu::TextureFormat | WGSL format string |
|---|---|
Rgba32Float | rgba32float |
Rgba8Unorm | rgba8unorm |
R32Float | r32float |
Other formats are rejected by new_storage_texture with
GpuError::UnsupportedFormat.
Structs§
- Storage
Texture Binding - A 2-D GPU texture created with
STORAGE_BINDING | COPY_SRCusage. - Storage
Texture Kernel - A compiled compute kernel that writes its output to a storage texture.
Functions§
- build_
storage_ texture_ kernel - Compile a WGSL compute shader into a
StorageTextureKernel. - is_
supported_ storage_ format - Returns
trueifformatis accepted bynew_storage_texture. - make_
storage_ texture_ shader_ source - Generate default WGSL source for a kernel that copies a flat
f32input buffer into a 2-D storage texture. - new_
storage_ texture - Create a new 2-D storage texture on the GPU.
- read_
texture_ to_ vec_ f32 - Copy a storage texture to host memory, returning a
Vec<f32>.