pub struct StorageTextureKernel { /* private fields */ }Expand description
A compiled compute kernel that writes its output to a storage texture.
Constructed by build_storage_texture_kernel. A single kernel can be
dispatched to multiple different textures of compatible format.
Implementations§
Source§impl StorageTextureKernel
impl StorageTextureKernel
Sourcepub fn dispatch_to_texture<T: Pod>(
&self,
ctx: &GpuContext,
input_buffer: &GpuBuffer<T>,
texture: &StorageTextureBinding,
) -> GpuResult<()>
pub fn dispatch_to_texture<T: Pod>( &self, ctx: &GpuContext, input_buffer: &GpuBuffer<T>, texture: &StorageTextureBinding, ) -> GpuResult<()>
Dispatch the compute kernel, writing output directly into texture.
The input data must already be resident on the GPU as input_buffer.
The kernel is dispatched with ceil(width / 16) × ceil(height / 16) × 1
workgroups, matching the default 16×16 workgroup size in
make_storage_texture_shader_source.
§Key benefit
The results are not copied back to CPU memory. This avoids the expensive PCIe transfer and is useful when the texture will be consumed by subsequent GPU operations (e.g., compositing, rendering).
§Errors
Returns an error if bind-group creation fails or the device is lost.