struct TransformUniform { transform: mat4x4, }; @group(1) @binding(0) var transformUniform: TransformUniform; struct VertexOutput { @builtin(position) position: vec4, @location(0) tex_coords: vec2, }; @vertex fn vs_main(@location(0) position: vec2, @location(1) tex_coords: vec2) -> VertexOutput { var output: VertexOutput; output.position = transformUniform.transform * vec4(position, 0.0, 1.0); output.tex_coords = tex_coords; return output; } @group(0) @binding(0) var my_texture: texture_2d; @group(0) @binding(1) var my_sampler: sampler; struct UVTransform { uv_offset: vec2, uv_scale: vec2, }; @group(2) @binding(0) var uvTransform: UVTransform; @fragment fn fs_main(@location(0) tex_coords: vec2) -> @location(0) vec4 { let adjustedTexCoords = tex_coords * uvTransform.uv_scale + uvTransform.uv_offset; return textureSample(my_texture, my_sampler, adjustedTexCoords); }