// Texture Shader struct VertexOutput { @builtin(position) clip_position: vec4, @location(0) tex: vec2, @location(1) sprite: vec2 } @group(1) @binding(0) var t_diffuse: texture_2d_array; @group(1) @binding(1) var s_diffuse: sampler; @group(1) @binding(2) var sprite_amount: Uniforms; struct Uniforms { @size(16) index: vec2, } @fragment fn main(in: VertexOutput) -> @location(0) vec4 { let index = in.sprite.y * sprite_amount.index.x + in.sprite.x; return textureSample( t_diffuse, s_diffuse, in.tex, index ); }