struct PointLight { position : vec4; }; struct PointLights { values : [[stride(16)]] array; }; struct Uniforms { worldView : mat4x4; proj : mat4x4; numPointLights : u32; color_source : u32; color : vec4; }; [[binding(0), group(0)]] var uniforms : Uniforms; [[binding(1), group(0)]] var pointLights : PointLights; [[binding(2), group(0)]] var mySampler : sampler; [[binding(3), group(0)]] var myTexture : texture_2d; struct FragmentInput { [[builtin(position)]] position : vec4; [[location(0)]] view_position : vec4; [[location(1)]] normal : vec4; [[location(2)]] uv : vec2; [[location(3)]] color : vec4; }; struct FragmentOutput { [[location(0)]] color : vec4; }; fn getColor(fragment : FragmentInput) -> vec4 { var color : vec4; if ((uniforms.color_source == 0u)) { color = fragment.color; } elseif ((uniforms.color_source == 1u)) { color = fragment.normal; color.a = 1.0; } elseif ((uniforms.color_source == 2u)) { color = uniforms.color; } elseif ((uniforms.color_source == 3u)) { color = textureSample(myTexture, mySampler, fragment.uv); } return color; } [[stage(fragment)]] fn main(fragment : FragmentInput) -> FragmentOutput { var output : FragmentOutput; output.color = vec4(1.0, 0.0, 0.0, 1.0); _ = uniforms; _ = mySampler; _ = myTexture; _ = &(pointLights); return output; }