-
Notifications
You must be signed in to change notification settings - Fork 864
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
glslang should report a error for Feature: last case/default label not followed by statements'. #2712
Conversation
Looks like you will need to fix test spv.switch.frag. |
Here is the current situation as I can see:
As far as I can tell, generation of SPIR-V does not have an effect. Is this consistent with your reading of the specs? If so, please change the logic here to fit this understanding of the specs. Thanks! |
e7a130d
to
c7e5f32
Compare
Spec4.6 says: Fall through labels are allowed. So , I think there is a warn for 4.6 , not an error. |
This is from the 4.60.7 GLSL spec: Fall through labels are allowed, but it is a compile-time error to have no statement between a label and the end of the switch statement. |
Please change your code to match the logic as I have outlined above. |
c7e5f32
to
43280d4
Compare
@greg-lunarg thanks for your suggestion, I have changed the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix formatting where noted. Otherwise good. Thanks!
error(loc, "last case/default label not followed by statements", "switch", ""); | ||
else if (!isEsProfile() && (version <= 430 || version >= 460)) | ||
error(loc, "last case/default label not followed by statements", "switch", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please fix indentation here? Should align with error above.
else | ||
warn(loc, "last case/default label not followed by statements", "switch", ""); | ||
warn(loc, "last case/default label not followed by statements", "switch", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please fix indentation here? Should align with errors above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that , i have fixed it.
…by statements'. Signed-off-by: ZhiqianXia <[email protected]>
43280d4
to
1de2d17
Compare
the ol430 spec says:
Fall through labels are allowed, but it is a compile-time error to have no statement between a label and the end of the switch statement.
So if the glsl version <=430 , glslang should report a error for Feature: last case/default label not followed by statements'.
shader:
specs:
[1] https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.30.pdf
[2] https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.40.pdf