You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a shader file contains two shaders which use the same sampler name, but is assigned to different slots, the compilation will fail. I'm not sure if this is a bug or not, but I don't understand why it's required. It makes it hard to re-use code with blocks.
The same applies to uniform block names in different shaders in same file.
Example:
@vs vs
@glsl_options flip_vert_y
layout(location=0) in vec2 a_position;
out vec2 v_uv;
void main() {
gl_Position = vec4(a_position, 0., 1.);
v_uv = a_position * vec2(.5, -.5) + vec2(.5, .5);
}
@end
@fs fs_1
in vec2 v_uv;
out vec4 out_color;
layout(binding=0) uniform sampler2D s_texture;
void main() {
vec3 color = texture(s_texture, v_uv).rgb;
out_color = vec4(color, 1.0);
}
@end
@fs fs_2
in vec2 v_uv;
out vec4 out_color;
layout(binding=0) uniform sampler2D s_background;
layout(binding=1) uniform sampler2D s_texture; // error here
void main() {
vec3 color = texture(s_background, v_uv).rgb + texture(s_texture, v_uv).rgb;
out_color = vec4(color, 1.0);
}
@end
@program shader1 vs fs_1
@program shader2 vs fs_2
Error:
conflicting texture definitions found for 's_texture'
This example can be fixed trivially by switching s_background and s_texture slots, but it's not always that simple if you have more than two variants of the shader which uses different nr of textures. :)
The text was updated successfully, but these errors were encountered:
If a shader file contains two shaders which use the same sampler name, but is assigned to different slots, the compilation will fail. I'm not sure if this is a bug or not, but I don't understand why it's required. It makes it hard to re-use code with blocks.
The same applies to uniform block names in different shaders in same file.
Example:
Error:
This example can be fixed trivially by switching s_background and s_texture slots, but it's not always that simple if you have more than two variants of the shader which uses different nr of textures. :)
The text was updated successfully, but these errors were encountered: