This example is running in WebGL2 and should work in most browsers. You can check the WebGPU examples here.
shader_defs.rs:
//! A shader that uses "shaders defs", which selectively toggle parts of a shader.
use ;
/// set up a simple 3D scene
// This is the struct that will be passed to your shader
// This key is used to identify a specific permutation of this material pipeline.
// In this case, we specialize on whether or not to configure the "IS_RED" shader def.
// Specialization keys should be kept as small / cheap to hash as possible,
// as they will be used to look up the pipeline for each drawn entity with this material type.
shaders/shader_defs.wgsl:
#import VertexOutput
;
@group @binding material: CustomMaterial;
@fragment
@location