Add ANDROID_extension_pack_es31a tests.
authorJarkko Pöyry <jpoyry@google.com>
Tue, 16 Dec 2014 19:33:56 +0000 (11:33 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Mon, 5 Jan 2015 23:05:43 +0000 (15:05 -0800)
- Check extension dependencies.
- Add implementation limit checks.
- Basic shader tests with AEP extension directive.
- Add 'expect build_successful' mode to ShaderLibrary. This mode checks
  only that the shaders compile and the programs link but does not
  attempt to execute the shader program. This is useful for example if
  test only wants to check that a certain sampler type is available.

Bug: 18337603
Change-Id: Ib9715074c6aaccb40c0070df211236d95c7ef66a

Android.mk
data/gles31/shaders/android_extension_pack.test [new file with mode: 0644]
doc/testspecs/GLES31/functional.android_extension_pack.txt [new file with mode: 0644]
modules/gles31/functional/CMakeLists.txt
modules/gles31/functional/es31fAndroidExtensionPackES31ATests.cpp [new file with mode: 0644]
modules/gles31/functional/es31fAndroidExtensionPackES31ATests.hpp [new file with mode: 0644]
modules/gles31/functional/es31fFunctionalTests.cpp
modules/glshared/glsShaderLibrary.cpp
modules/glshared/glsShaderLibraryCase.cpp
modules/glshared/glsShaderLibraryCase.hpp

index bbc2633..cc8917f 100644 (file)
@@ -231,6 +231,7 @@ LOCAL_SRC_FILES := \
        framework/referencerenderer/rrVertexAttrib.cpp \
        framework/referencerenderer/rrVertexPacket.cpp \
        modules/gles31/functional/es31fAdvancedBlendTests.cpp \
+       modules/gles31/functional/es31fAndroidExtensionPackES31ATests.cpp \
        modules/gles31/functional/es31fAtomicCounterTests.cpp \
        modules/gles31/functional/es31fBasicComputeShaderTests.cpp \
        modules/gles31/functional/es31fBuiltinPrecisionTests.cpp \
diff --git a/data/gles31/shaders/android_extension_pack.test b/data/gles31/shaders/android_extension_pack.test
new file mode 100644 (file)
index 0000000..857adcc
--- /dev/null
@@ -0,0 +1,625 @@
+group extension_macros "Extension macro definitions"
+
+       case android_extension_pack_es31a
+               version 310 es
+               desc "Test GL_ANDROID_extension_pack_es31a macro"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+
+                       void main()
+                       {
+                               out0 = float(GL_ANDROID_extension_pack_es31a);
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+end
+
+group extension_directive "Extension directive"
+
+       case oes_sample_variables
+               version 310 es
+               desc "Test oes_sample_variables extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+
+                       void main()
+                       {
+                               out0 = (gl_SampleID < 0) ? (0.0) : (1.0);
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case oes_shader_image_atomic
+               version 310 es
+               desc "Test oes_shader_image_atomic extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       layout(binding=0, r32i) coherent uniform highp iimage2D u_image;
+
+                       void main()
+                       {
+                               if (imageAtomicXor(u_image, ivec2(0, 0), 1) == 0)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case oes_shader_multisample_interpolation
+               version 310 es
+               desc "Test oes_shader_multisample_interpolation extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       input float in0 = 1.0;
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+                       sample out highp float v_var;
+
+                       void main()
+                       {
+                               v_var = in0;
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       sample in mediump float v_var;
+
+                       void main()
+                       {
+                               out0 = v_var;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case oes_texture_storage_multisample_2d_array
+               version 310 es
+               desc "Test oes_texture_storage_multisample_2d_array extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       uniform mediump sampler2DMSArray u_sampler;
+
+                       void main()
+                       {
+                               if (texelFetch(u_sampler, ivec3(0, 0, 0), 0).r > 0.5)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_geometry_shader
+               version 310 es
+               desc "Test ext_geometry_shader extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       input float in0 = 1.0;
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+                       out highp float geo_in;
+                       void main()
+                       {
+                               geo_in = in0;
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               geometry ""
+                       #version 310 es
+                       ${GEOMETRY_DECLARATIONS}
+                       in lowp float geo_in[];
+                       out mediump float geo_out;
+                       void main()
+                       {
+                               for (int ndx = 0; ndx < gl_in.length(); ++ndx)
+                               {
+                                       geo_out = geo_in[ndx];
+                                       gl_Position = gl_in[ndx].gl_Position;
+                                       EmitVertex();
+                               }
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       in mediump float geo_out;
+                       void main()
+                       {
+                               out0 = geo_out;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_gpu_shader5
+               version 310 es
+               desc "Test ext_gpu_shader5 extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       input float in0 = 1.0;
+                       output float out0 = 2.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+                       out highp float v_var;
+                       void main()
+                       {
+                               v_var = in0;
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       in mediump float v_var;
+                       void main()
+                       {
+                               precise float fmaResult = fma(v_var, v_var, v_var);
+                               out0 = fmaResult;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_primitive_bounding_box
+               version 310 es
+               desc "Test ext_primitive_bounding_box extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       input float in0 = 1.0;
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+                       out highp float tc_in;
+                       void main()
+                       {
+                               tc_in = in0;
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               tessellation_control ""
+                       #version 310 es
+                       ${TESSELLATION_CONTROL_DECLARATIONS}
+                       in highp float tc_in[];
+                       out highp float tc_out[];
+                       void main()
+                       {
+                               tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
+                               // set bounding box to (-1,-1,-1, 1) .. (1,1,1,1)
+                               gl_BoundingBoxEXT[0] = vec4(tc_in[0]-2.0, tc_in[1]-2.0, tc_in[2]-2.0, 1.0);
+                               gl_BoundingBoxEXT[1] = vec4(tc_in[0], tc_in[1], tc_in[2], 1.0);
+                               ${TESSELLATION_CONTROL_OUTPUT}
+                       }
+               ""
+               tessellation_evaluation ""
+                       #version 310 es
+                       ${TESSELLATION_EVALUATION_DECLARATIONS}
+                       in highp float tc_out[];
+                       out highp float te_out;
+                       void main()
+                       {
+                               te_out = tc_out[2];
+                               ${TESSELLATION_EVALUATION_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       in mediump float te_out;
+                       void main()
+                       {
+                               out0 = te_out;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_shader_io_blocks
+               version 310 es
+               desc "Test ext_shader_io_blocks extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       input float in0 = 1.0;
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+                       out VaryingIOBlockName { highp float v_var; } instanceName;
+                       void main()
+                       {
+                               instanceName.v_var = in0;
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       in VaryingIOBlockName { highp float v_var; } instanceName;
+                       void main()
+                       {
+                               out0 = instanceName.v_var;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_tessellation_shader
+               version 310 es
+               desc "Test ext_tessellation_shader extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               values
+               {
+                       input float in0 = 1.0;
+                       output float out0 = 1.0;
+               }
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+                       out highp float tc_in;
+                       void main()
+                       {
+                               tc_in = in0;
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               tessellation_control ""
+                       #version 310 es
+                       ${TESSELLATION_CONTROL_DECLARATIONS}
+                       in highp float tc_in[];
+                       out highp float tc_out[];
+                       void main()
+                       {
+                               tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
+                               ${TESSELLATION_CONTROL_OUTPUT}
+                       }
+               ""
+               tessellation_evaluation ""
+                       #version 310 es
+                       ${TESSELLATION_EVALUATION_DECLARATIONS}
+                       in highp float tc_out[];
+                       out highp float te_out;
+                       void main()
+                       {
+                               te_out = tc_out[2];
+                               ${TESSELLATION_EVALUATION_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       in mediump float te_out;
+                       void main()
+                       {
+                               out0 = te_out;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_texture_buffer
+               version 310 es
+               desc "Test ext_texture_buffer extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       uniform mediump samplerBuffer u_sampler;
+
+                       void main()
+                       {
+                               if (textureSize(u_sampler) > 10)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case ext_texture_cube_map_array
+               version 310 es
+               desc "Test ext_texture_cube_map_array extension"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       uniform mediump samplerCubeArray u_sampler;
+
+                       void main()
+                       {
+                               if (textureSize(u_sampler, 3).y > 10)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+end
+
+group implementation_limits "Extended implementation limits"
+
+       case max_fragment_atomic_counter_buffers
+               version 310 es
+               desc "Test MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS limit"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       layout(binding=0) uniform atomic_uint u_counter;
+
+                       void main()
+                       {
+                               if (atomicCounterIncrement(u_counter) == 0u)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case max_fragment_atomic_counters
+               version 310 es
+               desc "Test MAX_FRAGMENT_ATOMIC_COUNTERS limit"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       layout(binding=0) uniform atomic_uint u_counter[8];
+
+                       void main()
+                       {
+                               if (atomicCounterIncrement(u_counter[0]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[1]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[2]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[3]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[4]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[5]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[6]) == 0u)
+                                       discard;
+                               if (atomicCounterIncrement(u_counter[7]) == 0u)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case max_fragment_image_uniforms
+               version 310 es
+               desc "Test MAX_FRAGMENT_IMAGE_UNIFORMS limit"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       layout(binding=0, r32i) uniform readonly highp iimage2D u_image0;
+                       layout(binding=1, rgba16i) uniform readonly highp iimage3D u_image1;
+                       layout(binding=2, rgba8ui) uniform readonly highp uimageCube u_image2;
+                       layout(binding=3, rgba16f) uniform readonly highp image2DArray u_image3;
+
+                       void main()
+                       {
+                               if (imageLoad(u_image0, ivec2(0, 0)).r == 0)
+                                       discard;
+                               if (imageLoad(u_image1, ivec3(0, 0, 0)).r == 0)
+                                       discard;
+                               if (imageLoad(u_image2, ivec3(0, 0, 0)).r == 0u)
+                                       discard;
+                               if (imageLoad(u_image3, ivec3(0, 0, 0)).r == 0.0)
+                                       discard;
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+
+       case max_fragment_shader_storage_blocks
+               version 310 es
+               desc "Test MAX_FRAGMENT_SHADER_STORAGE_BLOCKS limit"
+               require extension { "GL_ANDROID_extension_pack_es31a" }
+               expect build_successful
+
+               vertex ""
+                       #version 310 es
+                       ${VERTEX_DECLARATIONS}
+
+                       void main()
+                       {
+                               ${VERTEX_OUTPUT}
+                       }
+               ""
+               fragment ""
+                       #version 310 es
+                       precision mediump float;
+                       ${FRAGMENT_DECLARATIONS}
+                       layout(binding=0, std430) coherent readonly buffer Buffer0
+                       {
+                               highp int val;
+                               highp float vals[32];
+                       } buffer0;
+                       layout(binding=1, std140) volatile buffer Buffer1
+                       {
+                               highp float vals[];
+                       } buffer1;
+                       layout(binding=2, packed) restrict buffer Buffer2
+                       {
+                               highp int vals[15];
+                       } buffer2;
+                       layout(binding=3, std140) writeonly buffer Buffer3
+                       {
+                               highp vec3 vals[8];
+                       } buffer3;
+
+                       void main()
+                       {
+                               highp int readNdx = abs(int(gl_FragCoord.x));
+                               highp int writeNdx = abs(int(gl_FragCoord.y));
+
+                               if (buffer0.vals[readNdx % 32] == 0.0)
+                                       discard;
+
+                               if (buffer1.vals[readNdx % 1024] == 0.0)
+                                       discard;
+                               buffer1.vals[writeNdx % 1024] = float(readNdx);
+
+                               if (buffer2.vals[readNdx % 15] == 0)
+                                       discard;
+                               buffer2.vals[writeNdx % 15] = readNdx;
+
+                               buffer3.vals[writeNdx % 8] = vec3(float(writeNdx), 0.0, float(readNdx));
+                               ${FRAGMENT_OUTPUT}
+                       }
+               ""
+       end
+end
diff --git a/doc/testspecs/GLES31/functional.android_extension_pack.txt b/doc/testspecs/GLES31/functional.android_extension_pack.txt
new file mode 100644 (file)
index 0000000..11cfeed
--- /dev/null
@@ -0,0 +1,55 @@
+-------------------------------------------------------------------------
+drawElements Quality Program Test Specification
+-----------------------------------------------
+
+Copyright 2014 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-------------------------------------------------------------------------
+    Android extension pack (ES31A) tests
+
+Tests:
+ + dEQP-GLES31.functional.android_extension_pack.*
+
+Includes:
+ + Implementation limit checks
+ + Checks for required extensions
+ + Shader extension macro test
+ + Shader compilation tests using android extension pack extension
+   directive
+ + Shader compilation tests using extended implementation limits
+
+Excludes:
+
+Description:
+
+android_extension_pack.limits.* group cases check the corresponding
+implementation limit and verify it is larger or equal to the minimum
+required by the extension.
+
+android_extension_pack.extensions.* group cases check that all
+extensions required by android_extension_pack are supported if
+android_extension_pack extension is supported.
+
+android_extension_pack.shaders.extension_macros.* group cases check
+that shader preprocessor macros defined by android_extension_pack
+extension are declared.
+
+android_extension_pack.shaders.extension_directive.* group cases check
+that shader extension directive of an extension required by
+android_extension_pack can be replaced with an android_extension_pack
+extension directive.
+
+android_extension_pack.shaders.implementation_limits.* group cases
+check that shaders using extended implementation limits compile
+successfully.
index 50432cf..f3ca374 100644 (file)
@@ -1,6 +1,8 @@
 # dEQP-GLES31.functional
 
 set(DEQP_GLES31_FUNCTIONAL_SRCS
+       es31fAndroidExtensionPackES31ATests.cpp
+       es31fAndroidExtensionPackES31ATests.hpp
        es31fBasicComputeShaderTests.cpp
        es31fBasicComputeShaderTests.hpp
        es31fBuiltinPrecisionTests.cpp
diff --git a/modules/gles31/functional/es31fAndroidExtensionPackES31ATests.cpp b/modules/gles31/functional/es31fAndroidExtensionPackES31ATests.cpp
new file mode 100644 (file)
index 0000000..6423509
--- /dev/null
@@ -0,0 +1,269 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program OpenGL ES 3.1 Module
+ * -------------------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief ANDROID_extension_pack_es31a tests
+ *//*--------------------------------------------------------------------*/
+
+#include "es31fAndroidExtensionPackES31ATests.hpp"
+#include "glsStateQueryUtil.hpp"
+#include "glsShaderLibrary.hpp"
+#include "tcuTestLog.hpp"
+#include "gluCallLogWrapper.hpp"
+#include "gluContextInfo.hpp"
+#include "gluStrUtil.hpp"
+#include "glwFunctions.hpp"
+#include "glwEnums.hpp"
+#include "deStringUtil.hpp"
+
+namespace deqp
+{
+namespace gles31
+{
+namespace Functional
+{
+namespace
+{
+
+static std::string genExtensionTestName (const char* extensionName)
+{
+       DE_ASSERT(deStringBeginsWith(extensionName, "GL_"));
+       return de::toLower(std::string(extensionName + 3));
+}
+
+class ExtensionPackTestCase : public TestCase
+{
+public:
+                       ExtensionPackTestCase   (Context& context, const char* name, const char* description);
+
+protected:
+       void    init                                    (void);
+};
+
+ExtensionPackTestCase::ExtensionPackTestCase (Context& context, const char* name, const char* description)
+       : TestCase      (context, name, description)
+{
+}
+
+void ExtensionPackTestCase::init (void)
+{
+       if (!m_context.getContextInfo().isExtensionSupported("GL_ANDROID_extension_pack_es31a"))
+               throw tcu::NotSupportedError("Test requires GL_ANDROID_extension_pack_es31a extension");
+}
+
+class ImplementationLimitCase : public ExtensionPackTestCase
+{
+public:
+                                                       ImplementationLimitCase (Context& context, const char* name, const char* description, glw::GLenum target, int limit);
+
+private:
+       IterateResult                   iterate                                 (void);
+
+       const glw::GLenum               m_target;
+       const int                               m_limit;
+};
+
+ImplementationLimitCase::ImplementationLimitCase (Context& context, const char* name, const char* description, glw::GLenum target, int limit)
+       : ExtensionPackTestCase (context, name, description)
+       , m_target                              (target)
+       , m_limit                               (limit)
+{
+}
+
+ImplementationLimitCase::IterateResult ImplementationLimitCase::iterate (void)
+{
+       using namespace gls::StateQueryUtil;
+
+       glu::CallLogWrapper                                             gl              (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
+       StateQueryMemoryWriteGuard<glw::GLint>  result;
+
+       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+       m_testCtx.getLog()
+               << tcu::TestLog::Message
+               << "Querying " << glu::getGettableStateName(m_target) << ", expecting at least " << m_limit
+               << tcu::TestLog::EndMessage;
+
+       gl.enableLogging(true);
+       gl.glGetIntegerv(m_target, &result);
+       GLU_EXPECT_NO_ERROR(gl.glGetError(), "implementation limit query failed");
+
+       if (result.verifyValidity(m_testCtx) && result < m_limit)
+       {
+               m_testCtx.getLog()
+                       << tcu::TestLog::Message
+                       << "// ERROR: Got " << result << ", expected at least " << m_limit
+                       << tcu::TestLog::EndMessage;
+
+               m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Too low implementation limit");
+       }
+
+       return STOP;
+}
+
+class SubExtensionCase : public ExtensionPackTestCase
+{
+public:
+                                               SubExtensionCase        (Context& context, const char* name, const char* description, const char* extension);
+
+private:
+       IterateResult           iterate                         (void);
+
+       const std::string       m_extension;
+};
+
+SubExtensionCase::SubExtensionCase (Context& context, const char* name, const char* description, const char* extension)
+       : ExtensionPackTestCase (context, name, description)
+       , m_extension                   (extension)
+{
+}
+
+SubExtensionCase::IterateResult SubExtensionCase::iterate (void)
+{
+       m_testCtx.getLog()
+               << tcu::TestLog::Message
+               << "Verifying that extension \"" << m_extension << "\" is supported."
+               << tcu::TestLog::EndMessage;
+
+       if (m_context.getContextInfo().isExtensionSupported(m_extension.c_str()))
+       {
+               m_testCtx.getLog()
+                       << tcu::TestLog::Message
+                       << "Extension is supported."
+                       << tcu::TestLog::EndMessage;
+
+               m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+       }
+       else
+       {
+               m_testCtx.getLog()
+                       << tcu::TestLog::Message
+                       << "Error, extension is not supported."
+                       << tcu::TestLog::EndMessage;
+
+               m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Required extension not supported");
+       }
+
+       return STOP;
+}
+
+} //anonymous
+
+AndroidExtensionPackES31ATests::AndroidExtensionPackES31ATests (Context& context)
+       : TestCaseGroup(context, "android_extension_pack", "ANDROID_extension_pack_es31a extension tests")
+{
+}
+
+AndroidExtensionPackES31ATests::~AndroidExtensionPackES31ATests (void)
+{
+}
+
+void AndroidExtensionPackES31ATests::init (void)
+{
+       // .limits
+       {
+               static const struct
+               {
+                       const char*     name;
+                       glw::GLenum     target;
+                       int                     limit;
+               } limits[] =
+               {
+                       {
+                               "max_fragment_atomic_counter_buffers",
+                               GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS,
+                               1
+                       },
+                       {
+                               "max_fragment_atomic_counters",
+                               GL_MAX_FRAGMENT_ATOMIC_COUNTERS,
+                               8
+                       },
+                       {
+                               "max_fragment_image_uniforms",
+                               GL_MAX_FRAGMENT_IMAGE_UNIFORMS,
+                               4
+                       },
+                       {
+                               "max_fragment_shader_storage_blocks",
+                               GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS,
+                               4
+                       },
+               };
+
+               tcu::TestCaseGroup* const group = new tcu::TestCaseGroup(m_testCtx, "limits", "Implementation limits");
+               addChild(group);
+
+               for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(limits); ++ndx)
+                       group->addChild(new ImplementationLimitCase(m_context,
+                                                                                                               limits[ndx].name,
+                                                                                                               (std::string() + "Check " + limits[ndx].name + " is at least " + de::toString(limits[ndx].limit)).c_str(),
+                                                                                                               limits[ndx].target,
+                                                                                                               limits[ndx].limit));
+       }
+
+       // .extensions
+       {
+               static const char* const subExtensions[] =
+               {
+                       "GL_KHR_debug",
+                       "GL_KHR_texture_compression_astc_ldr",
+                       "GL_KHR_blend_equation_advanced",
+                       "GL_OES_sample_shading",
+                       "GL_OES_sample_variables",
+                       "GL_OES_shader_image_atomic",
+                       "GL_OES_shader_multisample_interpolation",
+                       "GL_OES_texture_stencil8",
+                       "GL_OES_texture_storage_multisample_2d_array",
+                       "GL_EXT_copy_image",
+                       "GL_EXT_draw_buffers_indexed",
+                       "GL_EXT_geometry_shader",
+                       "GL_EXT_gpu_shader5",
+                       "GL_EXT_primitive_bounding_box",
+                       "GL_EXT_shader_io_blocks",
+                       "GL_EXT_tessellation_shader",
+                       "GL_EXT_texture_border_clamp",
+                       "GL_EXT_texture_buffer",
+                       "GL_EXT_texture_cube_map_array",
+                       "GL_EXT_texture_sRGB_decode",
+               };
+
+               tcu::TestCaseGroup* const group = new tcu::TestCaseGroup(m_testCtx, "extensions", "Required extensions");
+               addChild(group);
+
+               for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(subExtensions); ++ndx)
+               {
+                       const std::string name                  = genExtensionTestName(subExtensions[ndx]);
+                       const std::string description   = "Check that extension " + name + " is supported if extension pack is supported";
+                       group->addChild(new SubExtensionCase(m_context, name.c_str(), description.c_str(), subExtensions[ndx]));
+               }
+       }
+
+       // .shaders
+       {
+               gls::ShaderLibrary                                      shaderLibrary   (m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
+               const std::vector<tcu::TestNode*>&      children                = shaderLibrary.loadShaderFile("shaders/android_extension_pack.test");
+               tcu::TestCaseGroup* const                       group                   = new tcu::TestCaseGroup(m_testCtx, "shaders", "Shader tests", children);
+
+               addChild(group);
+       }
+}
+
+} // Functional
+} // gles31
+} // deqp
diff --git a/modules/gles31/functional/es31fAndroidExtensionPackES31ATests.hpp b/modules/gles31/functional/es31fAndroidExtensionPackES31ATests.hpp
new file mode 100644 (file)
index 0000000..27feec3
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef _ES31FANDROIDEXTENSIONPACKES31ATESTS_HPP
+#define _ES31FANDROIDEXTENSIONPACKES31ATESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program OpenGL ES 3.1 Module
+ * -------------------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief ANDROID_extension_pack_es31a tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tes31TestCase.hpp"
+
+namespace deqp
+{
+namespace gles31
+{
+namespace Functional
+{
+
+class AndroidExtensionPackES31ATests : public TestCaseGroup
+{
+public:
+                                                                       AndroidExtensionPackES31ATests  (Context& context);
+                                                                       ~AndroidExtensionPackES31ATests (void);
+
+       void                                                    init                                                    (void);
+
+private:
+                                                                       AndroidExtensionPackES31ATests  (const AndroidExtensionPackES31ATests& other);
+       AndroidExtensionPackES31ATests& operator=                                               (const AndroidExtensionPackES31ATests& other);
+};
+
+} // Functional
+} // gles31
+} // deqp
+
+#endif // _ES31FANDROIDEXTENSIONPACKES31ATESTS_HPP
index 474e7ed..214222c 100644 (file)
@@ -76,6 +76,7 @@
 #include "es31fShaderBuiltinConstantTests.hpp"
 #include "es31fShaderHelperInvocationTests.hpp"
 #include "es31fPrimitiveBoundingBoxTests.hpp"
+#include "es31fAndroidExtensionPackES31ATests.hpp"
 
 namespace deqp
 {
@@ -310,6 +311,7 @@ void FunctionalTests::init (void)
        addChild(new ProgramInterfaceQueryTests                         (m_context));
        addChild(new LayoutBindingTests                                         (m_context));
        addChild(new PrimitiveBoundingBoxTests                          (m_context));
+       addChild(new AndroidExtensionPackES31ATests                     (m_context));
 
 }
 
index 3d4d976..a263a44 100644 (file)
@@ -1015,6 +1015,8 @@ void ShaderParser::parseExpectResult (ShaderCase::ExpectResult& expectResult)
                expectResult = ShaderCase::EXPECT_COMPILE_LINK_FAIL;
        else if (m_curTokenStr == "validation_fail")
                expectResult = ShaderCase::EXPECT_VALIDATION_FAIL;
+       else if (m_curTokenStr == "build_successful")
+               expectResult = ShaderCase::EXPECT_BUILD_SUCCESSFUL;
        else
                parseError(string("invalid expected result value: " + m_curTokenStr));
 
index c313058..af30141 100644 (file)
@@ -350,6 +350,12 @@ ShaderCase::ShaderCase (tcu::TestContext& testCtx, RenderContext& renderCtx, con
                DE_ASSERT(specification.geometrySources.empty());
        }
 
+       if (m_expectResult == EXPECT_BUILD_SUCCESSFUL)
+       {
+               // Shader is never executed. Presense of input/output values is likely an error
+               DE_ASSERT(m_valueBlocks.empty());
+       }
+
        // single program object
        {
                ProgramObject program;
@@ -481,6 +487,10 @@ void ShaderCase::init (void)
                        m_testCtx.getLog() << tcu::TestLog::Message << "Expecting program validation to fail." << tcu::TestLog::EndMessage;
                        break;
 
+               case EXPECT_BUILD_SUCCESSFUL:
+                       m_testCtx.getLog() << tcu::TestLog::Message << "Expecting shader compilation and program linking to succeed. Resulting program will not be executed." << tcu::TestLog::EndMessage;
+                       break;
+
                default:
                        DE_ASSERT(false);
                        break;
@@ -715,6 +725,7 @@ bool ShaderCase::execute (void)
        {
                case EXPECT_PASS:
                case EXPECT_VALIDATION_FAIL:
+               case EXPECT_BUILD_SUCCESSFUL:
                        if (!allCompilesOk)
                                failReason = "expected shaders to compile and link properly, but failed to compile.";
                        else if (!allLinksOk)
@@ -758,10 +769,11 @@ bool ShaderCase::execute (void)
                return false;
        }
 
-       // Return if compile/link expected to fail.
+       // Return if shader is not intended to be run
        if (m_expectResult == EXPECT_COMPILE_FAIL               ||
                m_expectResult == EXPECT_COMPILE_LINK_FAIL      ||
-               m_expectResult == EXPECT_LINK_FAIL)
+               m_expectResult == EXPECT_LINK_FAIL                      ||
+               m_expectResult == EXPECT_BUILD_SUCCESSFUL)
                return (failReason == DE_NULL);
 
        // Setup viewport.
index 1057560..8934c98 100644 (file)
@@ -61,6 +61,7 @@ public:
                EXPECT_LINK_FAIL,
                EXPECT_COMPILE_LINK_FAIL,
                EXPECT_VALIDATION_FAIL,
+               EXPECT_BUILD_SUCCESSFUL,
 
                EXPECT_LAST
        };