Disallow unsized array of atomic_uint
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Fri, 21 Jul 2017 13:35:33 +0000 (15:35 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 9 Aug 2017 09:29:27 +0000 (05:29 -0400)
It is a compile-time error to declare an unsized array of
atomic_uint.

Components: OpenGL

VK-GL-CTS issue: 398

Affects:
KHR-GLES31.core.shader_atomic_counters.negative-unsized-array
KHR-GL45.shader_atomic_counters.negative-unsized-array

Change-Id: Ib0f1e40660fa9fce830ae0710a3c51b9db9f4244

external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt
external/openglcts/modules/gl/gl4cShaderAtomicCountersTests.cpp
external/openglcts/modules/gles31/es31cShaderAtomicCountersTests.cpp

index c5e8597..5b0b793 100644 (file)
@@ -2868,6 +2868,7 @@ KHR-GL45.shader_atomic_counters.negative-ubo
 KHR-GL45.shader_atomic_counters.negative-uniform
 KHR-GL45.shader_atomic_counters.negative-array
 KHR-GL45.shader_atomic_counters.negative-arithmetic
+KHR-GL45.shader_atomic_counters.negative-unsized-array
 KHR-GL45.shader_image_load_store.basic-api-get
 KHR-GL45.shader_image_load_store.basic-api-bind
 KHR-GL45.shader_image_load_store.basic-api-barrier
index 589b9c1..d9df703 100644 (file)
@@ -83,6 +83,7 @@ KHR-GLES31.core.shader_atomic_counters.negative-ubo
 KHR-GLES31.core.shader_atomic_counters.negative-uniform
 KHR-GLES31.core.shader_atomic_counters.negative-array
 KHR-GLES31.core.shader_atomic_counters.negative-arithmetic
+KHR-GLES31.core.shader_atomic_counters.negative-unsized-array
 KHR-GLES31.core.texture_gather.api-enums
 KHR-GLES31.core.texture_gather.gather-glsl-compile
 KHR-GLES31.core.texture_gather.plain-gather-float-2d
index 589b9c1..d9df703 100644 (file)
@@ -83,6 +83,7 @@ KHR-GLES31.core.shader_atomic_counters.negative-ubo
 KHR-GLES31.core.shader_atomic_counters.negative-uniform
 KHR-GLES31.core.shader_atomic_counters.negative-array
 KHR-GLES31.core.shader_atomic_counters.negative-arithmetic
+KHR-GLES31.core.shader_atomic_counters.negative-unsized-array
 KHR-GLES31.core.texture_gather.api-enums
 KHR-GLES31.core.texture_gather.gather-glsl-compile
 KHR-GLES31.core.texture_gather.plain-gather-float-2d
index b1b19e1..2cb6b42 100644 (file)
@@ -3578,6 +3578,53 @@ class NegativeArray : public SACSubcaseBase
        }
 };
 
+class NegativeUnsizedArray : public SACSubcaseBase
+{
+       virtual std::string Title()
+       {
+               return NL "GLSL errors";
+       }
+
+       virtual std::string Purpose()
+       {
+               return NL "Verify that it is compile-time error to declare an unsized array of atomic_uint..";
+       }
+
+       virtual std::string Method()
+       {
+               return NL "";
+       }
+
+       virtual std::string PassCriteria()
+       {
+               return NL "";
+       }
+
+       virtual long Run()
+       {
+               const char* glsl_fs1 = "#version 450 core" NL "layout(location = 0) out uvec4 o_color[4];"
+                                                          "  layout(binding = 0, offset = 4) uniform atomic_uint ac_counter[];" NL
+                                                          "void main() {" NL "  o_color[0] = uvec4(atomicCounterIncrement(ac_counter[0]));" NL "}";
+
+               GLuint sh = glCreateShader(GL_FRAGMENT_SHADER);
+               glShaderSource(sh, 1, &glsl_fs1, NULL);
+               glCompileShader(sh);
+               GLint status_comp;
+               glGetShaderiv(sh, GL_COMPILE_STATUS, &status_comp);
+               glDeleteShader(sh);
+
+               if (status_comp == GL_TRUE)
+               {
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected error during fragment shader compilation."
+                               << tcu::TestLog::EndMessage;
+                       return ERROR;
+               }
+
+               return NO_ERROR;
+       }
+};
+
 class BasicUsageNoOffset : public SACSubcaseBase
 {
        virtual std::string Title()
@@ -4559,6 +4606,9 @@ void ShaderAtomicCountersTests::init()
        addChild(new TestSubcase(m_context, "negative-uniform", TestSubcase::Create<NegativeUniform>));
        addChild(new TestSubcase(m_context, "negative-array", TestSubcase::Create<NegativeArray>));
        addChild(new TestSubcase(m_context, "negative-arithmetic", TestSubcase::Create<NegativeArithmetic>));
+
+       if(contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5)))
+               addChild(new TestSubcase(m_context, "negative-unsized-array", TestSubcase::Create<NegativeUnsizedArray>));
 }
 
 } // namespace gl4cts
index dba7d47..d8995eb 100644 (file)
@@ -3378,6 +3378,53 @@ class NegativeArithmetic : public BasicUsageCS
        }
 };
 
+class NegativeUnsizedArray : public SACSubcaseBase
+{
+       virtual std::string Title()
+       {
+               return NL "GLSL errors";
+       }
+
+       virtual std::string Purpose()
+       {
+               return NL "Verify that it is compile-time error to declare an unsized array of atomic_uint..";
+       }
+
+       virtual std::string Method()
+       {
+               return NL "";
+       }
+
+       virtual std::string PassCriteria()
+       {
+               return NL "";
+       }
+
+       virtual long Run()
+       {
+               const char* glsl_fs1 = "#version 310 es" NL "layout(location = 0) out uvec4 o_color[4];"
+                                                          "  layout(binding = 0, offset = 4) uniform atomic_uint ac_counter[];" NL
+                                                          "void main() {" NL "  o_color[0] = uvec4(atomicCounterIncrement(ac_counter[0]));" NL "}";
+
+               GLuint sh = glCreateShader(GL_FRAGMENT_SHADER);
+               glShaderSource(sh, 1, &glsl_fs1, NULL);
+               glCompileShader(sh);
+               GLint status_comp;
+               glGetShaderiv(sh, GL_COMPILE_STATUS, &status_comp);
+               glDeleteShader(sh);
+
+               if (status_comp == GL_TRUE)
+               {
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected error during fragment shader compilation."
+                               << tcu::TestLog::EndMessage;
+                       return ERROR;
+               }
+
+               return NO_ERROR;
+       }
+};
+
 class AdvancedManyDrawCalls2 : public SACSubcaseBase
 {
 
@@ -3729,5 +3776,6 @@ void ShaderAtomicCountersTests::init()
        addChild(new TestSubcase(m_context, "negative-uniform", TestSubcase::Create<NegativeUniform>));
        addChild(new TestSubcase(m_context, "negative-array", TestSubcase::Create<NegativeArray>));
        addChild(new TestSubcase(m_context, "negative-arithmetic", TestSubcase::Create<NegativeArithmetic>));
+       addChild(new TestSubcase(m_context, "negative-unsized-array", TestSubcase::Create<NegativeUnsizedArray>));
 }
 }