Skip to main content

Crate spirv_webgpu_transform

Crate spirv_webgpu_transform 

Source
Expand description

§SPIRV WebGPU Transforms

See https://github.com/davnotdev/spirv-webgpu-transform for more details.

§Features

At the moment, the following transformations are supported:

Featurespirv-valnagatint
Combined Image Samplers✅✅✅
Immediates (Push Constants)✅✅*✅
Binding Arrays✅✅✅
Mixed Depth / Comparison✅⚠️*❌
isnan / isinf Patching✅✅✅
Storage Cube Patching✅✅✅
Unused Image Sampler Pruning✅✅✅

(1)* 99% OK, just one very specific padding related naga bug.

(2)* Simple cases are OK. With some special patches, naga can process these.

§Using the result

After running an individual shader through one or multiple transformations, you will want to:

  1. Know which set bindings were affected, use the output CorrectionMap for this purpose.
  2. Ensure that your vertex and fragment shaders shader the same binding layout, use mirrorpatch for this purpose

Macros§

last_of_indices

Structs§

CorrectionBinding
CorrectionMap
Lookup a set and a binding for a list of CorrectionType. In order, insert a new variable for each, see CorrectionType for what type of object should be inserted for each variant.
CorrectionSet

Enums§

CorrectionType
ImmediatesBindingMode
ImmediatesSetMode

Functions§

combimgsampsplitter
Perform the operation on a Vec<u32>. Use u8_slice_to_u32_vec to convert a &[u8] into a Vec<u32>
drefsplitter
Perform the operation on a Vec<u32>. Use u8_slice_to_u32_vec to convert a &[u8] into a Vec<u32>.
immediatespatch
Use u8_slice_to_u32_vec to convert a &[u8] into a Vec<u32>.
isnanisinfpatch
Perform the operation on a Vec<u32>. Use u8_slice_to_u32_vec to convert a &[u8] into a Vec<u32>. Does not produce any side effects or corrections.
mirrorpatch
Reflect one set of patched uniforms onto another shader with the same underlying set of uniforms. This is important for ensuring patched vertex and fragment shaders have the same layout. This is because some transformations occur based off what instructions appear, so as a result, the vertex and fragment shader may have a different layout after a set of transformations
pruneunuseddref
splitbindingarray
Perform the operation on a Vec<u32>. Use u8_slice_to_u32_vec to convert a &[u8] into a Vec<u32>
storagecubepatch
Perform the operation on a Vec<u32>. Use u8_slice_to_u32_vec to convert a &[u8] into a Vec<u32>.
u8_slice_to_u32_vec
Helper to convert a &[u8] into a Vec<u32>.
u32_slice_to_u8_vec
Helper to convert a &[u32] into a Vec<u8>.