summaryrefslogtreecommitdiff
path: root/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'glsl')
-rw-r--r--glsl/shader_3d.frag.glsl2
-rw-r--r--glsl/shader_3d.vert.glsl9
2 files changed, 5 insertions, 6 deletions
diff --git a/glsl/shader_3d.frag.glsl b/glsl/shader_3d.frag.glsl
index 302f7d4..916f26f 100644
--- a/glsl/shader_3d.frag.glsl
+++ b/glsl/shader_3d.frag.glsl
@@ -34,7 +34,7 @@ layout(set = 0, binding = 1) uniform UBOWorld
vec4 directional_light_color;
} ubo_world;
-layout(set = 2, binding = 1) uniform sampler2D texture_sampler;
+layout(set = 2, binding = 0) uniform sampler2D texture_sampler;
void
main()
diff --git a/glsl/shader_3d.vert.glsl b/glsl/shader_3d.vert.glsl
index 29beea9..8fd9167 100644
--- a/glsl/shader_3d.vert.glsl
+++ b/glsl/shader_3d.vert.glsl
@@ -40,9 +40,9 @@ layout(set = 1, binding = 0) uniform UBOView
mat4 proj;
} ubo_view;
-layout(set = 2, binding = 0) uniform UBOModelInstance
+layout(push_constant) uniform UBOModelInstance
{
- mat4 instances[128];
+ mat4 matrix;
} ubo_model_instance;
void
@@ -50,9 +50,8 @@ main()
{
gl_Position =
ubo_view.proj * ubo_view.view *
- ubo_model_instance.instances[gl_InstanceIndex] * vec4(in_position, 1.0);
+ ubo_model_instance.matrix * vec4(in_position, 1.0);
out_dto.frag_color = ubo_world.ambient_light_color;
out_dto.frag_texture_coord = in_texture_coord;
- out_dto.normal = mat3(ubo_model_instance.instances[gl_InstanceIndex]) *
- in_normal;
+ out_dto.normal = mat3(ubo_model_instance.matrix) * in_normal;
}