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

Shader interface clarification in GLSL spec #115

Closed
mbechard opened this issue Apr 1, 2020 · 3 comments
Closed

Shader interface clarification in GLSL spec #115

mbechard opened this issue Apr 1, 2020 · 3 comments

Comments

@mbechard
Copy link
Contributor

mbechard commented Apr 1, 2020

Hey,
GLSL 4.60 defines a shader interface as:

A shader interface is defined to be one of these:
• All the uniform variables and uniform blocks declared in a program. This spans all compilation
units linked together within one program.
• All the buffer blocks declared in a program.
• The boundary between adjacent programmable pipeline stages: This spans all the outputs
declared in all compilation units of the first stage and all the inputs declared in all compilation
units of the second stage. Note that for the purposes of this definition, the fragment shader and
the preceding shader are considered to have a shared boundary even though in practice, all
values passed to the fragment shader first pass through the rasterizer and interpolator.

This reads to me to mean that buffer blocks and uniform blocks should be treated as different shader interfaces. Specifically, in the case of block naming, they would have different namespaces:

A block name is allowed to have different definitions in different shader interfaces
within the same shader, allowing, for example, an input block and output block to have the same
name.

Discussions with @johnkslang in this pull request for the reference compiler:
KhronosGroup/glslang#2156

Determined that for block naming, the buffer blocks and uniform blocks should share the same namespace. This matches what the current Intel and Nvidia GLSL compilers do as well. I think the spec should be clarified to match what the reference compiler (and other compilers) is doing.
Thanks!

@johnkslang
Copy link
Member

I think it is reasonable to consider that there are three interfaces in a shader, not four:

  1. inputs
  2. outputs
  3. uniform, including UBO and SSBO

We could make it work with four, but I'm unclear that's how most people are thinking or implementing to.

I guess the question is, who thinks there should be four? Is it okay to have three?

@mbechard
Copy link
Contributor Author

It's certainly more intuitive to me that there are 3. That's what I originally expected. I don't see UBO and SSBOs being different enough to warrant separation.

@johnkslang
Copy link
Member

Khronos discussed this internally, and it turns out there is a mix of implementation's interpretations. So, in the face of that, it was decided to leave the specification as is. (We can regroup on the original issue back at the glslang repo.)

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

3 participants