#[repr(u8)]pub enum LoadOp<V> {
Clear(V),
Load = 1,
DontCare(LoadOpDontCare),
}Expand description
Operation to perform to the output attachment at the start of a render pass.
Corresponds to WebGPU GPULoadOp,
plus the corresponding clearValue.
Variants§
Clear(V)
Loads the specified value for this attachment into the render pass.
On some GPU hardware (primarily mobile), “clear” is significantly cheaper because it avoids loading data from main memory into tile-local memory.
On other GPU hardware, there isn’t a significant difference.
As a result, it is recommended to use “clear” rather than “load” in cases where the initial value doesn’t matter (e.g. the render target will be cleared using a skybox).
Load = 1
Loads the existing value for this attachment into the render pass.
DontCare(LoadOpDontCare)
The render target has undefined contents at the start of the render pass. This may lead to undefined behavior if you read from the any of the render target pixels without first writing to them.
Blending also becomes undefined behavior if the source pixels are undefined.
This is the fastest option on all GPUs if you always overwrite all pixels in the render target after this load operation.
Backends that don’t support DontCare internally, will pick a different (unspecified)
load op instead.
§Safety
- All pixels in the render target must be written to before
any read or a
StoreOp::Storeoccurs.