]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/shadow.glsl
Annotate uniforms with descriptor set layout qualifiers
[libs/gl.git] / shaderlib / shadow.glsl
index d6e2b385f8955009abf737d998fbe7dd984f8996..049ec188e5a97a67a6e42a6a87e5e3c315e284df 100644 (file)
@@ -9,13 +9,13 @@ struct ShadowParameters
        vec2 bias;
 };
 
-uniform ShadowMap
+layout(set=0) uniform ShadowMap
 {
        ShadowParameters shadows[max_lights];
        mat4 shd_world_matrix[max_lights*4];
 };
 
-uniform sampler2DShadow shadow_map;
+layout(set=0) uniform sampler2DShadow shadow_map;
 
 layout(constant_id=auto) const bool use_shadow_map = false;
 
@@ -52,7 +52,7 @@ virtual float get_shadow_factor(int index, vec4 world_pos)
                        return 1.0;
 
                vec4 region = shadows[index].region;
-               float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, shadow_coord.z));
+               float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, min(shadow_coord.z, 1.0)));
                return mix(1.0, shadow_sample, shadows[index].darkness);
        }
        else