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

undefined identifier nonuniformEXT compiler error #5691

Open
theblackunknown opened this issue Nov 26, 2024 · 3 comments
Open

undefined identifier nonuniformEXT compiler error #5691

theblackunknown opened this issue Nov 26, 2024 · 3 comments
Assignees
Labels
goal:forward looking Feature needed at a later date, not connected to a specific use case.

Comments

@theblackunknown
Copy link

Hi team,

While porting our GLSL shaders to be compiled with slangc, I am running into a compiler error where nonuniformEXT is unexpected.
It is a feature offered by GL_EXT_nonuniform_qualifier that we are using in our shaders, I should expect Slang to resolve it out of the box, or if I need to tell the Slang compiler that I need this extension for things to resolve correctly ?

See below for a minimal repro case.
If you can point me to how to port it as a Slang test I would gladly contribute it if that helps.

Given the following nonuniformExt.slang file

#version 450 core

layout(location = 0) out mediump vec4 o_color;
layout(location = 0) flat in int i;
layout(set = 0, binding = 0) uniform sampler2D tex[2];

void main()
{
    o_color = texture(tex[nonuniformEXT(i)], vec2(0.25, 0.75));
}

compiling the above file using the following command line
slangc.exe -target spirv -stage fragment -entry main nonuniformExt.slang

Will produce the following errors

tests\glsl\nonuniformExt.slang(9): error 30015: undefined identifier 'nonuniformEXT'.
    o_color = texture(tex[nonuniformEXT(i)], vec2(0.25, 0.75));
                          ^~~~~~~~~~~~~
tests\glsl\nonuniformExt.slang(9): error 30014: index expression must evaluate to int.
    o_color = texture(tex[nonuniformEXT(i)], vec2(0.25, 0.75));
@jkwak-work
Copy link
Collaborator

This appears to be a missing feature support for GLSL.
As a workaround, you can have a following line,

#define nonuniformEXT NonUniformResourceIndex

@theblackunknown
Copy link
Author

Thanks @jkwak-work, I have applied your suggestion and it seems to work !
Would you be able to point me at few places if I want to contribute to add this feature ?

@jkwak-work
Copy link
Collaborator

I have a quick PR for this issue #5695

@jkwak-work jkwak-work self-assigned this Nov 27, 2024
@jkwak-work jkwak-work added the goal:forward looking Feature needed at a later date, not connected to a specific use case. label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:forward looking Feature needed at a later date, not connected to a specific use case.
Projects
None yet
Development

No branches or pull requests

2 participants