1 #ifndef _GL4CES31COMPATIBILITYTESTS_HPP 2 #define _GL4CES31COMPATIBILITYTESTS_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2015-2016 The Khronos Group Inc. 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 */ /*! 22 * \file 23 * \brief 24 */ /*-------------------------------------------------------------------*/ 25 26 /** 27 */ /*! 28 * \file gl4cES31CompatibilityTests.hpp 29 * \brief Conformance tests for ES3.1 Compatibility feature functionality. 30 */ /*------------------------------------------------------------------------------*/ 31 32 /* Includes. */ 33 34 #include "glcTestCase.hpp" 35 #include "glcTestSubcase.hpp" 36 #include "gluShaderUtil.hpp" 37 #include "glwDefs.hpp" 38 #include "tcuDefs.hpp" 39 40 #include "glwEnums.hpp" 41 #include "glwFunctions.hpp" 42 43 /* Interface. */ 44 45 namespace gl4cts 46 { 47 namespace es31compatibility 48 { 49 /** @class Tests 50 * 51 * @brief OpenGL ES 3.1 Compatibility Tests Suite. 52 */ 53 class Tests : public deqp::TestCaseGroup 54 { 55 public: 56 /* Public member functions. */ 57 Tests(deqp::Context& context); 58 59 void init(); 60 61 private: 62 /* Private member functions. */ 63 Tests(const Tests& other); 64 Tests& operator=(const Tests& other); 65 }; 66 67 /* Tests class */ 68 69 /** @class ShaderCompilationCompatibilityTests 70 * 71 * @brief Test verifies that vertex, fragment and compute shaders 72 * containing line "#version 310 es" compile without 73 * error. 74 * 75 * Test verifies that fragment shader using gl_HelperInvocation 76 * variable compiles without errors. 77 */ 78 class ShaderCompilationCompatibilityTests : public deqp::TestCase 79 { 80 public: 81 /* Public member functions. */ 82 ShaderCompilationCompatibilityTests(deqp::Context& context); 83 84 virtual tcu::TestNode::IterateResult iterate(); 85 86 private: 87 /* Private member functions */ 88 ShaderCompilationCompatibilityTests(const ShaderCompilationCompatibilityTests& other); 89 ShaderCompilationCompatibilityTests& operator=(const ShaderCompilationCompatibilityTests& other); 90 91 /* Static member constants. */ 92 static const struct TestShader 93 { 94 glw::GLenum type; 95 const glw::GLchar* type_name; 96 const glw::GLchar* source; 97 } s_shaders[]; //!< Test cases shaders. 98 99 static const glw::GLsizei s_shaders_count; //!< Test cases shaders count. 100 }; 101 102 /* ShaderCompilationCompatibilityTests */ 103 104 /** @class ShaderFunctionalCompatibilityTests 105 * 106 * @brief Test veryifies that GLSL mix(T, T, Tboolean) function 107 * works with int, uint and boolean types. Test is performed 108 * for highp, mediump and lowp precision qualifiers. 109 */ 110 class ShaderFunctionalCompatibilityTest : public deqp::TestCase 111 { 112 public: 113 /* Public member functions. */ 114 ShaderFunctionalCompatibilityTest(deqp::Context& context); 115 116 virtual tcu::TestNode::IterateResult iterate(); 117 118 private: 119 /* Private member variables. */ 120 glw::GLuint m_po_id; //!< Program object name. 121 glw::GLuint m_fbo_id; //!< Framebuffer object name. 122 glw::GLuint m_rbo_id; //!< Renderbuffer object name. 123 glw::GLuint m_vao_id; //!< Vertex Array Object name. 124 125 /* Static member constants. */ 126 static const glw::GLchar* s_shader_version; //!< Shader version string. 127 static const glw::GLchar* s_vertex_shader_body; //!< Vertex shader body template. 128 static const glw::GLchar* s_fragment_shader_body; //!< Fragment shader body template. 129 static const struct Shader 130 { 131 const glw::GLchar* vertex[3]; 132 const glw::GLchar* fragment[3]; 133 } s_shaders[]; //!< Template parameter cases. 134 static const glw::GLsizei s_shaders_count; //!< Number of template parameter cases. 135 136 /* Private member functions */ 137 ShaderFunctionalCompatibilityTest(const ShaderFunctionalCompatibilityTest& other); 138 ShaderFunctionalCompatibilityTest& operator=(const ShaderFunctionalCompatibilityTest& other); 139 140 bool createProgram(const struct Shader shader_source); 141 void createFramebufferAndVertexArrayObject(); 142 bool test(); 143 void cleanProgram(); 144 void cleanFramebufferAndVertexArrayObject(); 145 }; 146 147 /* ShaderFunctionalCompatibilityTests */ 148 149 /** @class SampleVariablesTests 150 * 151 * @breif This class groups adjusted OpenGL ES 3.1 Sample Variables Tests. 152 * Those tests cover a new GLSL built-in constant for the maximum supported 153 * samples (gl_MaxSamples) which is available in OpenGL ES 3.1 and in new 154 * compatibility feature of OpenGL 4.5. 155 */ 156 class SampleVariablesTests : public deqp::TestCaseGroup 157 { 158 public: 159 SampleVariablesTests(deqp::Context& context, glu::GLSLVersion glslVersion); 160 ~SampleVariablesTests(); 161 162 void init(); 163 164 private: 165 SampleVariablesTests(const SampleVariablesTests& other); 166 SampleVariablesTests& operator=(const SampleVariablesTests& other); 167 168 enum 169 { 170 SAMPLE_MASKS = 8 171 }; 172 173 glu::GLSLVersion m_glslVersion; 174 }; 175 176 /* SampleVariablesTests class */ 177 178 /** @class ShaderImageLoadStoreTests 179 * 180 * @brief This class groups adjusted OpenGL ES 3.1 Shader Image Load 181 * Store Tests. These tests cover following features of OpenGL 182 * ES 3.1 which were included to OpenGL 4.5 as a compatibility 183 * enhancement: 184 * 185 * - a MemoryBarrierByRegion API, 186 * - a GLSL built-in function imageAtomicExchange, 187 * - a set of new GLSL built-in constants (gl_Max*ImageUniforms, 188 * gl_MaxCombinedShaderOutputResources) 189 * - a "coherent" qualifier related to variables taken by the GLSL atomic* 190 * and imageAtomic* functions. 191 */ 192 class ShaderImageLoadStoreTests : public deqp::TestCaseGroup 193 { 194 public: 195 ShaderImageLoadStoreTests(deqp::Context& context); 196 ~ShaderImageLoadStoreTests(void); 197 198 void init(void); 199 200 private: 201 ShaderImageLoadStoreTests(const ShaderImageLoadStoreTests& other); 202 ShaderImageLoadStoreTests& operator=(const ShaderImageLoadStoreTests& other); 203 }; 204 205 /* ShaderImageLoadStoreTests class */ 206 207 /** @class ShaderStorageBufferObjectTests 208 * 209 * @brief This class contains adjusted OpenGL ES 3.1 Shader Storage 210 * Buffer Object Tests. These tests cover minimum required 211 * size of SSBOs to 2^27 (128 MB) and its general functionality 212 * included in OpenGL ES 3.1 and in new compatibility feature 213 * of OpenGL 4.5. 214 */ 215 class ShaderStorageBufferObjectTests : public deqp::TestCaseGroup 216 { 217 public: 218 ShaderStorageBufferObjectTests(deqp::Context& context); 219 ~ShaderStorageBufferObjectTests(void); 220 221 void init(void); 222 223 private: 224 ShaderStorageBufferObjectTests(const ShaderStorageBufferObjectTests& other); 225 ShaderStorageBufferObjectTests& operator=(const ShaderStorageBufferObjectTests& other); 226 }; 227 228 /* ShaderStorageBufferObjectTests class */ 229 } /* es31compatibility namespace */ 230 } /* gl4cts namespace */ 231 232 #endif // _GL4CES31COMPATIBILITYTESTS_HPP 233