UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

11 lines (9 loc) 670 B
// Template for compute shader stream declaration - binding, var, and load functions // Placeholders: {binding}, {name}, {textureType}, {returnType}, {funcName} // Uses uniforms.splatTextureSize (compute uniform struct) instead of uniform.splatTextureSize (vertex) var wgslComputeStreamDecl = /* wgsl */ ` @group(0) @binding({binding}) var {name}: {textureType}; fn load{funcName}() -> {returnType} { return textureLoad({name}, splat.uv, 0); } fn load{funcName}WithIndex(index: u32) -> {returnType} { return textureLoad({name}, vec2i(i32(index % uniforms.splatTextureSize), i32(index / uniforms.splatTextureSize)), 0); } `; export { wgslComputeStreamDecl as default };