3 translation: vec2<f32>, 7 @location(0) position: vec2<f32>, 8 @location(1) uv: vec2<f32>, 9 @location(2) color: vec4<f32>, 13 @builtin(position) position: vec4<f32>, 14 @location(0) color: vec4<f32>, 15 @location(1) uv: vec2<f32>, 18@group(0) @binding(0) var<uniform> transform: Transform; 21@group(1) @binding(0) var image_texture: binding_array<texture_2d<f32>>; 22@group(1) @binding(1) var image_sampler: binding_array<sampler>; 26struct BindlessOffset { 29var<push_constant> offset: BindlessOffset; 32@group(1) @binding(0) var image_texture: texture_2d<f32>; 33@group(1) @binding(1) var image_sampler: sampler; 37fn linear_from_gamma_rgb(srgb: vec3<f32>) -> vec3<f32> { 38 let cutoff = srgb < vec3<f32>(0.04045); 39 let lower = srgb / vec3<f32>(12.92); 40 let higher = pow((srgb + vec3<f32>(0.055)) / vec3<f32>(1.055), vec3<f32>(2.4)); 41 return select(higher, lower, cutoff); 45fn gamma_from_linear_rgb(rgb: vec3<f32>) -> vec3<f32> { 46 let cutoff = rgb < vec3<f32>(0.0031308); 47 let lower = rgb * vec3<f32>(12.92); 48 let higher = vec3<f32>(1.055) * pow(rgb, vec3<f32>(1.0 / 2.4)) - vec3<f32>(0.055); 49 return select(higher, lower, cutoff); 53fn gamma_from_linear_rgba(linear_rgba: vec4<f32>) -> vec4<f32> { 54 return vec4<f32>(gamma_from_linear_rgb(linear_rgba.rgb), linear_rgba.a); 58fn vs_main(in: VertexInput) -> VertexOutput { 59 let position = in.position * transform.scale + transform.translation; 61 return VertexOutput(vec4<f32>(position, 0.0, 1.0), in.color, in.uv); 65fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { 67 let image_texture = image_texture[offset.offset]; 68 let image_sampler = image_sampler[offset.offset]; 73 let texture_color_linear = textureSample(image_texture, image_sampler, in.uv); 74 let texture_color_gamma = gamma_from_linear_rgba(texture_color_linear); 75 let color_gamma = texture_color_gamma * in.color; 77 return vec4<f32>(linear_from_gamma_rgb(color_gamma.rgb), color_gamma.a);