In GLSL it's possible to declare 'unbound' array of descriptors, by writing something like:
layout(binding = 0) uniform sampler2D texture[];
This has about 3 different behaviors in glslang compiler:
compiler deduces size automatically, based of largest array index used in shader code
1.1 OpTypeArray with size of one is emitted, if array was never used in code
if GL_EXT_nonuniform_qualifier enabled usually OpTypeRuntimeArray will be used - resulting into 'true' unbound array
if GL_EXT_nonuniform_qualifier enabled and array not been used - OpTypeArray with size of 1 will be emitted
Behavior 3, may cause different shader stages to be incompatible with each-other, when array declared in both vertex&fragment but used only in one of stages.
Proposal:
When GL_EXT_nonuniform_qualifier is in use, only OpTypeRuntimeArray must be used, for unbound array.
In GLSL it's possible to declare 'unbound' array of descriptors, by writing something like:
This has about 3 different behaviors in glslang compiler:
OpTypeArray
with size of one is emitted, if array was never used in codeGL_EXT_nonuniform_qualifier
enabled usuallyOpTypeRuntimeArray
will be used - resulting into 'true' unbound arrayGL_EXT_nonuniform_qualifier
enabled and array not been used -OpTypeArray
with size of1
will be emittedBehavior 3, may cause different shader stages to be incompatible with each-other, when array declared in both vertex&fragment but used only in one of stages.
Proposal: When
GL_EXT_nonuniform_qualifier
is in use, onlyOpTypeRuntimeArray
must be used, for unbound array.