KhronosGroup / KhronosGroup/glslang

Should enabling extensions raise errors ?

Open
#4,179 2 comments 0 reactions 0 assignees View on GitHub
bug GLSL/ESSL
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

Enabling `GL_EXT_mesh_shader` in a non mesh / task shader raises an error. Should it ? it is the only extension that does it (trust me, I tested it !). Most extensions just do nothing, and a few raise a warning, which feels like the right behavior.

```
WARNING: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:11: '#extension' : extension not supported: GL_KHR_shader_subgroup
WARNING: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:30: '#extension' : extension not supported: GL_KHR_shader_subgroup
WARNING: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:42: '#extension' : extension not supported: GL_EXT_subgroupuniform_qualifier
WARNING: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:53: '#extension' : extension not supported: GL_EXT_shader_subgroup_extended_types
WARNING: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:61: '#extension' : extension not supported: GL_NV_primitive_shading_rate
WARNING: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:63: '#extension' : extension not supported: GL_HUAWEI_subpass_shading
ERROR: /home/rcmz/Projects/shaderV3demos/shaderV3/includeGLSL/extensions.comp:67: '#extension GL_EXT_mesh_shader' : not supported in this stage: compute
```

Citing (and abbreviating) the GLSL spec :
_Directives to control the behavior of the compiler with respect to extensions are declared with the #extension directive
`#extension extension_name : behavior`
**Behavior Effect :**
**require** Give a compile-time error on the `#extension` if the extension `extension_name` is not supported.
**enable** Warn on the `#extension` if the extension `extension_name` is not supported._

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported #extension behavior using GL_EXT_mesh_shader in a compute shader, alongside the warning-only cases shown in the example. Compare the result with the cited GLSL rules for enable and require, and confirm that the behavior is consistent with the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.