-
Notifications
You must be signed in to change notification settings - Fork 853
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
The array size of gl_SampleMask and gl_SampleMaskIn is ceil(gl_MaxSamples/32) #3399
The array size of gl_SampleMask and gl_SampleMaskIn is ceil(gl_MaxSamples/32) #3399
Conversation
@jimihem Can you please add a test to validate this change? It might also be helpful if the commit message is a bit more explicit with respect to what is being fixed. |
@ncesario-lunarg How to add a test to glslang? |
b547a25
to
2294aec
Compare
@ncesario-lunarg I have add a test to glslang, Can you help to merge this pr? |
Thanks for these changes @jimihem, and sorry for the late reply (somehow I missed your previous comment). This LGTM with just a few minor nits for the tests:
diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp
index cf56dae5..540cd99b 100644
--- a/gtests/AST.FromFile.cpp
+++ b/gtests/AST.FromFile.cpp
@@ -282,6 +282,7 @@ INSTANTIATE_TEST_SUITE_P(
"glsl.es320.subgroupQuad.comp",
"glsl.es320.subgroupVote.comp",
"glsl.es320.extTextureShadowLod.frag",
+ "gl_samplemask_array_size.frag",
"glsl.ext.textureShadowLod.frag",
"terminate.frag",
"terminate.vert", Once you have that, you can run the gtest executable in "update mode" to automatically update the test results file (e.g.,
|
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.
One question, but otherwise LGTM modulo some changes to the tests.
@jimihem If you're ok with me updating your branch, I can push the testing changes I suggested.
} else if (intermNode->getAsSymbolNode()) { | ||
const TString& name = intermNode->getAsSymbolNode()->getName(); | ||
if (name == "gl_SampleMask" || name == "gl_SampleMaskIn") { |
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.
Would it make more sense to instead get the qualifier and compare against EbvSampleMask
here? e.g.,
} else if (const auto typed = intermNode->getAsTyped()) {
if (typed->getQualifier().builtIn == EbvSampleMask) {
…ples/32) Oes spec says: For the both the input array gl_SampleMaskIn[] and the output array gl_SampleMask[], bit B of mask M (gl_SampleMaskIn[M] or gl_SampleMask[M]) corresponds to sample 32*M+B. These arrays have ceil(gl_MaxSamples/32) elements, where gl_MaxSamples is the maximum number of color samples supported by the implementation. But glslang report error "array must have size before use length". layout(location = 0) out mediump vec4 fragColor; void main (void) { for (int i = 0; i < gl_SampleMask.length(); ++i) gl_SampleMask[i] = int(0xAAAAAAAA); fragColor = vec4(0.0, 1.0, 0.0, 1.0); }
2294aec
to
4dac03d
Compare
@ncesario-lunarg Thank you for your reply, I have made some changes to this pr based on your suggestion. |
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.
Thanks @jimihem, this LGTM, but I'll give @arcady-lunarg a chance to take a look before merging.
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.
I think it might be a good idea to add a test for the case where gl_MaxSamples is greater than 32 (something like 64 would probably be a good value since that's the highest I have heard of).
@arcady-lunarg gl_MaxSamples cann't be redeclared, when I try to redeclared it and initialize it as 64, glslang will report error. |
@jimihem I think this would be a good case for a |
…s for gl_MaxSapmles = 64.
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.
Thanks, this looks good.
#version 320 es
layout(location = 0) out mediump vec4 fragColor;
void main (void)
{
for (int i = 0; i < gl_SampleMask.length(); ++i)
gl_SampleMask[i] = int(0xAAAAAAAA);
}
gl_SampleMask.length() report error: “array must have size before use length"
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.default_framebuffer