Sync up bevy_sprite and bevy_ui shader View struct (#5531)
# Objective - Similar to #5512 , the `View` struct definition in the shaders in `bevy_sprite` and `bevy_ui` were out of sync with the rust-side `ViewUniform`. Only `view_proj` was being used and is the first member and as those shaders are not customisable it makes little difference in practice, unlike for `Mesh2d`. ## Solution - Sync shader `View` struct definition in `bevy_sprite` and `bevy_ui` with the correct definition that matches `ViewUniform`
This commit is contained in:
parent
444150025d
commit
704d8e251b
@ -1,6 +1,13 @@
|
|||||||
struct View {
|
struct View {
|
||||||
view_proj: mat4x4<f32>,
|
view_proj: mat4x4<f32>,
|
||||||
|
inverse_view_proj: mat4x4<f32>,
|
||||||
|
view: mat4x4<f32>,
|
||||||
|
inverse_view: mat4x4<f32>,
|
||||||
|
projection: mat4x4<f32>,
|
||||||
|
inverse_projection: mat4x4<f32>,
|
||||||
world_position: vec3<f32>,
|
world_position: vec3<f32>,
|
||||||
|
width: f32,
|
||||||
|
height: f32,
|
||||||
};
|
};
|
||||||
@group(0) @binding(0)
|
@group(0) @binding(0)
|
||||||
var<uniform> view: View;
|
var<uniform> view: View;
|
||||||
|
|||||||
@ -1,6 +1,13 @@
|
|||||||
struct View {
|
struct View {
|
||||||
view_proj: mat4x4<f32>,
|
view_proj: mat4x4<f32>,
|
||||||
|
inverse_view_proj: mat4x4<f32>,
|
||||||
|
view: mat4x4<f32>,
|
||||||
|
inverse_view: mat4x4<f32>,
|
||||||
|
projection: mat4x4<f32>,
|
||||||
|
inverse_projection: mat4x4<f32>,
|
||||||
world_position: vec3<f32>,
|
world_position: vec3<f32>,
|
||||||
|
width: f32,
|
||||||
|
height: f32,
|
||||||
};
|
};
|
||||||
@group(0) @binding(0)
|
@group(0) @binding(0)
|
||||||
var<uniform> view: View;
|
var<uniform> view: View;
|
||||||
@ -22,7 +29,7 @@ fn vertex(
|
|||||||
out.position = view.view_proj * vec4<f32>(vertex_position, 1.0);
|
out.position = view.view_proj * vec4<f32>(vertex_position, 1.0);
|
||||||
out.color = vertex_color;
|
out.color = vertex_color;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@group(1) @binding(0)
|
@group(1) @binding(0)
|
||||||
var sprite_texture: texture_2d<f32>;
|
var sprite_texture: texture_2d<f32>;
|
||||||
@ -31,7 +38,7 @@ var sprite_sampler: sampler;
|
|||||||
|
|
||||||
@fragment
|
@fragment
|
||||||
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
|
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||||
var color = textureSample(sprite_texture, sprite_sampler, in.uv);
|
var color = textureSample(sprite_texture, sprite_sampler, in.uv);
|
||||||
color = in.color * color;
|
color = in.color * color;
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user