struct VertexOutput { @location(0) tex_coord: vec2, @builtin(position) position: vec4, }; @group(0) @binding(0) var transform: mat4x4; @vertex fn vs_main( @location(0) position: vec4, @location(1) tex_coord: vec2, ) -> VertexOutput { var result: VertexOutput; result.tex_coord = tex_coord; result.position = transform * position; return result; } @group(0) @binding(1) var r_color: texture_2d; @fragment fn fs_main(vertex: VertexOutput) -> @location(0) vec4 { let tex = textureLoad(r_color, vec2(vertex.tex_coord * 256.0), 0); let v = f32(tex.x) / 255.0; return vec4(1.0 - (v * 5.0), 1.0 - (v * 15.0), 1.0 - (v * 50.0), 1.0); } @fragment fn fs_wire(vertex: VertexOutput) -> @location(0) vec4 { return vec4(0.0, 0.5, 0.0, 0.5); }