1 #ifndef _ESEXTCTESSELLATIONSHADERTRIANGLES_HPP 2 #define _ESEXTCTESSELLATIONSHADERTRIANGLES_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2014-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 #include "../esextcTestCaseBase.hpp" 27 #include "esextcTessellationShaderUtils.hpp" 28 #include "gluShaderUtil.hpp" 29 #include "tcuDefs.hpp" 30 31 namespace glcts 32 { 33 /** A DEQP CTS test group that collects all tests that verify triangle 34 * tessellation. 35 */ 36 class TessellationShaderTrianglesTests : public glcts::TestCaseGroupBase 37 { 38 public: 39 /* Public methods */ 40 TessellationShaderTrianglesTests(glcts::Context& context, const ExtParameters& extParams); 41 ~TessellationShaderTrianglesTests(void)42 virtual ~TessellationShaderTrianglesTests(void) 43 { 44 } 45 46 void init(void); 47 48 private: 49 /* Private methods */ 50 TessellationShaderTrianglesTests(const TessellationShaderTrianglesTests& other); 51 TessellationShaderTrianglesTests& operator=(const TessellationShaderTrianglesTests& other); 52 }; 53 54 /** Implementation of Test Caes 29 55 * 56 * Make sure that only a single triangle with (u,v,w) coordinates set to 57 * (0, 0, 1), (1, 0, 0) and (0, 1, 0) is generated by tessellation primitive 58 * generator if the first inner tessellation level and all three outer 59 * tessellation levels are set to one, equal_spacing or 60 * fractional_odd_spacing vertex spacing modes are used AND triangles 61 * geometry is requested. 62 * 63 * The test should capture vertices output in TE stage, given the 64 * pre-conditions described in the test summary, and then verify vertex 65 * locations. Assume epsilon 1e-5. A single triangle should be drawn. 66 * 67 **/ 68 class TessellationShaderTrianglesDegenerateTriangle : public TestCaseBase 69 { 70 public: 71 /* Public methods */ 72 TessellationShaderTrianglesDegenerateTriangle(Context& context, const ExtParameters& extParams); 73 ~TessellationShaderTrianglesDegenerateTriangle(void)74 virtual ~TessellationShaderTrianglesDegenerateTriangle(void) 75 { 76 } 77 78 virtual void deinit(void); 79 void initTest(void); 80 virtual IterateResult iterate(void); 81 82 private: 83 /* Private type definitions */ 84 typedef struct _test_descriptor 85 { 86 glw::GLuint po_id; 87 glw::GLuint te_id; 88 _tessellation_shader_vertex_spacing vertex_spacing; 89 _test_descriptorglcts::TessellationShaderTrianglesDegenerateTriangle::_test_descriptor90 _test_descriptor() 91 { 92 po_id = 0; 93 te_id = 0; 94 vertex_spacing = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN; 95 } 96 } _test_descriptor; 97 98 typedef std::vector<_test_descriptor> _tests; 99 typedef _tests::const_iterator _tests_const_iterator; 100 101 /* Private methods */ 102 void deinitTestDescriptor(_test_descriptor& test); 103 104 void initTestDescriptor(_test_descriptor& test, _tessellation_shader_vertex_spacing vertex_spacing); 105 106 /* Private variables */ 107 glw::GLuint m_bo_id; 108 glw::GLuint m_fs_id; 109 glw::GLuint m_tc_id; 110 glw::GLuint m_vs_id; 111 glw::GLuint m_vao_id; 112 113 _tests m_tests; 114 }; 115 116 /** Implementation of Test Case 28 117 * 118 * Make sure that modifying second inner tessellation level and fourth outer 119 * tessellation level does not affect geometry generated by tessellation 120 * primitive generator, while in triangles mode. 121 * 122 * Technical details: 123 * 124 * 0. (adapted bullet 0 from test case 25:) 125 * Consider the following set: {1, MAX_TESS_GEN_LEVEL_EXT / 2, 126 * MAX_TESS_GEN_LEVEL_EXT}. 127 * 128 * 1. For all combinations of values from this set in regard to relevant 129 * inner/outer tessellation levels for triangles generator mode, two 130 * different output vertex sets should be captured in TE: 131 * 1a. One for the configuration set considered; 132 * 1b. The other one for the configuration set with an exception that 133 * second inner tessellation level and fourth outer tessellation level 134 * have been set to 1/4th of the original value. 135 * 2. Test passes if all vertices from the first set can be found in the 136 * second set. (assume epsilon 1e-5) 137 * 138 **/ 139 class TessellationShaderTrianglesIdenticalTriangles : public TestCaseBase 140 { 141 public: 142 /* Public methods */ 143 TessellationShaderTrianglesIdenticalTriangles(Context& context, const ExtParameters& extParams); 144 ~TessellationShaderTrianglesIdenticalTriangles(void)145 virtual ~TessellationShaderTrianglesIdenticalTriangles(void) 146 { 147 } 148 149 virtual void deinit(void); 150 void initTest(void); 151 virtual IterateResult iterate(void); 152 153 private: 154 /* Private type definitions */ 155 typedef struct _run 156 { 157 float base_inner[2]; 158 float base_outer[4]; 159 float reference_inner[2]; 160 float reference_outer[4]; 161 162 std::vector<char> base_data; 163 std::vector<char> reference_data; 164 unsigned int n_vertices; 165 _runglcts::TessellationShaderTrianglesIdenticalTriangles::_run166 _run() 167 { 168 memset(base_inner, 0, sizeof(base_inner)); 169 memset(base_outer, 0, sizeof(base_outer)); 170 memset(reference_inner, 0, sizeof(reference_inner)); 171 memset(reference_outer, 0, sizeof(reference_outer)); 172 173 n_vertices = 0; 174 } 175 } _run; 176 177 typedef std::vector<_run> _runs; 178 typedef _runs::const_iterator _runs_const_iterator; 179 180 /* Private variables */ 181 glw::GLuint m_vao_id; 182 _runs m_runs; 183 TessellationShaderUtils* m_utils; 184 }; 185 186 /** Implementation of Test Case 30 187 * 188 * Consider triangle tessellation. 189 * Make sure that if inner tessellation level is set to one and any of the outer 190 * tessellation levels is greater than one, the inner tessellation level 191 * will be rounded up to two or three, depending on active vertex spacing mode. 192 * 193 * Technical details: 194 * 195 * 0. Consider a set: 196 * 197 * A = {2, MAX_TESS_GEN_LEVEL_EXT / 2, MAX_TESS_GEN_LEVEL_EXT}; 198 * 199 * 1. For all values in A, and for all vertex spacing modes, let x be an 200 * iteration-specific value from the set. 201 * 1a. Assuming an inner tessellation level set to 1 and outer tessellation level 202 * set to x, "draw" a single patch. Capture output vertices from TE stage. 203 * 1b. Assuming an inner tessellation level set to 1 or 2 (depending on how 204 * the rounding should work for iteration-specific vertex ordering mode) 205 * and outer tessellation level set to x, "draw" a single patch. Capture 206 * output vertices from TE stage to another buffer object region. 207 * 1c. Iteration passes if all vertices from the first captured set can be 208 * found in the second captured set. [assume epsilon 1e-5]. 209 * 2. Test passes if all iteration passed successfully. 210 * 211 **/ 212 class TessellationShaderTrianglesInnerTessellationLevelRounding : public TestCaseBase 213 { 214 public: 215 /* Public methods */ 216 TessellationShaderTrianglesInnerTessellationLevelRounding(Context& context, const ExtParameters& extParams); 217 ~TessellationShaderTrianglesInnerTessellationLevelRounding(void)218 virtual ~TessellationShaderTrianglesInnerTessellationLevelRounding(void) 219 { 220 } 221 222 virtual void deinit(void); 223 virtual IterateResult iterate(void); 224 void runTestIterations(void); 225 226 private: 227 /* Private type definitions */ 228 typedef struct _run 229 { 230 float set1_inner[2]; 231 float set1_outer[4]; 232 float set2_inner[2]; 233 float set2_outer[4]; 234 _tessellation_shader_vertex_spacing vertex_spacing; 235 236 std::vector<char> set1_data; 237 std::vector<char> set2_data; 238 unsigned int n_vertices; 239 _runglcts::TessellationShaderTrianglesInnerTessellationLevelRounding::_run240 _run() 241 { 242 memset(set1_inner, 0, sizeof(set1_inner)); 243 memset(set1_outer, 0, sizeof(set1_outer)); 244 memset(set2_inner, 0, sizeof(set2_inner)); 245 memset(set2_outer, 0, sizeof(set2_outer)); 246 247 n_vertices = 0; 248 vertex_spacing = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN; 249 } 250 } _run; 251 252 typedef std::vector<_run> _runs; 253 typedef _runs::const_iterator _runs_const_iterator; 254 255 /* Private variables */ 256 glw::GLuint m_vao_id; 257 _runs m_runs; 258 TessellationShaderUtils* m_utils; 259 }; 260 261 } // namespace glcts 262 263 #endif // _ESEXTCTESSELLATIONSHADERTRIANGLES_HPP 264