Commit 2d1d9d35 by Shahbaz Youssefi Committed by Commit Bot

Fix atomicAdd validation w.r.t to swizzles

Bug: angleproject:4150 Change-Id: I22c0c0382a2b208dd983fa1981ffc75f1b1945e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2022359Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 1a1a1427
......@@ -5898,9 +5898,13 @@ void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *function
return;
}
while (memNode->getAsBinaryNode())
while (memNode->getAsBinaryNode() || memNode->getAsSwizzleNode())
{
memNode = memNode->getAsBinaryNode()->getLeft();
// Child 0 is "left" if binary, and the expression being swizzled if swizzle.
// Note: we don't need to check that the binary operation is one of EOp*Index*, as any
// other operation will result in a temp value which cannot be passed to this
// out/inout parameter anyway.
memNode = memNode->getChildNode(0)->getAsTyped();
if (IsBufferOrSharedVariable(memNode))
{
return;
......
......@@ -5700,6 +5700,50 @@ TEST_F(FragmentShaderValidationTest, AtomicAddWithNonStorageVariable)
}
}
// Test that it is acceptable to pass a swizzle of a member of a shader storage block to the mem
// argument of an atomic memory function.
TEST_F(FragmentShaderValidationTest, AtomicAddWithSwizzle)
{
const std::string &shaderString =
R"(#version 310 es
layout(std140) buffer bufferName{
uvec4 u1[2];
} instanceName[3];
void main()
{
atomicAdd(instanceName[2].u1[1].y, 2u);
})";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Test that it is not allowed to pass an expression that does not constitute of indexing, field
// selection or swizzle to the mem argument of an atomic memory function.
TEST_F(FragmentShaderValidationTest, AtomicAddWithNonIndexNonSwizzleExpression)
{
const std::string &shaderString =
R"(#version 310 es
layout(std140) buffer bufferName{
uint u1[2];
} instanceName[3];
void main()
{
atomicAdd(instanceName[2].u1[1] + 1u, 2u);
})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Test that negative indexing of a matrix doesn't result in an assert.
TEST_F(FragmentShaderValidationTest, MatrixNegativeIndex)
{
......
......@@ -70,10 +70,6 @@
4146 : KHR-GLES31.core.vertex_attrib_binding.advanced-bindingUpdate = FAIL
4146 : KHR-GLES31.core.vertex_attrib_binding.advanced-largeStrideAndOffsetsNewAndLegacyAPI = FAIL
// Error with detecting some atomic counter buffer uses:
4150 : KHR-GLES31.core.shader_storage_buffer_object.basic-atomic-case3-cs = FAIL
4150 : KHR-GLES31.core.shader_storage_buffer_object.basic-atomic-case3-vsfs = FAIL
// Multisampled textures:
// --gtest_filter=dEQP.KHR_GLES31/core_texture_storage_multisample_FunctionalTests_verify_sample_masking_for_non_integer_color_renderable_internalformats* --use-angle=swiftshader
4259 SWIFTSHADER : KHR-GLES31.core.texture_storage_multisample.FunctionalTests.verify_sample_masking_for_non_integer_color_renderable_internalformats = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment