Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify compilation of unbound array #231

Open
Try opened this issue Feb 3, 2024 · 0 comments
Open

Clarify compilation of unbound array #231

Try opened this issue Feb 3, 2024 · 0 comments

Comments

@Try
Copy link

Try commented Feb 3, 2024

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:

  1. 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
  2. if GL_EXT_nonuniform_qualifier enabled usually OpTypeRuntimeArray will be used - resulting into 'true' unbound array
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant