KhronosGroup / GLSL

GLSL Shading Language Issue Tracker
328 stars 96 forks source link

[question] Add maximum number of uniform buffer or shader storage block bindings Built-In Constants. #155

Closed ZhiqianXia closed 3 years ago

ZhiqianXia commented 3 years ago

Hi , I have a question about here's why not include the maximum number of uniform buffer or shader storage block bindings into the built-in constants. but i did find out some description at ogl4.5 spec and some cts test also test this feature. Is there any historical reason here? And I think their roles just like the built-in constants at ch7.3, ogl4.6 spec. Thank you.

ogl4.5 spec : chapter 4.4.5 Uniform and Shader Storage Block Layout Qualifiers

If the binding point for any uniform or shader storage block instance is less than zero, or greater than or equal to the implementation-dependent maximum number of uniform buffer bindings, a compile-time error will occur.

shader

ES31-CTS.functional.layout_binding.negative.ssbo.vertex_binding_over_max
layout(std140, binding = 8) buffer ColorBuffer0
{
       highp vec4 color1;
       highp vec4 color2;
} colors0;
pdaniell-nv commented 3 years ago

If I understand correctly you're asking why there is no gl_MaxUniformBufferBindings or gl_MaxShaderStorageBufferBindings built in constant?

ZhiqianXia commented 3 years ago

Yes, Do you know about that ? Thanks to your respond, daniell.

pdaniell-nv commented 3 years ago

I don't know why we don't have builtin constants for those in the shader. It may have been an oversight, or maybe when those extensions were created the designers didn't think it was necessary. I assume this isn't blocking you and you were just curious?

ZhiqianXia commented 3 years ago

@pdaniell-nv Thanks to your respond. Maintainer of KhronosGroup/glslang asked me to give any description about Max binding for ubo/ssbo at glsl spec. Otherwise , they won't support the feature. So i came to here. Now, I find the useful info for MaxUniformBufferBinding. Here is a MAX UNIFORM BUFFER BINDINGS value at spec glspec46 , which value is 84. This requirement wasn't writed into languge spec, but the feature was writed into glspec and tested at CTS. So i think it is a default requirement, even though it wasn't listed at glsl spec. I'm curious if I can officially add these descriptions to Spec. In other word, There are any precondition to add a feature into spec ? Happy to hear any form of feedback from you!

shader : should report a error at compile time. layout(binding=**84**, std140) uniform uniform0_block {float uniform0_a; float uniform0_b; } ;

reference: https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.compatibility.pdf page 804

pdaniell-nv commented 3 years ago

Support for new GLSL builtins gl_MaxUniformBufferBindings or gl_MaxShaderStorageBufferBindings would need to be added as an extension to GLSL. This extension might eventually be promoted to a new GLSL core version if and when a new core version is published.

An example of GLSL extensions can be seen in the registry: https://github.com/KhronosGroup/GLSL#extension-specifications-in-this-repository

ZhiqianXia commented 3 years ago

Thank your suggestions.