summaryrefslogtreecommitdiff
path: root/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'glsl')
-rw-r--r--glsl/shader_2d_solid.frag.glsl (renamed from glsl/shader_2d.frag.glsl)2
-rw-r--r--glsl/shader_2d_solid.vert.glsl (renamed from glsl/shader_2d.vert.glsl)15
-rw-r--r--glsl/shader_2d_wired.frag.glsl11
-rw-r--r--glsl/shader_2d_wired.vert.glsl19
4 files changed, 20 insertions, 27 deletions
diff --git a/glsl/shader_2d.frag.glsl b/glsl/shader_2d_solid.frag.glsl
index 54ab1be..7142979 100644
--- a/glsl/shader_2d.frag.glsl
+++ b/glsl/shader_2d_solid.frag.glsl
@@ -21,7 +21,7 @@ layout(location = 0) in vec2 in_texture_coord;
layout(location = 0) out vec4 out_color;
-layout(set = 1, binding = 1) uniform sampler2D texture_sampler;
+layout(set = 1, binding = 0) uniform sampler2D texture_sampler;
void
main()
diff --git a/glsl/shader_2d.vert.glsl b/glsl/shader_2d_solid.vert.glsl
index 5c5a243..bf0e237 100644
--- a/glsl/shader_2d.vert.glsl
+++ b/glsl/shader_2d_solid.vert.glsl
@@ -26,32 +26,31 @@ layout(set = 0, binding = 0) uniform UBOView2D
mat4 proj;
} ubo_view;
-layout(set = 1, binding = 0) uniform UBOSpritePositions
+layout(push_constant) uniform PCSprite
{
- vec4 positions[128];
-} ubo_sprite_positions;
+ vec4 position;
+} sprite;
void
main()
{
vec2 coordinate;
- vec4 position = ubo_sprite_positions.positions[gl_InstanceIndex];
out_texture_coord = in_texture_coord;
switch(gl_VertexIndex)
{
case 0:
- coordinate = vec2(position.x, position.y);
+ coordinate = vec2(sprite.position.x, sprite.position.y);
break;
case 1:
- coordinate = vec2(position.x, position.w);
+ coordinate = vec2(sprite.position.x, sprite.position.w);
break;
case 2:
- coordinate = vec2(position.z, position.y);
+ coordinate = vec2(sprite.position.z, sprite.position.y);
break;
case 3:
- coordinate = vec2(position.z, position.w);
+ coordinate = vec2(sprite.position.z, sprite.position.w);
break;
}
gl_Position = ubo_view.proj * vec4(coordinate, 0.0, 1.0);
diff --git a/glsl/shader_2d_wired.frag.glsl b/glsl/shader_2d_wired.frag.glsl
index 569b950..c7aa3f4 100644
--- a/glsl/shader_2d_wired.frag.glsl
+++ b/glsl/shader_2d_wired.frag.glsl
@@ -17,17 +17,16 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
-layout(location = 0) in flat int in_instance_index;
-
layout(location = 0) out vec4 out_color;
-layout(set = 1, binding = 1) uniform UBOColors
+layout(push_constant) uniform PCColor
{
- vec3 colors[128];
-} ubo_colors;
+ vec4 offset; //offset
+ vec3 color;
+} sprite;
void
main()
{
- out_color = vec4(ubo_colors.colors[in_instance_index], 1.0);
+ out_color = vec4(sprite.color, 1.0);
}
diff --git a/glsl/shader_2d_wired.vert.glsl b/glsl/shader_2d_wired.vert.glsl
index 28cc55f..0e9258e 100644
--- a/glsl/shader_2d_wired.vert.glsl
+++ b/glsl/shader_2d_wired.vert.glsl
@@ -17,39 +17,34 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
-layout(location = 0) out int out_instance_index;
-
layout(set = 0, binding = 0) uniform UBOView2D
{
mat4 proj;
} ubo_view;
-layout(set = 1, binding = 0) uniform UBORectangles
+layout(push_constant) uniform PCRectangle
{
- vec4 positions[128];
-} ubo_sprite_positions;
+ vec4 position;
+} sprite;
void
main()
{
vec2 coordinate;
- vec4 position = ubo_sprite_positions.positions[gl_InstanceIndex];
-
- out_instance_index = gl_InstanceIndex;
switch(gl_VertexIndex)
{
case 0:
- coordinate = vec2(position.x, position.y);
+ coordinate = vec2(sprite.position.x, sprite.position.y);
break;
case 1:
- coordinate = vec2(position.x, position.w);
+ coordinate = vec2(sprite.position.x, sprite.position.w);
break;
case 2:
- coordinate = vec2(position.z, position.y);
+ coordinate = vec2(sprite.position.z, sprite.position.y);
break;
case 3:
- coordinate = vec2(position.z, position.w);
+ coordinate = vec2(sprite.position.z, sprite.position.w);
break;
}
gl_Position = ubo_view.proj * vec4(coordinate, 0.0, 1.0);