Skip to content

Commit

Permalink
Fix all other shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsr committed Mar 10, 2021
1 parent 1e8c67a commit 55910d3
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_render/src/shader/shader_reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ mod tests {
layout(location = 2) in uvec4 I_TestInstancing_Property;
layout(location = 0) out vec4 v_Position;
layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/wireframe/wireframe.vert
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

layout(location = 0) in vec3 Vertex_Position;

layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
};

Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_sprite/src/render/sprite.vert
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ layout(location = 2) in vec2 Vertex_Uv;

layout(location = 0) out vec2 v_Uv;

layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand All @@ -26,7 +26,7 @@ void main() {

uint x_flip_bit = 1; // The X flip bit
uint y_flip_bit = 2; // The Y flip bit

// Note: Here we subtract f32::EPSILON from the flipped UV coord. This is due to reasons unknown
// to me (@zicklag ) that causes the uv's to be slightly offset and causes over/under running of
// the sprite UV sampling which is visible when resizing the screen.
Expand All @@ -42,4 +42,4 @@ void main() {

vec3 position = Vertex_Position * vec3(size, 1.0);
gl_Position = ViewProj * Model * vec4(position, 1.0);
}
}
8 changes: 3 additions & 5 deletions crates/bevy_sprite/src/render/sprite_sheet.vert
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(location = 2) in vec2 Vertex_Uv;
layout(location = 0) out vec2 v_Uv;
layout(location = 1) out vec4 v_Color;

layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand All @@ -26,7 +26,6 @@ layout(set = 1, binding = 1) buffer TextureAtlas_textures {
Rect[] Textures;
};


layout(set = 2, binding = 0) uniform Transform {
mat4 SpriteTransform;
};
Expand Down Expand Up @@ -76,11 +75,10 @@ void main() {
bottom_left,
top_left,
top_right,
bottom_right
);
bottom_right);

v_Uv = (atlas_positions[gl_VertexIndex]) / AtlasSize;

v_Color = color;
gl_Position = ViewProj * SpriteTransform * vec4(vertex_position, 1.0);
}
}
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/ui.vert
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ layout(location = 2) in vec2 Vertex_Uv;

layout(location = 0) out vec2 v_Uv;

layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand All @@ -22,4 +22,4 @@ void main() {
v_Uv = Vertex_Uv;
vec3 position = Vertex_Position * vec3(NodeSize, 0.0);
gl_Position = ViewProj * Object * vec4(position, 1.0);
}
}
2 changes: 1 addition & 1 deletion examples/shader/array_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const VERTEX_SHADER: &str = r#"
layout(location = 0) in vec3 Vertex_Position;
layout(location = 0) out vec4 v_Position;
layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand Down
2 changes: 1 addition & 1 deletion examples/shader/mesh_custom_attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ layout(location = 0) in vec3 Vertex_Position;
layout(location = 1) in vec3 Vertex_Color;
layout(location = 0) out vec3 v_color;
layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand Down
2 changes: 1 addition & 1 deletion examples/shader/shader_custom_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct MyMaterial {
const VERTEX_SHADER: &str = r#"
#version 450
layout(location = 0) in vec3 Vertex_Position;
layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand Down
2 changes: 1 addition & 1 deletion examples/shader/shader_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct MyMaterial {
const VERTEX_SHADER: &str = r#"
#version 450
layout(location = 0) in vec3 Vertex_Position;
layout(set = 0, binding = 0) uniform Camera {
layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 View;
};
Expand Down

0 comments on commit 55910d3

Please sign in to comment.