Add limits_tests implementation
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Wed, 14 Jun 2017 16:12:12 +0000 (18:12 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Sat, 1 Jul 2017 10:31:19 +0000 (06:31 -0400)
This change adds generic limit test class that can
be used to test all types of limits and compare them
to corresponding GLSL builtin.
This change uses this generic limit test to test all
GL45 limits.

Affects: KHR-GL45.limits_tests.*

Components: OpenGL

VK-GL-CTS issue: 42

Change-Id: I2970595377c75e243e72358e24422b4a312e0ad8

external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt
external/openglcts/modules/common/CMakeLists.txt
external/openglcts/modules/common/glcLimitTest.hpp [new file with mode: 0644]
external/openglcts/modules/common/glcLimitTest.inl [new file with mode: 0644]
external/openglcts/modules/gl/CMakeLists.txt
external/openglcts/modules/gl/gl4cLimitsTests.cpp [new file with mode: 0644]
external/openglcts/modules/gl/gl4cLimitsTests.hpp [new file with mode: 0644]
external/openglcts/modules/gl/gl4cTestPackages.cpp

index 10cc83b..149b8f4 100644 (file)
@@ -4799,3 +4799,143 @@ KHR-GL45.shader_draw_parameters_tests.MultiDrawElementIndirectCountParameters
 KHR-GL45.shader_viewport_layer_array.ShaderViewportIndexTestCase
 KHR-GL45.shader_viewport_layer_array.ShaderLayerFramebufferLayeredTestCase
 KHR-GL45.shader_viewport_layer_array.ShaderLayerFramebufferNonLayeredTestCase
+KHR-GL45.limits.max_clip_distances
+KHR-GL45.limits.max_cull_distances
+KHR-GL45.limits.max_combined_clip_and_cull_distances
+KHR-GL45.limits.max_3d_texture_size
+KHR-GL45.limits.max_texture_size
+KHR-GL45.limits.max_array_texture_layers
+KHR-GL45.limits.max_cube_map_texture_size
+KHR-GL45.limits.max_renderbuffer_size
+KHR-GL45.limits.max_viewports
+KHR-GL45.limits.max_elements_indices
+KHR-GL45.limits.max_elements_vertices
+KHR-GL45.limits.max_vertex_attrib_relative_offset
+KHR-GL45.limits.max_vertex_attrib_bindings
+KHR-GL45.limits.max_vertex_attrib_stride
+KHR-GL45.limits.max_texture_buffer_size
+KHR-GL45.limits.max_rectangle_texture_size
+KHR-GL45.limits.min_map_buffer_alignment
+KHR-GL45.limits.max_vertex_attribs
+KHR-GL45.limits.max_vertex_uniform_components
+KHR-GL45.limits.max_vertex_uniform_vectors
+KHR-GL45.limits.max_vertex_uniform_blocks
+KHR-GL45.limits.max_vertex_output_components
+KHR-GL45.limits.max_vertex_texture_image_units
+KHR-GL45.limits.max_vertex_atomic_counter_buffers
+KHR-GL45.limits.max_vertex_atomic_counters
+KHR-GL45.limits.max_vertex_shader_storage_blocks
+KHR-GL45.limits.max_tess_gen_level
+KHR-GL45.limits.max_patch_vertices
+KHR-GL45.limits.max_tess_control_uniform_components
+KHR-GL45.limits.max_tess_control_texture_image_units
+KHR-GL45.limits.max_tess_control_output_components
+KHR-GL45.limits.max_tess_patch_components
+KHR-GL45.limits.max_tess_control_total_output_components
+KHR-GL45.limits.max_tess_control_input_components
+KHR-GL45.limits.max_tess_control_uniform_blocks
+KHR-GL45.limits.max_tess_control_atomic_counter_buffers
+KHR-GL45.limits.max_tess_control_atomic_counters
+KHR-GL45.limits.max_tess_control_shader_storage_blocks
+KHR-GL45.limits.max_tess_evaluation_uniform_components
+KHR-GL45.limits.max_tess_evaluation_texture_image_units
+KHR-GL45.limits.max_tess_evaluation_output_components
+KHR-GL45.limits.max_tess_evaluation_input_components
+KHR-GL45.limits.max_tess_evaluation_uniform_blocks
+KHR-GL45.limits.max_tess_evaluation_atomic_counter_buffers
+KHR-GL45.limits.max_tess_evaluation_atomic_counters
+KHR-GL45.limits.max_tess_evaluation_shader_storage_blocks
+KHR-GL45.limits.max_geometry_uniform_components
+KHR-GL45.limits.max_geometry_uniform_blocks
+KHR-GL45.limits.max_geometry_input_components
+KHR-GL45.limits.max_geometry_output_components
+KHR-GL45.limits.max_geometry_output_vertices
+KHR-GL45.limits.max_geometry_total_output_components
+KHR-GL45.limits.max_geometry_texture_image_units
+KHR-GL45.limits.max_geometry_shader_invocations
+KHR-GL45.limits.max_vertex_streams
+KHR-GL45.limits.max_geometry_atomic_counter_buffers
+KHR-GL45.limits.max_geometry_atomic_counters
+KHR-GL45.limits.max_geometry_shader_storage_blocks
+KHR-GL45.limits.max_fragment_uniform_components
+KHR-GL45.limits.max_fragment_uniform_vectors
+KHR-GL45.limits.max_fragment_uniform_blocks
+KHR-GL45.limits.max_fragment_input_components
+KHR-GL45.limits.max_texture_image_units
+KHR-GL45.limits.min_program_texture_gather_offset
+KHR-GL45.limits.max_program_texture_gather_offset
+KHR-GL45.limits.max_fragment_atomic_counter_buffers
+KHR-GL45.limits.max_fragment_atomic_counters
+KHR-GL45.limits.max_fragment_shader_storage_blocks
+KHR-GL45.limits.max_compute_work_group_invocations
+KHR-GL45.limits.max_compute_uniform_blocks
+KHR-GL45.limits.max_compute_texture_image_units
+KHR-GL45.limits.max_compute_atomic_counter_buffers
+KHR-GL45.limits.max_compute_atomic_counters
+KHR-GL45.limits.max_compute_shared_memory_size
+KHR-GL45.limits.max_compute_uniform_components
+KHR-GL45.limits.max_compute_image_uniforms
+KHR-GL45.limits.max_combined_compute_uniform_components
+KHR-GL45.limits.max_compute_shader_storage_blocks
+KHR-GL45.limits.min_program_texel_offset
+KHR-GL45.limits.max_program_texel_offset
+KHR-GL45.limits.max_uniform_buffer_bindings
+KHR-GL45.limits.max_uniform_block_size
+KHR-GL45.limits.max_combined_uniform_blocks
+KHR-GL45.limits.max_varying_components
+KHR-GL45.limits.max_varying_vectors
+KHR-GL45.limits.max_combined_texture_image_units
+KHR-GL45.limits.max_subroutines
+KHR-GL45.limits.max_subroutine_uniform_locations
+KHR-GL45.limits.max_uniform_locations
+KHR-GL45.limits.max_atomic_counter_buffer_bindings
+KHR-GL45.limits.max_atomic_counter_buffer_size
+KHR-GL45.limits.max_combined_atomic_counter_buffers
+KHR-GL45.limits.max_combined_atomic_counters
+KHR-GL45.limits.max_shader_storage_buffer_bindings
+KHR-GL45.limits.max_combined_shader_storage_blocks
+KHR-GL45.limits.max_image_units
+KHR-GL45.limits.max_combined_shader_output_resources
+KHR-GL45.limits.max_image_samples
+KHR-GL45.limits.max_vertex_image_uniforms
+KHR-GL45.limits.max_tess_control_image_uniforms
+KHR-GL45.limits.max_tess_evaluation_image_uniforms
+KHR-GL45.limits.max_geometry_image_uniforms
+KHR-GL45.limits.max_fragment_image_uniforms
+KHR-GL45.limits.max_combined_image_uniforms
+KHR-GL45.limits.max_combined_vertex_uniform_components
+KHR-GL45.limits.max_combined_geometry_uniform_components
+KHR-GL45.limits.max_combined_tess_control_uniform_components
+KHR-GL45.limits.max_combined_tess_evaluation_uniform_components
+KHR-GL45.limits.max_combined_fragment_uniform_components
+KHR-GL45.limits.max_debug_message_length
+KHR-GL45.limits.max_debug_logged_messages
+KHR-GL45.limits.max_debug_group_stack_depth
+KHR-GL45.limits.max_label_length
+KHR-GL45.limits.max_framebuffer_width
+KHR-GL45.limits.max_framebuffer_height
+KHR-GL45.limits.max_framebuffer_layers
+KHR-GL45.limits.max_framebuffer_samples
+KHR-GL45.limits.max_sample_mask_words
+KHR-GL45.limits.max_samples
+KHR-GL45.limits.max_color_texture_samples
+KHR-GL45.limits.max_depth_texture_samples
+KHR-GL45.limits.max_integer_samples
+KHR-GL45.limits.max_draw_buffers
+KHR-GL45.limits.max_dual_source_draw_buffers
+KHR-GL45.limits.max_color_attachments
+KHR-GL45.limits.max_transform_feedback_interleaved_components
+KHR-GL45.limits.max_transform_feedback_separate_attribs
+KHR-GL45.limits.max_transform_feedback_separate_components
+KHR-GL45.limits.max_transform_feedback_buffers
+KHR-GL45.limits.max_atomic_counter_bindings
+KHR-GL45.limits.max_combined_image_units_and_fragment_outputs
+KHR-GL45.limits.max_geometry_varying_components
+KHR-GL45.limits.max_shader_storage_block_size
+KHR-GL45.limits.max_element_index
+KHR-GL45.limits.max_server_wait_timeout
+KHR-GL45.limits.max_texture_lod_bias
+KHR-GL45.limits.min_fragment_interpolation_offset
+KHR-GL45.limits.max_fragment_interpolation_offset
+KHR-GL45.limits.max_compute_work_group_count
+KHR-GL45.limits.max_compute_work_group_size
index aaf8c6b..a1c7f98 100644 (file)
@@ -68,6 +68,8 @@ set(GLCTS_COMMON_SRCS
        glcTestSubcase.hpp
        glcExtTokens.cpp
        glcExtTokens.hpp
+       glcLimitTest.inl
+       glcLimitTest.hpp
        )
 
 set(GLCTS_COMMON_LIBS
diff --git a/external/openglcts/modules/common/glcLimitTest.hpp b/external/openglcts/modules/common/glcLimitTest.hpp
new file mode 100644 (file)
index 0000000..ef2a059
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef _GLCLIMITTEST_HPP
+#define _GLCLIMITTEST_HPP
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2017 The Khronos Group Inc.
+ *
+ * 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 Limits tests.
+ */ /*-------------------------------------------------------------------*/
+
+#include "glcTestCase.hpp"
+#include "gluDefs.hpp"
+#include "glwDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+#include "tcuCommandLine.hpp"
+#include "tcuTestLog.hpp"
+#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
+
+#include <string>
+
+namespace glcts
+{
+
+template <typename DataType>
+class LimitCase : public deqp::TestCase
+{
+public:
+       LimitCase(deqp::Context& context, const char* caseName, deUint32 limitToken, DataType limitBoundry,
+                         bool isBoundryMaximum, const char* glslVersion = "", const char* glslBuiltin = "",
+                         const char* glslExtension = "");
+       virtual ~LimitCase(void);
+
+       tcu::TestNode::IterateResult iterate(void);
+
+protected:
+       bool isWithinBoundry(DataType value, bool isBuiltin = false) const;
+       std::string createShader() const;
+
+       // those functions require specialization for some data types
+       DataType getLimitValue(const glw::Functions& gl) const;
+       std::string getGLSLDataType() const;
+       bool isEqual(DataType a, DataType b) const;
+       bool isGreater(DataType a, DataType b) const;
+       bool isSmaller(DataType a, DataType b) const;
+
+private:
+       LimitCase(const LimitCase&);                    // not allowed!
+       LimitCase& operator=(const LimitCase&); // not allowed!
+
+       deUint32                  m_limitToken;
+       DataType                  m_limitBoundry; // min/max value
+       bool                      m_isBoundryMaximum;
+       const std::string m_glslVersion;
+       const std::string m_glslBuiltin;
+       const std::string m_glslExtension;
+};
+
+#include "glcLimitTest.inl"
+
+} // glcts
+
+#endif // _GLCLIMITTEST_HPP
diff --git a/external/openglcts/modules/common/glcLimitTest.inl b/external/openglcts/modules/common/glcLimitTest.inl
new file mode 100644 (file)
index 0000000..404c4ba
--- /dev/null
@@ -0,0 +1,323 @@
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2017 The Khronos Group Inc.
+ *
+ * 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 glcLimitTest.cpp
+ * \brief Definition of template class.
+ */ /*-------------------------------------------------------------------*/
+
+using namespace glw;
+
+template<typename DataType>
+LimitCase<DataType>::LimitCase(deqp::Context& context,
+                                                          const char* caseName,
+                                                          deUint32 limitToken,
+                                                          DataType limitBoundry,
+                                                          bool isBoundryMaximum,
+                                                          const char* glslVersion,
+                                                          const char* glslBuiltin,
+                                                          const char* glslExtension)
+       : deqp::TestCase(context, caseName, "Token limit validation.")
+       , m_limitToken(limitToken)
+       , m_limitBoundry(limitBoundry)
+       , m_isBoundryMaximum(isBoundryMaximum)
+       , m_glslVersion(glslVersion)
+       , m_glslBuiltin(glslBuiltin)
+       , m_glslExtension(glslExtension)
+{
+}
+
+template<typename DataType>
+LimitCase<DataType>::~LimitCase(void)
+{
+}
+
+template<typename DataType>
+tcu::TestNode::IterateResult LimitCase<DataType>::iterate(void)
+{
+       DataType limitValue = DataType();
+       const Functions& gl = m_context.getRenderContext().getFunctions();
+
+       // make sure that limit or builtin was specified
+       DE_ASSERT(m_limitToken || !m_glslBuiltin.empty());
+
+       // check if limit was specified
+       if (m_limitToken)
+       {
+               // check if limit is not smaller or greater then boundry defined in specification
+               limitValue = getLimitValue(gl);
+               if (!isWithinBoundry(limitValue))
+               {
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+                       return STOP;
+               }
+
+               // if glsl builtin wasn't defined then test already passed
+               if (m_glslBuiltin.empty())
+               {
+                       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+                       return STOP;
+               }
+       }
+
+       // create compute shader to check glsl builtin
+       std::string shaderSource = createShader();
+       const GLchar* source = shaderSource.c_str();
+       const GLuint program = gl.createProgram();
+       GLuint shader = gl.createShader(GL_COMPUTE_SHADER);
+       gl.attachShader(program, shader);
+       gl.deleteShader(shader);
+       gl.shaderSource(shader, 1, &source, NULL);
+       gl.compileShader(shader);
+       gl.linkProgram(program);
+
+       GLint status;
+       gl.getProgramiv(program, GL_LINK_STATUS, &status);
+       GLint length;
+       gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &length);
+       if (length > 1)
+       {
+               std::vector<GLchar> log(length);
+               gl.getProgramInfoLog(program, length, NULL, &log[0]);
+               m_testCtx.getLog() << tcu::TestLog::Message
+                                                  << &log[0]
+                                                  << tcu::TestLog::EndMessage;
+       }
+       if (status == GL_FALSE)
+       {
+               m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+               return STOP;
+       }
+
+       gl.useProgram(program);
+
+       GLuint buffer;
+       gl.genBuffers(1, &buffer);
+       gl.bindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, buffer);
+       gl.bufferData(GL_SHADER_STORAGE_BUFFER, sizeof(DataType), NULL, GL_DYNAMIC_DRAW);
+       gl.bindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
+
+       gl.dispatchCompute(1, 1, 1);
+
+       gl.bindBuffer(GL_SHADER_STORAGE_BUFFER, buffer);
+       gl.memoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
+       DataType* data = static_cast<DataType*>(gl.mapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(DataType), GL_MAP_READ_BIT));
+       DataType builtinValue = data[0];
+       gl.unmapBuffer(GL_SHADER_STORAGE_BUFFER);
+       gl.bindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
+
+       if (m_limitToken)
+       {
+               // limit token was specified - compare builtin to it
+               if (isEqual(limitValue, builtinValue))
+               {
+                       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+               }
+               else
+               {
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+                       m_testCtx.getLog() << tcu::TestLog::Message
+                                                          << "Shader builtin has value: "
+                                                          << builtinValue
+                                                          << " which is different then the value of corresponding limit: "
+                                                          << limitValue
+                                                          << tcu::TestLog::EndMessage;
+               }
+       }
+       else
+       {
+               // limit token was not specified - compare builtin to the boundry
+               if (isWithinBoundry(builtinValue, true))
+               {
+                       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+               }
+               else
+               {
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+                       m_testCtx.getLog() << tcu::TestLog::Message
+                                                          << "Shader builtin value is: "
+                                                          << builtinValue
+                                                          << " which is outside of specified boundry."
+                                                          << tcu::TestLog::EndMessage;
+               }
+       }
+
+       return STOP;
+}
+
+template<typename DataType>
+bool LimitCase<DataType>::isWithinBoundry(DataType value, bool isBuiltin) const
+{
+       if (m_isBoundryMaximum)
+       {
+               // value should be smaller or euqual to boundry
+               if (isGreater(value, m_limitBoundry))
+               {
+                       m_testCtx.getLog() << tcu::TestLog::Message
+                                                          << (isBuiltin ? "Builtin" : "Limit")
+                                                          << " value is: "
+                                                          << value
+                                                          << " when it should not be greater than "
+                                                          << m_limitBoundry
+                                                          << tcu::TestLog::EndMessage;
+                       return false;
+               }
+       }
+       else
+       {
+               // value should be greater or euqual to boundry
+               if (isSmaller(value, m_limitBoundry))
+               {
+                       m_testCtx.getLog() << tcu::TestLog::Message
+                                                          << (isBuiltin ? "Builtin" : "Limit")
+                                                          << " value is: "
+                                                          << value
+                                                          << "when it should not be smaller than "
+                                                          << m_limitBoundry
+                                                          << tcu::TestLog::EndMessage;
+                       return false;
+               }
+       }
+
+       return true;
+}
+
+template<typename DataType>
+std::string LimitCase<DataType>::createShader() const
+{
+               std::stringstream shader;
+               shader << "#version " << m_glslVersion << "\n";
+               if (!m_glslExtension.empty())
+                       shader << "#extension " + m_glslExtension + " : require\n";
+               shader << "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n"
+                                 "layout(std430) buffer Output {\n"
+                          << getGLSLDataType() <<" data; } g_out;"
+                                 "void main() { "
+                                 "g_out.data = " << m_glslBuiltin << "; }";
+               return shader.str();
+}
+
+template<typename DataType>
+std::string LimitCase<DataType>::getGLSLDataType() const
+{
+       return "int";
+}
+
+template<>
+std::string LimitCase<GLfloat>::getGLSLDataType() const
+{
+       return "float";
+}
+
+template<>
+std::string LimitCase<tcu::IVec3>::getGLSLDataType() const
+{
+       return "ivec3";
+}
+
+template<typename DataType>
+bool LimitCase<DataType>::isEqual(DataType a, DataType b) const
+{
+       return a == b;
+}
+
+template<>
+bool LimitCase<tcu::IVec3>::isEqual(tcu::IVec3 a, tcu::IVec3 b) const
+{
+       tcu::BVec3 bVec = tcu::equal(a, b);
+       return tcu::boolAll(bVec);
+}
+
+template<typename DataType>
+bool LimitCase<DataType>::isGreater(DataType a, DataType b) const
+{
+       return a > b;
+}
+
+template<>
+bool LimitCase<tcu::IVec3>::isGreater(tcu::IVec3 a, tcu::IVec3 b) const
+{
+       tcu::BVec3 bVec = tcu::greaterThan(a, b);
+       return tcu::boolAll(bVec);
+}
+
+template<typename DataType>
+bool LimitCase<DataType>::isSmaller(DataType a, DataType b) const
+{
+       return a < b;
+}
+
+template<>
+bool LimitCase<tcu::IVec3>::isSmaller(tcu::IVec3 a, tcu::IVec3 b) const
+{
+       tcu::BVec3 bVec = tcu::lessThan(a, b);
+       return tcu::boolAll(bVec);
+}
+
+template<typename DataType>
+DataType LimitCase<DataType>::getLimitValue(const Functions&) const
+{
+       return DataType();
+}
+
+template<>
+GLint LimitCase<GLint>::getLimitValue(const Functions& gl) const
+{
+       GLint value = -1;
+       gl.getIntegerv(m_limitToken, &value);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv");
+       return value;
+}
+
+template<>
+GLint64 LimitCase<GLint64>::getLimitValue(const Functions& gl) const
+{
+       GLint64 value = -1;
+       gl.getInteger64v(m_limitToken, &value);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "glGetInteger64v");
+       return value;
+}
+
+template<>
+GLuint64 LimitCase<GLuint64>::getLimitValue(const Functions& gl) const
+{
+       GLint64 value = -1;
+       gl.getInteger64v(m_limitToken, &value);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "glGetInteger64v");
+       return static_cast<GLuint64>(value);
+}
+
+template<>
+GLfloat LimitCase<GLfloat>::getLimitValue(const Functions& gl) const
+{
+       GLfloat value = -1;
+       gl.getFloatv(m_limitToken, &value);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "glGetFloatv");
+       return value;
+}
+
+template<>
+tcu::IVec3 LimitCase<tcu::IVec3>::getLimitValue(const Functions& gl) const
+{
+       tcu::IVec3 value(-1);
+       for (int i = 0; i < 3; i++)
+               gl.getIntegeri_v(m_limitToken, (GLuint)i, &value[i]);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegeri_v");
+       return value;
+}
+
index 933d6a0..b805fe3 100644 (file)
@@ -124,6 +124,8 @@ set(GLCTS_GL_SRCS
        gl4cPostDepthCoverageTests.hpp
        gl4cIndirectParametersTests.cpp
        gl4cIndirectParametersTests.hpp
+       gl4cLimitsTests.cpp
+       gl4cLimitsTests.hpp
        )
 
 set(GLCTS_GL_LIBS
diff --git a/external/openglcts/modules/gl/gl4cLimitsTests.cpp b/external/openglcts/modules/gl/gl4cLimitsTests.cpp
new file mode 100644 (file)
index 0000000..49e11af
--- /dev/null
@@ -0,0 +1,266 @@
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2017 The Khronos Group Inc.
+ *
+ * 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 gl4cLimitsTests.cpp
+ * \brief Verifies all limits
+ */ /*-------------------------------------------------------------------*/
+
+#include "gl4cLimitsTests.hpp"
+#include "glcLimitTest.hpp"
+
+using namespace glw;
+
+namespace gl4cts
+{
+
+template <typename Type>
+struct Limit
+{
+       const char* name;
+       deUint32        token;
+       Type            boundry;
+       bool            isMaximum; // when true boundry is maximal acceptable value
+       const char* builtin;
+};
+
+/** Constructor.
+ *
+ *  @param context Rendering context.
+ **/
+LimitsTests::LimitsTests(deqp::Context& context) : TestCaseGroup(context, "limits", "Verifies all limits")
+{
+}
+
+void LimitsTests::init(void)
+{
+       const GLint     minVertexUniformBlocks          = 14;
+       const GLint     minVertexUniformComponents      = 1024;
+
+       const GLint     minGeometryUniformBlocks                = 14;
+       const GLint     minGeometryUniformComponents    = 1024;
+
+       const GLint     minTessControlUniformBlocks             = 14;
+       const GLint     minTessControlUniformComponents = 1024;
+
+       const GLint     minTessEvaluationUniformBlocks          = 14;
+       const GLint     minTessEvaluationUniformComponents      = 1024;
+
+       const GLint     minFragmentUniformBlocks                = 14;
+       const GLint     minFragmentUniformComponents    = 1024;
+
+       const GLint     minUniformBlockSize     = 16384;
+
+       const GLint     cvuc  = (minVertexUniformBlocks*minUniformBlockSize)/4 + minVertexUniformComponents;
+       const GLint     cguc  = (minGeometryUniformBlocks*minUniformBlockSize)/4 + minGeometryUniformComponents;
+       const GLint     ctcuc = (minTessControlUniformBlocks*minUniformBlockSize)/4 + minTessControlUniformComponents;
+       const GLint     cteuc = (minTessEvaluationUniformBlocks*minUniformBlockSize)/4 + minTessEvaluationUniformComponents;
+       const GLint     cfuc  = (minFragmentUniformBlocks*minUniformBlockSize)/4 + minFragmentUniformComponents;
+
+       static const Limit<GLint> intLimits[] =
+       {
+               { "max_clip_distances",                                                          GL_MAX_CLIP_DISTANCES,                                                          8,             0, "gl_MaxClipDistances" },
+               { "max_cull_distances",                                                          GL_MAX_CULL_DISTANCES,                                                          8,             0, "gl_MaxCullDistances" },
+               { "max_combined_clip_and_cull_distances",                        GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES,                        8,             0, "gl_MaxCombinedClipAndCullDistances" },
+               { "max_3d_texture_size",                                                         GL_MAX_3D_TEXTURE_SIZE,                                                         2048,  0, "" },
+               { "max_texture_size",                                                            GL_MAX_TEXTURE_SIZE,                                                            16384, 0, "" },
+               { "max_array_texture_layers",                                            GL_MAX_ARRAY_TEXTURE_LAYERS,                                            2048,  0, "" },
+               { "max_cube_map_texture_size",                                           GL_MAX_CUBE_MAP_TEXTURE_SIZE,                                           16384, 0, "" },
+               { "max_renderbuffer_size",                                                       GL_MAX_RENDERBUFFER_SIZE,                                                       16384, 0, "" },
+               { "max_viewports",                                                                       GL_MAX_VIEWPORTS,                                                                       16,    0, "gl_MaxViewports" },
+               { "max_elements_indices",                                                        GL_MAX_ELEMENTS_INDICES,                                                        0,             0, "" }, // there is no minimum
+               { "max_elements_vertices",                                                       GL_MAX_ELEMENTS_VERTICES,                                                       0,             0, "" },
+               { "max_vertex_attrib_relative_offset",                           GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET,                           2047,  0, "" },
+               { "max_vertex_attrib_bindings",                                          GL_MAX_VERTEX_ATTRIB_BINDINGS,                                          16,    0, "" },
+               { "max_vertex_attrib_stride",                                            GL_MAX_VERTEX_ATTRIB_STRIDE,                                            2048,  0, "" },
+               { "max_texture_buffer_size",                                             GL_MAX_TEXTURE_BUFFER_SIZE,                                             65536, 0, "" },
+               { "max_rectangle_texture_size",                                          GL_MAX_RECTANGLE_TEXTURE_SIZE,                                          16384, 0, "" },
+               { "min_map_buffer_alignment",                                            GL_MIN_MAP_BUFFER_ALIGNMENT,                                            64,    1, "" },
+               { "max_vertex_attribs",                                                          GL_MAX_VERTEX_ATTRIBS,                                                          16,    0, "gl_MaxVertexAttribs" },
+               { "max_vertex_uniform_components",                                       GL_MAX_VERTEX_UNIFORM_COMPONENTS,                                       1024,  0, "gl_MaxVertexUniformComponents" },
+               { "max_vertex_uniform_vectors",                                          GL_MAX_VERTEX_UNIFORM_VECTORS,                                          256,   0, "gl_MaxVertexUniformVectors" },
+               { "max_vertex_uniform_blocks",                                           GL_MAX_VERTEX_UNIFORM_BLOCKS,                                           14,    0, "" },
+               { "max_vertex_output_components",                                        GL_MAX_VERTEX_OUTPUT_COMPONENTS,                                        64,    0, "gl_MaxVertexOutputComponents" },
+               { "max_vertex_texture_image_units",                                      GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,                                      16,    0, "gl_MaxVertexTextureImageUnits" },
+               { "max_vertex_atomic_counter_buffers",                           GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS,                           0,             0, "gl_MaxVertexAtomicCounterBuffers" },
+               { "max_vertex_atomic_counters",                                          GL_MAX_VERTEX_ATOMIC_COUNTERS,                                          0,             0, "gl_MaxVertexAtomicCounters" },
+               { "max_vertex_shader_storage_blocks",                            GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS,                            0,             0, "" },
+               { "max_tess_gen_level",                                                          GL_MAX_TESS_GEN_LEVEL,                                                          64,    0, "gl_MaxTessGenLevel" },
+               { "max_patch_vertices",                                                          GL_MAX_PATCH_VERTICES,                                                          32,    0, "gl_MaxPatchVertices" },
+               { "max_tess_control_uniform_components",                         GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS,                         1024,  0, "gl_MaxTessControlUniformComponents" },
+               { "max_tess_control_texture_image_units",                        GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS,                        16,    0, "gl_MaxTessControlTextureImageUnits" },
+               { "max_tess_control_output_components",                          GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS,                          128,   0, "gl_MaxTessControlOutputComponents" },
+               { "max_tess_patch_components",                                           GL_MAX_TESS_PATCH_COMPONENTS,                                           120,   0, "gl_MaxTessPatchComponents" },
+               { "max_tess_control_total_output_components",            GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS,            4096,  0, "gl_MaxTessControlTotalOutputComponents" },
+               { "max_tess_control_input_components",                           GL_MAX_TESS_CONTROL_INPUT_COMPONENTS,                           128,   0, "gl_MaxTessControlInputComponents" },
+               { "max_tess_control_uniform_blocks",                             GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS,                             14,    0, "" },
+               { "max_tess_control_atomic_counter_buffers",             GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS,             0,             0, "gl_MaxTessControlAtomicCounterBuffers" },
+               { "max_tess_control_atomic_counters",                            GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS,                            0,             0, "gl_MaxTessControlAtomicCounters" },
+               { "max_tess_control_shader_storage_blocks",                      GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS,                      0,             0, "" },
+               { "max_tess_evaluation_uniform_components",                      GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS,                      1024,  0, "gl_MaxTessEvaluationUniformComponents" },
+               { "max_tess_evaluation_texture_image_units",             GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS,             16,    0, "gl_MaxTessEvaluationTextureImageUnits" },
+               { "max_tess_evaluation_output_components",                       GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS,                       128,   0, "gl_MaxTessEvaluationOutputComponents" },
+               { "max_tess_evaluation_input_components",                        GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS,                        128,   0, "gl_MaxTessEvaluationInputComponents" },
+               { "max_tess_evaluation_uniform_blocks",                          GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS,                          14,    0, "" },
+               { "max_tess_evaluation_atomic_counter_buffers",          GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS,          0,             0, "gl_MaxTessEvaluationAtomicCounterBuffers" },
+               { "max_tess_evaluation_atomic_counters",                         GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS,                         0,             0, "gl_MaxTessEvaluationAtomicCounters" },
+               { "max_tess_evaluation_shader_storage_blocks",           GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS,           0,             0, "" },
+               { "max_geometry_uniform_components",                             GL_MAX_GEOMETRY_UNIFORM_COMPONENTS,                             1024,  0, "gl_MaxGeometryUniformComponents" },
+               { "max_geometry_uniform_blocks",                                         GL_MAX_GEOMETRY_UNIFORM_BLOCKS,                                         14,    0, "" },
+               { "max_geometry_input_components",                                       GL_MAX_GEOMETRY_INPUT_COMPONENTS,                                       64,    0, "gl_MaxGeometryInputComponents" },
+               { "max_geometry_output_components",                                      GL_MAX_GEOMETRY_OUTPUT_COMPONENTS,                                      128,   0, "gl_MaxGeometryOutputComponents" },
+               { "max_geometry_output_vertices",                                        GL_MAX_GEOMETRY_OUTPUT_VERTICES,                                        256,   0, "gl_MaxGeometryOutputVertices" },
+               { "max_geometry_total_output_components",                        GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS,                        1024,  0, "gl_MaxGeometryTotalOutputComponents" },
+               { "max_geometry_texture_image_units",                            GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS,                            16,    0, "gl_MaxGeometryTextureImageUnits" },
+               { "max_geometry_shader_invocations",                             GL_MAX_GEOMETRY_SHADER_INVOCATIONS,                             32,    0, "" },
+               { "max_vertex_streams",                                                          GL_MAX_VERTEX_STREAMS,                                                          4,             0, "" },
+               { "max_geometry_atomic_counter_buffers",                         GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS,                         0,             0, "gl_MaxGeometryAtomicCounterBuffers" },
+               { "max_geometry_atomic_counters",                                        GL_MAX_GEOMETRY_ATOMIC_COUNTERS,                                        0,             0, "gl_MaxGeometryAtomicCounters" },
+               { "max_geometry_shader_storage_blocks",                          GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS,                          0,             0, "" },
+               { "max_fragment_uniform_components",                             GL_MAX_FRAGMENT_UNIFORM_COMPONENTS,                             1024,  0, "gl_MaxFragmentUniformComponents" },
+               { "max_fragment_uniform_vectors",                                        GL_MAX_FRAGMENT_UNIFORM_VECTORS,                                        256,   0, "gl_MaxFragmentUniformVectors" },
+               { "max_fragment_uniform_blocks",                                         GL_MAX_FRAGMENT_UNIFORM_BLOCKS,                                         14,    0, "" },
+               { "max_fragment_input_components",                                       GL_MAX_FRAGMENT_INPUT_COMPONENTS,                                       128,   0, "gl_MaxFragmentInputComponents" },
+               { "max_texture_image_units",                                             GL_MAX_TEXTURE_IMAGE_UNITS,                                             16,    0, "gl_MaxTextureImageUnits" },
+               { "min_program_texture_gather_offset",                           GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET,                          -8,             1, "" },
+               { "max_program_texture_gather_offset",                           GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET,                           7,             0, "" },
+               { "max_fragment_atomic_counter_buffers",                         GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS,                         1,             0, "gl_MaxFragmentAtomicCounterBuffers" },
+               { "max_fragment_atomic_counters",                                        GL_MAX_FRAGMENT_ATOMIC_COUNTERS,                                        8,             0, "gl_MaxFragmentAtomicCounters" },
+               { "max_fragment_shader_storage_blocks",                          GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS,                          8,             0, "" },
+               { "max_compute_work_group_invocations",                          GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS,                          1024,  0, "" },
+               { "max_compute_uniform_blocks",                                          GL_MAX_COMPUTE_UNIFORM_BLOCKS,                                          14,    0, "" },
+               { "max_compute_texture_image_units",                             GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS,                             16,    0, "gl_MaxComputeTextureImageUnits" },
+               { "max_compute_atomic_counter_buffers",                          GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS,                          8,             0, "gl_MaxComputeAtomicCounterBuffers" },
+               { "max_compute_atomic_counters",                                         GL_MAX_COMPUTE_ATOMIC_COUNTERS,                                         8,             0, "gl_MaxComputeAtomicCounters" },
+               { "max_compute_shared_memory_size",                                      GL_MAX_COMPUTE_SHARED_MEMORY_SIZE,                                      32768, 0, "" },
+               { "max_compute_uniform_components",                                      GL_MAX_COMPUTE_UNIFORM_COMPONENTS,                                      1024,  0, "gl_MaxComputeUniformComponents" },
+               { "max_compute_image_uniforms",                                          GL_MAX_COMPUTE_IMAGE_UNIFORMS,                                          8,             0, "gl_MaxComputeImageUniforms" },
+               { "max_combined_compute_uniform_components",             GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS,             0,             0, "" }, // minimum was not specified
+               { "max_compute_shader_storage_blocks",                           GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS,                           8,             0, "" },
+               { "min_program_texel_offset",                                            GL_MIN_PROGRAM_TEXEL_OFFSET,                                           -8,             1, "gl_MinProgramTexelOffset" },
+               { "max_program_texel_offset",                                            GL_MAX_PROGRAM_TEXEL_OFFSET,                                            7,             0, "gl_MaxProgramTexelOffset" },
+               { "max_uniform_buffer_bindings",                                         GL_MAX_UNIFORM_BUFFER_BINDINGS,                                         84,    0, "" },
+               { "max_uniform_block_size",                                                      GL_MAX_UNIFORM_BLOCK_SIZE,                                                      16384, 0, "" },
+               { "max_combined_uniform_blocks",                                         GL_MAX_COMBINED_UNIFORM_BLOCKS,                                         70,    0, "" },
+               { "max_varying_components",                                                      GL_MAX_VARYING_COMPONENTS,                                                      60,    0, "gl_MaxVaryingComponents" },
+               { "max_varying_vectors",                                                         GL_MAX_VARYING_VECTORS,                                                         15,    0, "gl_MaxVaryingVectors" },
+               { "max_combined_texture_image_units",                            GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,                            80,    0, "gl_MaxCombinedTextureImageUnits" },
+               { "max_subroutines",                                                             GL_MAX_SUBROUTINES,                                                             256,   0, "" },
+               { "max_subroutine_uniform_locations",                            GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS,                            1024,  0, "" },
+               { "max_uniform_locations",                                                       GL_MAX_UNIFORM_LOCATIONS,                                                       1024,  0, "" },
+               { "max_atomic_counter_buffer_bindings",                          GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS,                          1,             0, "" },
+               { "max_atomic_counter_buffer_size",                                      GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE,                                      32,    0, "gl_MaxAtomicCounterBufferSize" },
+               { "max_combined_atomic_counter_buffers",                         GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS,                         1,             0, "gl_MaxCombinedAtomicCounterBuffers" },
+               { "max_combined_atomic_counters",                                        GL_MAX_COMBINED_ATOMIC_COUNTERS,                                        8,             0, "gl_MaxCombinedAtomicCounters" },
+               { "max_shader_storage_buffer_bindings",                          GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS,                          8,             0, "" },
+               { "max_combined_shader_storage_blocks",                          GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS,                          8,             0, "" },
+               { "max_image_units",                                                             GL_MAX_IMAGE_UNITS,                                                             8,             0, "gl_MaxImageUnits" },
+               { "max_combined_shader_output_resources",                        GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES,                        8,             0, "gl_MaxCombinedShaderOutputResources" },
+               { "max_image_samples",                                                           GL_MAX_IMAGE_SAMPLES,                                                           0,             0, "gl_MaxImageSamples" },
+               { "max_vertex_image_uniforms",                                           GL_MAX_VERTEX_IMAGE_UNIFORMS,                                           0,             0, "gl_MaxVertexImageUniforms" },
+               { "max_tess_control_image_uniforms",                             GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS,                             0,             0, "gl_MaxTessControlImageUniforms" },
+               { "max_tess_evaluation_image_uniforms",                          GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS,                          0,             0, "gl_MaxTessEvaluationImageUniforms" },
+               { "max_geometry_image_uniforms",                                         GL_MAX_GEOMETRY_IMAGE_UNIFORMS,                                         0,             0, "gl_MaxGeometryImageUniforms" },
+               { "max_fragment_image_uniforms",                                         GL_MAX_FRAGMENT_IMAGE_UNIFORMS,                                         8,             0, "gl_MaxFragmentImageUniforms" },
+               { "max_combined_image_uniforms",                                         GL_MAX_COMBINED_IMAGE_UNIFORMS,                                         8,             0, "gl_MaxCombinedImageUniforms" },
+               { "max_combined_vertex_uniform_components",                      GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS,                      cvuc,  0, "" },
+               { "max_combined_geometry_uniform_components",            GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS,            cguc,  0, "" },
+               { "max_combined_tess_control_uniform_components",        GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS,        ctcuc, 0, "" },
+               { "max_combined_tess_evaluation_uniform_components", GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS, cteuc, 0, "" },
+               { "max_combined_fragment_uniform_components",            GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,            cfuc,  0, "" },
+               { "max_debug_message_length",                                            GL_MAX_DEBUG_MESSAGE_LENGTH,                                            1,             0, "" },
+               { "max_debug_logged_messages",                                           GL_MAX_DEBUG_LOGGED_MESSAGES,                                           1,             0, "" },
+               { "max_debug_group_stack_depth",                                         GL_MAX_DEBUG_GROUP_STACK_DEPTH,                                         64,    0, "" },
+               { "max_label_length",                                                            GL_MAX_LABEL_LENGTH,                                                            256,   0, "" },
+               { "max_framebuffer_width",                                                       GL_MAX_FRAMEBUFFER_WIDTH,                                                       16384, 0, "" },
+               { "max_framebuffer_height",                                                      GL_MAX_FRAMEBUFFER_HEIGHT,                                                      16384, 0, "" },
+               { "max_framebuffer_layers",                                                      GL_MAX_FRAMEBUFFER_LAYERS,                                                      2048,  0, "" },
+               { "max_framebuffer_samples",                                             GL_MAX_FRAMEBUFFER_SAMPLES,                                             4,             0, "" },
+               { "max_sample_mask_words",                                                       GL_MAX_SAMPLE_MASK_WORDS,                                                       1,             0, "" },
+               { "max_samples",                                                                         GL_MAX_SAMPLES,                                                                         4,             0, "gl_MaxSamples" },
+               { "max_color_texture_samples",                                           GL_MAX_COLOR_TEXTURE_SAMPLES,                                           1,             0, "" },
+               { "max_depth_texture_samples",                                           GL_MAX_DEPTH_TEXTURE_SAMPLES,                                           1,             0, "" },
+               { "max_integer_samples",                                                         GL_MAX_INTEGER_SAMPLES,                                                         1,             0, "" },
+               { "max_draw_buffers",                                                            GL_MAX_DRAW_BUFFERS,                                                            8,             0, "gl_MaxDrawBuffers" },
+               { "max_dual_source_draw_buffers",                                        GL_MAX_DUAL_SOURCE_DRAW_BUFFERS,                                        1,             0, "" },
+               { "max_color_attachments",                                                       GL_MAX_COLOR_ATTACHMENTS,                                                       8,             0, "" },
+               { "max_transform_feedback_interleaved_components",   GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,   64,    0, "gl_MaxTransformFeedbackInterleavedComponents" },
+               { "max_transform_feedback_separate_attribs",             GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,             4,             0, "" },
+               { "max_transform_feedback_separate_components",          GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS,          4,             0, "" },
+               { "max_transform_feedback_buffers",                                      GL_MAX_TRANSFORM_FEEDBACK_BUFFERS,                                      4,             0, "gl_MaxTransformFeedbackBuffers" },
+               { "max_atomic_counter_bindings",                                         GL_NONE,                                                                                        4,             0, "gl_MaxAtomicCounterBindings" },
+               { "max_combined_image_units_and_fragment_outputs",       GL_NONE,                                                                                        4,             0, "gl_MaxCombinedImageUnitsAndFragmentOutputs" },
+               { "max_geometry_varying_components",                             GL_NONE,                                                                                        4,             0, "gl_MaxGeometryVaryingComponents" }
+       };
+
+       static const Limit<GLint64> int64Limits[] =
+       {
+               { "max_shader_storage_block_size",                                       GL_MAX_SHADER_STORAGE_BLOCK_SIZE,                                       134217728,             0, "" },
+               { "max_element_index",                                                           GL_MAX_ELEMENT_INDEX,                                                           4294967295LL,  0, "" },
+       };
+
+       static const Limit<GLuint64> uint64Limits[] =
+       {
+               { "max_server_wait_timeout",                                             GL_MAX_SERVER_WAIT_TIMEOUT,                                             0,                             0, "" },
+       };
+
+       static const Limit<GLfloat> floatLimits[] =
+       {
+               { "max_texture_lod_bias",                                                        GL_MAX_TEXTURE_LOD_BIAS,                                                        2.0,   0, "" },
+               { "min_fragment_interpolation_offset",                           GL_MIN_FRAGMENT_INTERPOLATION_OFFSET,                          -0.5,   1, "" },
+               { "max_fragment_interpolation_offset",                           GL_MAX_FRAGMENT_INTERPOLATION_OFFSET,                           0.5,   0, "" },
+       };
+
+       static const Limit<tcu::IVec3> ivec3Limits[] =
+       {
+               { "max_compute_work_group_count",                                        GL_MAX_COMPUTE_WORK_GROUP_COUNT,        tcu::IVec3(65535,65535,65535),  0, "gl_MaxComputeWorkGroupCount" },
+               { "max_compute_work_group_size",                                         GL_MAX_COMPUTE_WORK_GROUP_SIZE,         tcu::IVec3(1024, 1024, 64),     0, "gl_MaxComputeWorkGroupSize" },
+};
+
+       for (int idx = 0; idx < DE_LENGTH_OF_ARRAY(intLimits); idx++)
+       {
+               const Limit<GLint>& limit = intLimits[idx];
+               addChild(new glcts::LimitCase<GLint>(m_context, limit.name, limit.token, limit.boundry, limit.isMaximum, "450", limit.builtin ));
+       }
+
+       for (int idx = 0; idx < DE_LENGTH_OF_ARRAY(int64Limits); idx++)
+       {
+               const Limit<GLint64>& limit = int64Limits[idx];
+               addChild(new glcts::LimitCase<GLint64>(m_context, limit.name, limit.token, limit.boundry, limit.isMaximum, "450", limit.builtin ));
+       }
+
+       for (int idx = 0; idx < DE_LENGTH_OF_ARRAY(uint64Limits); idx++)
+       {
+               const Limit<GLuint64>& limit = uint64Limits[idx];
+               addChild(new glcts::LimitCase<GLuint64>(m_context, limit.name, limit.token, limit.boundry, limit.isMaximum, "450", limit.builtin ));
+       }
+
+       for (int idx = 0; idx < DE_LENGTH_OF_ARRAY(floatLimits); idx++)
+       {
+               const Limit<GLfloat>& limit = floatLimits[idx];
+               addChild(new glcts::LimitCase<GLfloat>(m_context, limit.name, limit.token, limit.boundry, limit.isMaximum, "450", limit.builtin ));
+       }
+
+       for (int idx = 0; idx < DE_LENGTH_OF_ARRAY(ivec3Limits); idx++)
+       {
+               const Limit<tcu::IVec3>& limit = ivec3Limits[idx];
+               addChild(new glcts::LimitCase<tcu::IVec3>(m_context, limit.name, limit.token, limit.boundry, limit.isMaximum, "450", limit.builtin ));
+       }
+}
+
+} /* glcts namespace */
diff --git a/external/openglcts/modules/gl/gl4cLimitsTests.hpp b/external/openglcts/modules/gl/gl4cLimitsTests.hpp
new file mode 100644 (file)
index 0000000..f2b1195
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef _GL4CLIMITSTESTS_HPP
+#define _GL4CLIMITSTESTS_HPP
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2017 The Khronos Group Inc.
+ *
+ * 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  gl4cLimitsTests.hpp
+ * \brief Declares test classes for testing all limits and builtins.
+ */ /*-------------------------------------------------------------------*/
+
+#include "glcTestCase.hpp"
+
+namespace gl4cts
+{
+
+class LimitsTests : public deqp::TestCaseGroup
+{
+public:
+       /* Public methods */
+       LimitsTests(deqp::Context& context);
+       virtual ~LimitsTests()
+       {
+       }
+
+       virtual void init(void);
+
+private:
+       /* Private methods */
+       LimitsTests(const LimitsTests&);
+       LimitsTests& operator=(const LimitsTests&);
+};
+
+} /* gl4cts namespace */
+
+#endif // _GL4CLIMITSTESTS_HPP
index 96ad0c7..921ea88 100644 (file)
@@ -38,6 +38,7 @@
 #include "gl4cIncompleteTextureAccessTests.hpp"
 #include "gl4cIndirectParametersTests.hpp"
 #include "gl4cKHRDebugTests.hpp"
+#include "gl4cLimitsTests.hpp"
 #include "gl4cMapBufferAlignmentTests.hpp"
 #include "gl4cMultiBindTests.hpp"
 #include "gl4cParallelShaderCompileTests.hpp"
@@ -362,6 +363,7 @@ void GL45TestPackage::init(void)
                addChild(new gl4cts::ShaderGroupVote(getContext()));
                addChild(new gl4cts::ShaderDrawParametersTests(getContext()));
                addChild(new gl4cts::ShaderViewportLayerArray(getContext()));
+               addChild(new gl4cts::LimitsTests(getContext()));
        }
        catch (...)
        {