1#ifdef TONEMAP_IN_SHADER 2#import bevy_core_pipeline::tonemapping 5#import bevy_render::color_operations::linear_to_srgb 8#import bevy_render::color_operations::linear_rgb_to_oklab 12 maths::affine3_to_square, 16#import bevy_sprite::sprite_view_bindings::view 19 @builtin(vertex_index) index: u32, 23 @location(0) i_model_transpose_col0: vec4<f32>, 24 @location(1) i_model_transpose_col1: vec4<f32>, 25 @location(2) i_model_transpose_col2: vec4<f32>, 26 @location(3) i_color: vec4<f32>, 27 @location(4) i_uv_offset_scale: vec4<f32>, 31 @builtin(position) clip_position: vec4<f32>, 32 @location(0) uv: vec2<f32>, 33 @location(1) @interpolate(flat) color: vec4<f32>, 37fn vertex(in: VertexInput) -> VertexOutput { 38 var out: VertexOutput; 40 let vertex_position = vec3<f32>( 42 f32((in.index & 0x2u) >> 1u), 46 out.clip_position = view.clip_from_world * affine3_to_square(mat3x4<f32>( 47 in.i_model_transpose_col0, 48 in.i_model_transpose_col1, 49 in.i_model_transpose_col2, 50 )) * vec4<f32>(vertex_position, 1.0); 51 out.uv = vec2<f32>(vertex_position.xy) * in.i_uv_offset_scale.zw + in.i_uv_offset_scale.xy; 52 out.color = in.i_color; 57@group(1) @binding(0) var sprite_texture: texture_2d<f32>; 58@group(1) @binding(1) var sprite_sampler: sampler; 61fn fragment(in: VertexOutput) -> @location(0) vec4<f32> { 62 var color = in.color * textureSample(sprite_texture, sprite_sampler, in.uv); 64#ifdef TONEMAP_IN_SHADER 65 color = tonemapping::tone_mapping(color, view.color_grading); 69 color = vec4(linear_to_srgb(color.rgb), color.a); 73 color = vec4(linear_rgb_to_oklab(color.rgb), color.a);