From 4025386ca85df2aca576c440d9dfb890f74038f7 Mon Sep 17 00:00:00 2001 From: Piotr Byszewski Date: Fri, 21 Jul 2017 15:35:33 +0200 Subject: [PATCH] Disallow unsized array of atomic_uint 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 --- .../gl/khronos_mustpass/4.5.5.x/gl45-master.txt | 1 + .../khronos_mustpass/3.2.4.x/gles31-khr-master.txt | 1 + .../khronos_mustpass/master/gles31-khr-master.txt | 1 + .../modules/gl/gl4cShaderAtomicCountersTests.cpp | 50 ++++++++++++++++++++++ .../gles31/es31cShaderAtomicCountersTests.cpp | 48 +++++++++++++++++++++ 5 files changed, 101 insertions(+) diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt index c5e8597..5b0b793 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt @@ -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 diff --git a/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt b/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt index 589b9c1..d9df703 100644 --- a/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt +++ b/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt @@ -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 diff --git a/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt b/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt index 589b9c1..d9df703 100644 --- a/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt +++ b/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt @@ -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 diff --git a/external/openglcts/modules/gl/gl4cShaderAtomicCountersTests.cpp b/external/openglcts/modules/gl/gl4cShaderAtomicCountersTests.cpp index b1b19e1..2cb6b42 100644 --- a/external/openglcts/modules/gl/gl4cShaderAtomicCountersTests.cpp +++ b/external/openglcts/modules/gl/gl4cShaderAtomicCountersTests.cpp @@ -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)); addChild(new TestSubcase(m_context, "negative-array", TestSubcase::Create)); addChild(new TestSubcase(m_context, "negative-arithmetic", TestSubcase::Create)); + + if(contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5))) + addChild(new TestSubcase(m_context, "negative-unsized-array", TestSubcase::Create)); } } // namespace gl4cts diff --git a/external/openglcts/modules/gles31/es31cShaderAtomicCountersTests.cpp b/external/openglcts/modules/gles31/es31cShaderAtomicCountersTests.cpp index dba7d47..d8995eb 100644 --- a/external/openglcts/modules/gles31/es31cShaderAtomicCountersTests.cpp +++ b/external/openglcts/modules/gles31/es31cShaderAtomicCountersTests.cpp @@ -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)); addChild(new TestSubcase(m_context, "negative-array", TestSubcase::Create)); addChild(new TestSubcase(m_context, "negative-arithmetic", TestSubcase::Create)); + addChild(new TestSubcase(m_context, "negative-unsized-array", TestSubcase::Create)); } } -- 2.7.4