1e5c31af7Sopenharmony_ci#ifndef _ESEXTCTESSELLATIONSHADERINVARIANCE_HPP 2e5c31af7Sopenharmony_ci#define _ESEXTCTESSELLATIONSHADERINVARIANCE_HPP 3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 4e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite 5e5c31af7Sopenharmony_ci * ----------------------------- 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Copyright (c) 2014-2016 The Khronos Group Inc. 8e5c31af7Sopenharmony_ci * 9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 14e5c31af7Sopenharmony_ci * 15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 19e5c31af7Sopenharmony_ci * limitations under the License. 20e5c31af7Sopenharmony_ci * 21e5c31af7Sopenharmony_ci */ /*! 22e5c31af7Sopenharmony_ci * \file 23e5c31af7Sopenharmony_ci * \brief 24e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/ 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ci#include "../esextcTestCaseBase.hpp" 27e5c31af7Sopenharmony_ci#include "esextcTessellationShaderUtils.hpp" 28e5c31af7Sopenharmony_ci#include "gluShaderUtil.hpp" 29e5c31af7Sopenharmony_ci#include "glwEnums.hpp" 30e5c31af7Sopenharmony_ci#include "tcuDefs.hpp" 31e5c31af7Sopenharmony_ci 32e5c31af7Sopenharmony_cinamespace glcts 33e5c31af7Sopenharmony_ci{ 34e5c31af7Sopenharmony_ci 35e5c31af7Sopenharmony_ci/** A DEQP CTS test group that collects all tests that verify invariance 36e5c31af7Sopenharmony_ci * conformance. 37e5c31af7Sopenharmony_ci */ 38e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceTests : public glcts::TestCaseGroupBase 39e5c31af7Sopenharmony_ci{ 40e5c31af7Sopenharmony_cipublic: 41e5c31af7Sopenharmony_ci /* Public methods */ 42e5c31af7Sopenharmony_ci TessellationShaderInvarianceTests(glcts::Context& context, const ExtParameters& extParams); 43e5c31af7Sopenharmony_ci 44e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceTests(void) 45e5c31af7Sopenharmony_ci { 46e5c31af7Sopenharmony_ci } 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_ci virtual void init(void); 49e5c31af7Sopenharmony_ci 50e5c31af7Sopenharmony_ciprivate: 51e5c31af7Sopenharmony_ci /* Private methods */ 52e5c31af7Sopenharmony_ci TessellationShaderInvarianceTests(const TessellationShaderInvarianceTests& other); 53e5c31af7Sopenharmony_ci TessellationShaderInvarianceTests& operator=(const TessellationShaderInvarianceTests& other); 54e5c31af7Sopenharmony_ci}; 55e5c31af7Sopenharmony_ci 56e5c31af7Sopenharmony_ci/** Base class that provides shared invariance test implementation. Invariance 57e5c31af7Sopenharmony_ci * rule test need only to implement the abstract methods. 58e5c31af7Sopenharmony_ci **/ 59e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceBaseTest : public TestCaseBase 60e5c31af7Sopenharmony_ci{ 61e5c31af7Sopenharmony_cipublic: 62e5c31af7Sopenharmony_ci /* Public methods */ 63e5c31af7Sopenharmony_ci TessellationShaderInvarianceBaseTest(Context& context, const ExtParameters& extParams, const char* name, 64e5c31af7Sopenharmony_ci const char* description); 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceBaseTest(void) 67e5c31af7Sopenharmony_ci { 68e5c31af7Sopenharmony_ci } 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ci virtual void deinit(void); 71e5c31af7Sopenharmony_ci virtual IterateResult iterate(void); 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ciprotected: 74e5c31af7Sopenharmony_ci /* Protected variables */ 75e5c31af7Sopenharmony_ci TessellationShaderUtils* m_utils_ptr; 76e5c31af7Sopenharmony_ci 77e5c31af7Sopenharmony_ci virtual void executeDrawCall(unsigned int n_iteration); 78e5c31af7Sopenharmony_ci virtual unsigned int getAmountOfIterations() = 0; 79e5c31af7Sopenharmony_ci virtual unsigned int getDrawCallCountArgument(); 80e5c31af7Sopenharmony_ci virtual std::string getFSCode(unsigned int n_iteration); 81e5c31af7Sopenharmony_ci virtual const char* getInnerTessLevelUniformName(); 82e5c31af7Sopenharmony_ci virtual const char* getOuterTessLevelUniformName(); 83e5c31af7Sopenharmony_ci 84e5c31af7Sopenharmony_ci virtual void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, 85e5c31af7Sopenharmony_ci float* out_outer_tess_levels, bool* out_point_mode, 86e5c31af7Sopenharmony_ci _tessellation_primitive_mode* out_primitive_mode, 87e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 88e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size) = 0; 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_ci virtual std::string getTCCode(unsigned int n_iteration); 91e5c31af7Sopenharmony_ci virtual std::string getTECode(unsigned int n_iteration) = 0; 92e5c31af7Sopenharmony_ci virtual std::string getVSCode(unsigned int n_iteration); 93e5c31af7Sopenharmony_ci 94e5c31af7Sopenharmony_ci virtual void getXFBProperties(unsigned int n_iteration, unsigned int* out_n_names, const char*** out_names); 95e5c31af7Sopenharmony_ci 96e5c31af7Sopenharmony_ci virtual void verifyResultDataForIteration(unsigned int n_iteration, const void* data); 97e5c31af7Sopenharmony_ci 98e5c31af7Sopenharmony_ci virtual void verifyResultData(const void** all_iterations_data); 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ciprivate: 101e5c31af7Sopenharmony_ci /* Private type definitions */ 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_ci /* Private methods */ 104e5c31af7Sopenharmony_ci void initTest(); 105e5c31af7Sopenharmony_ci 106e5c31af7Sopenharmony_ci /* Private variables */ 107e5c31af7Sopenharmony_ci typedef struct _test_program 108e5c31af7Sopenharmony_ci { 109e5c31af7Sopenharmony_ci glw::GLuint po_id; 110e5c31af7Sopenharmony_ci 111e5c31af7Sopenharmony_ci glw::GLuint inner_tess_level_uniform_location; 112e5c31af7Sopenharmony_ci glw::GLuint outer_tess_level_uniform_location; 113e5c31af7Sopenharmony_ci 114e5c31af7Sopenharmony_ci } _test_program; 115e5c31af7Sopenharmony_ci 116e5c31af7Sopenharmony_ci /* Defines a vector of program objects. Index corresponds to iteration index */ 117e5c31af7Sopenharmony_ci typedef std::vector<_test_program> _programs; 118e5c31af7Sopenharmony_ci typedef _programs::const_iterator _programs_const_iterator; 119e5c31af7Sopenharmony_ci typedef _programs::iterator _programs_iterator; 120e5c31af7Sopenharmony_ci 121e5c31af7Sopenharmony_ci glw::GLuint m_bo_id; 122e5c31af7Sopenharmony_ci _programs m_programs; 123e5c31af7Sopenharmony_ci glw::GLuint m_qo_tfpw_id; 124e5c31af7Sopenharmony_ci glw::GLuint m_vao_id; 125e5c31af7Sopenharmony_ci}; 126e5c31af7Sopenharmony_ci 127e5c31af7Sopenharmony_ci/** Implementation of Test Case 42 128e5c31af7Sopenharmony_ci * 129e5c31af7Sopenharmony_ci * Make sure that invariance rule 1 is adhered to. Using a program object 130e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 131e5c31af7Sopenharmony_ci * vertex shaders, render three points/lines/triangles (A, B, C) and 132e5c31af7Sopenharmony_ci * store vertices output by the tessellation evaluation shader. Then render 133e5c31af7Sopenharmony_ci * the geometry in (B, C, A) order, using the same program object. Test 134e5c31af7Sopenharmony_ci * passes if vertices stored in two different iterations for the same 135e5c31af7Sopenharmony_ci * triangle are identical. Owing to rule 8, assume zero epsilon. 136e5c31af7Sopenharmony_ci **/ 137e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule1Test : public TessellationShaderInvarianceBaseTest 138e5c31af7Sopenharmony_ci{ 139e5c31af7Sopenharmony_cipublic: 140e5c31af7Sopenharmony_ci /* Public methods */ 141e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule1Test(Context& context, const ExtParameters& extParams); 142e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule1Test(); 143e5c31af7Sopenharmony_ci 144e5c31af7Sopenharmony_ciprotected: 145e5c31af7Sopenharmony_ci /* Protected methods */ 146e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 147e5c31af7Sopenharmony_ci unsigned int getDrawCallCountArgument(); 148e5c31af7Sopenharmony_ci 149e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 150e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 151e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 152e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 153e5c31af7Sopenharmony_ci 154e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 155e5c31af7Sopenharmony_ci void verifyResultData(const void** all_iterations_data); 156e5c31af7Sopenharmony_ci}; 157e5c31af7Sopenharmony_ci 158e5c31af7Sopenharmony_ci/** Implementation of Test Case 43 159e5c31af7Sopenharmony_ci * 160e5c31af7Sopenharmony_ci * Make sure that invariance rule 2 is adhered to. Using a program object 161e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 162e5c31af7Sopenharmony_ci * vertex shaders, render a number of full-screen triangles/quads, each 163e5c31af7Sopenharmony_ci * instance rendered with different inner tessellation level but identical 164e5c31af7Sopenharmony_ci * outer tessellation level and spacing input layout qualifiers. Test passes 165e5c31af7Sopenharmony_ci * if outer edge's vertices are the same for both types of geometry 166e5c31af7Sopenharmony_ci * (each type considered separately). 167e5c31af7Sopenharmony_ci **/ 168e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule2Test : public TessellationShaderInvarianceBaseTest 169e5c31af7Sopenharmony_ci{ 170e5c31af7Sopenharmony_cipublic: 171e5c31af7Sopenharmony_ci /* Public methods */ 172e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule2Test(Context& context, const ExtParameters& extParams); 173e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule2Test(); 174e5c31af7Sopenharmony_ci 175e5c31af7Sopenharmony_ciprotected: 176e5c31af7Sopenharmony_ci /* Protected methods */ 177e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 178e5c31af7Sopenharmony_ci 179e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 180e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 181e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 182e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 183e5c31af7Sopenharmony_ci 184e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 185e5c31af7Sopenharmony_ci void verifyResultData(const void** all_iterations_data); 186e5c31af7Sopenharmony_ci 187e5c31af7Sopenharmony_ciprivate: 188e5c31af7Sopenharmony_ci /* Private variables */ 189e5c31af7Sopenharmony_ci unsigned int m_n_tessellated_vertices[4 /* iterations in total */]; 190e5c31af7Sopenharmony_ci}; 191e5c31af7Sopenharmony_ci 192e5c31af7Sopenharmony_ci/** Implementation of Test Case 44 193e5c31af7Sopenharmony_ci * 194e5c31af7Sopenharmony_ci * Make sure that invariance rule 3 is adhered to. Using a program object 195e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 196e5c31af7Sopenharmony_ci * vertex shaders, tessellate a number of triangles/quads/isolines geometry 197e5c31af7Sopenharmony_ci * with different inner/outer/vertex spacing input layout qualifiers. 198e5c31af7Sopenharmony_ci * Capture vertices generated by tessellation evaluation stage and make sure 199e5c31af7Sopenharmony_ci * that generated vertices are symmetrical. Owing to rule 8, assume zero 200e5c31af7Sopenharmony_ci * epsilon. 201e5c31af7Sopenharmony_ci **/ 202e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule3Test : public TessellationShaderInvarianceBaseTest 203e5c31af7Sopenharmony_ci{ 204e5c31af7Sopenharmony_cipublic: 205e5c31af7Sopenharmony_ci /* Public methods */ 206e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule3Test(Context& context, const ExtParameters& extParams); 207e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule3Test(); 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ciprotected: 210e5c31af7Sopenharmony_ci /* Protected methods */ 211e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 212e5c31af7Sopenharmony_ci 213e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 214e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 215e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 216e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 217e5c31af7Sopenharmony_ci 218e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 219e5c31af7Sopenharmony_ci 220e5c31af7Sopenharmony_ci void verifyResultDataForIteration(unsigned int n_iteration, const void* data); 221e5c31af7Sopenharmony_ci 222e5c31af7Sopenharmony_ciprivate: 223e5c31af7Sopenharmony_ci /* Private type definitions */ 224e5c31af7Sopenharmony_ci typedef struct _test_iteration 225e5c31af7Sopenharmony_ci { 226e5c31af7Sopenharmony_ci glw::GLfloat inner_tess_levels[2]; 227e5c31af7Sopenharmony_ci glw::GLfloat outer_tess_levels[4]; 228e5c31af7Sopenharmony_ci _tessellation_primitive_mode primitive_mode; 229e5c31af7Sopenharmony_ci _tessellation_shader_vertex_spacing vertex_spacing; 230e5c31af7Sopenharmony_ci 231e5c31af7Sopenharmony_ci unsigned int n_vertices; 232e5c31af7Sopenharmony_ci 233e5c31af7Sopenharmony_ci _test_iteration() 234e5c31af7Sopenharmony_ci { 235e5c31af7Sopenharmony_ci memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); 236e5c31af7Sopenharmony_ci memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); 237e5c31af7Sopenharmony_ci 238e5c31af7Sopenharmony_ci primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; 239e5c31af7Sopenharmony_ci vertex_spacing = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN; 240e5c31af7Sopenharmony_ci 241e5c31af7Sopenharmony_ci n_vertices = 0; 242e5c31af7Sopenharmony_ci } 243e5c31af7Sopenharmony_ci } _test_iteration; 244e5c31af7Sopenharmony_ci 245e5c31af7Sopenharmony_ci typedef std::vector<_test_iteration> _test_iterations; 246e5c31af7Sopenharmony_ci typedef _test_iterations::const_iterator _test_iterations_const_iterator; 247e5c31af7Sopenharmony_ci 248e5c31af7Sopenharmony_ci /* Private methods */ 249e5c31af7Sopenharmony_ci void deinitTestIterations(); 250e5c31af7Sopenharmony_ci void initTestIterations(); 251e5c31af7Sopenharmony_ci 252e5c31af7Sopenharmony_ci /* Private fields */ 253e5c31af7Sopenharmony_ci _test_iterations m_test_iterations; 254e5c31af7Sopenharmony_ci}; 255e5c31af7Sopenharmony_ci 256e5c31af7Sopenharmony_ci/** Implementation of Test Case 45 257e5c31af7Sopenharmony_ci * 258e5c31af7Sopenharmony_ci * Make sure that invariance rule 4 is adhered to. Using a program object 259e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 260e5c31af7Sopenharmony_ci * vertex shaders, tessellate a number of triangular and quad geometry with 261e5c31af7Sopenharmony_ci * different inner tessellation level input layout qualifiers. 262e5c31af7Sopenharmony_ci * Capture vertices generated by tessellation evaluation stage and make sure 263e5c31af7Sopenharmony_ci * that all sets of vertices generated when subdividing outer edges are 264e5c31af7Sopenharmony_ci * independent of the specific edge subdivided. 265e5c31af7Sopenharmony_ci * 266e5c31af7Sopenharmony_ci * Technical details: 267e5c31af7Sopenharmony_ci * 268e5c31af7Sopenharmony_ci * 1. The test should use a number of different inner+outer 269e5c31af7Sopenharmony_ci * tessellation levels+vertex spacing mode configuration 270e5c31af7Sopenharmony_ci * combinations, each resulting in a different vertex set for 271e5c31af7Sopenharmony_ci * the generator primitive type considered. 272e5c31af7Sopenharmony_ci * In first iteration, it should draw a screen quad, and 273e5c31af7Sopenharmony_ci * in the other a triangle should be rendered. 274e5c31af7Sopenharmony_ci * 2. The test should capture vertices output in TE stage. The 275e5c31af7Sopenharmony_ci * rasterizer discard mode can be enabled, as the test is not 276e5c31af7Sopenharmony_ci * expected to analyse visual output. 277e5c31af7Sopenharmony_ci * 3. For quad tessellation, the test should identify vertices 278e5c31af7Sopenharmony_ci * generated for top outer edge and make sure that remaining 279e5c31af7Sopenharmony_ci * outer edges of the quad are built of vertices that conform 280e5c31af7Sopenharmony_ci * to the rule. 281e5c31af7Sopenharmony_ci * 4. For triangular tessellation, the test should identify vertices 282e5c31af7Sopenharmony_ci * generated for one of the outer edges and then check if the other 283e5c31af7Sopenharmony_ci * two outer edges have been generated in conformance to the rule. 284e5c31af7Sopenharmony_ci **/ 285e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule4Test : public TessellationShaderInvarianceBaseTest 286e5c31af7Sopenharmony_ci{ 287e5c31af7Sopenharmony_cipublic: 288e5c31af7Sopenharmony_ci /* Public methods */ 289e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule4Test(Context& context, const ExtParameters& extParams); 290e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule4Test(); 291e5c31af7Sopenharmony_ci 292e5c31af7Sopenharmony_ciprotected: 293e5c31af7Sopenharmony_ci /* Protected methods */ 294e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 295e5c31af7Sopenharmony_ci 296e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 297e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 298e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 299e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 300e5c31af7Sopenharmony_ci 301e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 302e5c31af7Sopenharmony_ci 303e5c31af7Sopenharmony_ci void verifyResultDataForIteration(unsigned int n_iteration, const void* data); 304e5c31af7Sopenharmony_ci 305e5c31af7Sopenharmony_ciprivate: 306e5c31af7Sopenharmony_ci /* Private type definitions */ 307e5c31af7Sopenharmony_ci typedef struct _test_iteration 308e5c31af7Sopenharmony_ci { 309e5c31af7Sopenharmony_ci glw::GLfloat inner_tess_levels[2]; 310e5c31af7Sopenharmony_ci glw::GLfloat outer_tess_levels[4]; 311e5c31af7Sopenharmony_ci _tessellation_primitive_mode primitive_mode; 312e5c31af7Sopenharmony_ci _tessellation_shader_vertex_spacing vertex_spacing; 313e5c31af7Sopenharmony_ci 314e5c31af7Sopenharmony_ci unsigned int n_vertices; 315e5c31af7Sopenharmony_ci 316e5c31af7Sopenharmony_ci _test_iteration() 317e5c31af7Sopenharmony_ci { 318e5c31af7Sopenharmony_ci memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); 319e5c31af7Sopenharmony_ci memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); 320e5c31af7Sopenharmony_ci 321e5c31af7Sopenharmony_ci primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; 322e5c31af7Sopenharmony_ci vertex_spacing = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN; 323e5c31af7Sopenharmony_ci 324e5c31af7Sopenharmony_ci n_vertices = 0; 325e5c31af7Sopenharmony_ci } 326e5c31af7Sopenharmony_ci } _test_iteration; 327e5c31af7Sopenharmony_ci 328e5c31af7Sopenharmony_ci typedef std::vector<_test_iteration> _test_iterations; 329e5c31af7Sopenharmony_ci typedef _test_iterations::const_iterator _test_iterations_const_iterator; 330e5c31af7Sopenharmony_ci 331e5c31af7Sopenharmony_ci /* Private methods */ 332e5c31af7Sopenharmony_ci void deinitTestIterations(); 333e5c31af7Sopenharmony_ci void initTestIterations(); 334e5c31af7Sopenharmony_ci 335e5c31af7Sopenharmony_ci bool isVertexDefined(const float* vertex_data, unsigned int n_vertices, const float* vertex_data_seeked, 336e5c31af7Sopenharmony_ci unsigned int n_vertex_data_seeked_components); 337e5c31af7Sopenharmony_ci 338e5c31af7Sopenharmony_ci /* Private fields */ 339e5c31af7Sopenharmony_ci _test_iterations m_test_iterations; 340e5c31af7Sopenharmony_ci}; 341e5c31af7Sopenharmony_ci 342e5c31af7Sopenharmony_ci/** Implementation of Test Case 46 343e5c31af7Sopenharmony_ci * 344e5c31af7Sopenharmony_ci * Make sure that Rule 5 is adhered to. Using a program object 345e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 346e5c31af7Sopenharmony_ci * vertex shaders, tessellate a number of triangles/quads/isolines 347e5c31af7Sopenharmony_ci * geometry with different vertex ordering input layout qualifiers. Capture 348e5c31af7Sopenharmony_ci * vertices generated by tessellation evaluation stage and make sure that each 349e5c31af7Sopenharmony_ci * iteration defines exactly the same set of vertices, although in different 350e5c31af7Sopenharmony_ci * order. 351e5c31af7Sopenharmony_ci * 352e5c31af7Sopenharmony_ci **/ 353e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule5Test : public TessellationShaderInvarianceBaseTest 354e5c31af7Sopenharmony_ci{ 355e5c31af7Sopenharmony_cipublic: 356e5c31af7Sopenharmony_ci /* Public methods */ 357e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule5Test(Context& context, const ExtParameters& extParams); 358e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule5Test(); 359e5c31af7Sopenharmony_ci 360e5c31af7Sopenharmony_ciprotected: 361e5c31af7Sopenharmony_ci /* Protected methods */ 362e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 363e5c31af7Sopenharmony_ci 364e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 365e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 366e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 367e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 368e5c31af7Sopenharmony_ci 369e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 370e5c31af7Sopenharmony_ci void verifyResultData(const void** all_iterations_data); 371e5c31af7Sopenharmony_ci 372e5c31af7Sopenharmony_ciprivate: 373e5c31af7Sopenharmony_ci /* Private type definitions */ 374e5c31af7Sopenharmony_ci typedef struct _test_iteration 375e5c31af7Sopenharmony_ci { 376e5c31af7Sopenharmony_ci glw::GLfloat inner_tess_levels[2]; 377e5c31af7Sopenharmony_ci glw::GLfloat outer_tess_levels[4]; 378e5c31af7Sopenharmony_ci _tessellation_primitive_mode primitive_mode; 379e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering vertex_ordering; 380e5c31af7Sopenharmony_ci 381e5c31af7Sopenharmony_ci unsigned int n_vertices; 382e5c31af7Sopenharmony_ci 383e5c31af7Sopenharmony_ci _test_iteration() 384e5c31af7Sopenharmony_ci { 385e5c31af7Sopenharmony_ci memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); 386e5c31af7Sopenharmony_ci memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); 387e5c31af7Sopenharmony_ci 388e5c31af7Sopenharmony_ci primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; 389e5c31af7Sopenharmony_ci vertex_ordering = TESSELLATION_SHADER_VERTEX_ORDERING_UNKNOWN; 390e5c31af7Sopenharmony_ci 391e5c31af7Sopenharmony_ci n_vertices = 0; 392e5c31af7Sopenharmony_ci } 393e5c31af7Sopenharmony_ci } _test_iteration; 394e5c31af7Sopenharmony_ci 395e5c31af7Sopenharmony_ci typedef std::vector<_test_iteration> _test_iterations; 396e5c31af7Sopenharmony_ci typedef _test_iterations::const_iterator _test_iterations_const_iterator; 397e5c31af7Sopenharmony_ci 398e5c31af7Sopenharmony_ci /* Private methods */ 399e5c31af7Sopenharmony_ci void deinitTestIterations(); 400e5c31af7Sopenharmony_ci _test_iteration& getTestForIteration(unsigned int n_iteration); 401e5c31af7Sopenharmony_ci void initTestIterations(); 402e5c31af7Sopenharmony_ci bool isVertexDefined(const float* vertex_data, unsigned int n_vertices, const float* vertex_data_seeked, 403e5c31af7Sopenharmony_ci unsigned int n_vertex_data_seeked_components); 404e5c31af7Sopenharmony_ci 405e5c31af7Sopenharmony_ci /* Private fields */ 406e5c31af7Sopenharmony_ci _test_iterations m_test_triangles_iterations; 407e5c31af7Sopenharmony_ci _test_iterations m_test_quads_iterations; 408e5c31af7Sopenharmony_ci}; 409e5c31af7Sopenharmony_ci 410e5c31af7Sopenharmony_ci/** Implementation of Test Case 47 411e5c31af7Sopenharmony_ci * 412e5c31af7Sopenharmony_ci * Make sure that invariance rule 6 is adhered to. Using a program object 413e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 414e5c31af7Sopenharmony_ci * vertex shaders, tessellate a number of triangles/quads geometry 415e5c31af7Sopenharmony_ci * with different inner tessellation levels/vertex spacing input layout qualifiers. 416e5c31af7Sopenharmony_ci * Capture vertices generated by tessellation evaluation stage and make sure 417e5c31af7Sopenharmony_ci * that all interior triangles generated during tessellation are identical 418e5c31af7Sopenharmony_ci * except for vertex and triangle order. 419e5c31af7Sopenharmony_ci **/ 420e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule6Test : public TessellationShaderInvarianceBaseTest 421e5c31af7Sopenharmony_ci{ 422e5c31af7Sopenharmony_cipublic: 423e5c31af7Sopenharmony_ci /* Public methods */ 424e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule6Test(Context& context, const ExtParameters& extParams); 425e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule6Test(); 426e5c31af7Sopenharmony_ci 427e5c31af7Sopenharmony_ciprotected: 428e5c31af7Sopenharmony_ci /* Protected methods */ 429e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 430e5c31af7Sopenharmony_ci 431e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 432e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 433e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 434e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 435e5c31af7Sopenharmony_ci 436e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 437e5c31af7Sopenharmony_ci void verifyResultData(const void** all_iterations_data); 438e5c31af7Sopenharmony_ci 439e5c31af7Sopenharmony_ciprivate: 440e5c31af7Sopenharmony_ci /* Private type definitions */ 441e5c31af7Sopenharmony_ci typedef struct _test_iteration 442e5c31af7Sopenharmony_ci { 443e5c31af7Sopenharmony_ci glw::GLfloat inner_tess_levels[2]; 444e5c31af7Sopenharmony_ci glw::GLfloat outer_tess_levels[4]; 445e5c31af7Sopenharmony_ci _tessellation_primitive_mode primitive_mode; 446e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering vertex_ordering; 447e5c31af7Sopenharmony_ci 448e5c31af7Sopenharmony_ci unsigned int n_vertices; 449e5c31af7Sopenharmony_ci 450e5c31af7Sopenharmony_ci _test_iteration() 451e5c31af7Sopenharmony_ci { 452e5c31af7Sopenharmony_ci memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); 453e5c31af7Sopenharmony_ci memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); 454e5c31af7Sopenharmony_ci 455e5c31af7Sopenharmony_ci primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; 456e5c31af7Sopenharmony_ci vertex_ordering = TESSELLATION_SHADER_VERTEX_ORDERING_UNKNOWN; 457e5c31af7Sopenharmony_ci 458e5c31af7Sopenharmony_ci n_vertices = 0; 459e5c31af7Sopenharmony_ci } 460e5c31af7Sopenharmony_ci } _test_iteration; 461e5c31af7Sopenharmony_ci 462e5c31af7Sopenharmony_ci typedef std::vector<_test_iteration> _test_iterations; 463e5c31af7Sopenharmony_ci typedef _test_iterations::const_iterator _test_iterations_const_iterator; 464e5c31af7Sopenharmony_ci 465e5c31af7Sopenharmony_ci /* Private methods */ 466e5c31af7Sopenharmony_ci void deinitTestIterations(); 467e5c31af7Sopenharmony_ci _test_iteration& getTestForIteration(unsigned int n_iteration); 468e5c31af7Sopenharmony_ci void initTestIterations(); 469e5c31af7Sopenharmony_ci 470e5c31af7Sopenharmony_ci /* Private fields */ 471e5c31af7Sopenharmony_ci _test_iterations m_test_triangles_iterations; 472e5c31af7Sopenharmony_ci _test_iterations m_test_quads_iterations; 473e5c31af7Sopenharmony_ci}; 474e5c31af7Sopenharmony_ci 475e5c31af7Sopenharmony_ci/** Implementation of Test Case 48 476e5c31af7Sopenharmony_ci * 477e5c31af7Sopenharmony_ci * Make sure that invariance rule 7 is adhered to. Using a program object 478e5c31af7Sopenharmony_ci * consisting of a fragment/tessellation control/tessellation evaluation/ 479e5c31af7Sopenharmony_ci * vertex shaders, tessellate a number of triangles/quads geometry 480e5c31af7Sopenharmony_ci * with different vertex spacing input layout qualifiers. For each such 481e5c31af7Sopenharmony_ci * case, the test should verify that modification of a single outer tessellation 482e5c31af7Sopenharmony_ci * level only affects tessellation coordinates generated for a corresponding 483e5c31af7Sopenharmony_ci * edge. Verification should be carried out by capturing vertices generated for 484e5c31af7Sopenharmony_ci * tessellation evaluation stage and making sure that each iteration defines 485e5c31af7Sopenharmony_ci * exactly the same set of triangles connecting inner and outer edge of the 486e5c31af7Sopenharmony_ci * tessellated geometry for all but the modified edge. 487e5c31af7Sopenharmony_ci **/ 488e5c31af7Sopenharmony_ciclass TessellationShaderInvarianceRule7Test : public TessellationShaderInvarianceBaseTest 489e5c31af7Sopenharmony_ci{ 490e5c31af7Sopenharmony_cipublic: 491e5c31af7Sopenharmony_ci /* Public methods */ 492e5c31af7Sopenharmony_ci TessellationShaderInvarianceRule7Test(Context& context, const ExtParameters& extParams); 493e5c31af7Sopenharmony_ci virtual ~TessellationShaderInvarianceRule7Test(); 494e5c31af7Sopenharmony_ci 495e5c31af7Sopenharmony_ciprotected: 496e5c31af7Sopenharmony_ci /* Protected methods */ 497e5c31af7Sopenharmony_ci unsigned int getAmountOfIterations(); 498e5c31af7Sopenharmony_ci 499e5c31af7Sopenharmony_ci void getIterationProperties(unsigned int n_iteration, float* out_inner_tess_levels, float* out_outer_tess_levels, 500e5c31af7Sopenharmony_ci bool* out_point_mode, _tessellation_primitive_mode* out_primitive_mode, 501e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering* out_vertex_ordering, 502e5c31af7Sopenharmony_ci unsigned int* out_result_buffer_size); 503e5c31af7Sopenharmony_ci 504e5c31af7Sopenharmony_ci std::string getTECode(unsigned int n_iteration); 505e5c31af7Sopenharmony_ci void verifyResultData(const void** all_iterations_data); 506e5c31af7Sopenharmony_ci 507e5c31af7Sopenharmony_ciprivate: 508e5c31af7Sopenharmony_ci /* Private type definitions */ 509e5c31af7Sopenharmony_ci typedef struct _test_iteration 510e5c31af7Sopenharmony_ci { 511e5c31af7Sopenharmony_ci glw::GLfloat inner_tess_levels[2]; 512e5c31af7Sopenharmony_ci glw::GLfloat outer_tess_levels[4]; 513e5c31af7Sopenharmony_ci _tessellation_primitive_mode primitive_mode; 514e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering vertex_ordering; 515e5c31af7Sopenharmony_ci 516e5c31af7Sopenharmony_ci bool is_base_iteration; 517e5c31af7Sopenharmony_ci unsigned int n_modified_outer_tess_level; 518e5c31af7Sopenharmony_ci unsigned int n_vertices; 519e5c31af7Sopenharmony_ci 520e5c31af7Sopenharmony_ci _test_iteration() 521e5c31af7Sopenharmony_ci { 522e5c31af7Sopenharmony_ci memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); 523e5c31af7Sopenharmony_ci memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); 524e5c31af7Sopenharmony_ci 525e5c31af7Sopenharmony_ci primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; 526e5c31af7Sopenharmony_ci vertex_ordering = TESSELLATION_SHADER_VERTEX_ORDERING_UNKNOWN; 527e5c31af7Sopenharmony_ci 528e5c31af7Sopenharmony_ci is_base_iteration = false; 529e5c31af7Sopenharmony_ci n_modified_outer_tess_level = 0; 530e5c31af7Sopenharmony_ci n_vertices = 0; 531e5c31af7Sopenharmony_ci } 532e5c31af7Sopenharmony_ci } _test_iteration; 533e5c31af7Sopenharmony_ci 534e5c31af7Sopenharmony_ci typedef std::vector<_test_iteration> _test_iterations; 535e5c31af7Sopenharmony_ci typedef _test_iterations::const_iterator _test_iterations_const_iterator; 536e5c31af7Sopenharmony_ci 537e5c31af7Sopenharmony_ci /* Private methods */ 538e5c31af7Sopenharmony_ci void deinitTestIterations(); 539e5c31af7Sopenharmony_ci 540e5c31af7Sopenharmony_ci unsigned int getTestIterationIndex(bool is_triangles_iteration, const float* inner_tess_levels, 541e5c31af7Sopenharmony_ci const float* outer_tess_levels, 542e5c31af7Sopenharmony_ci _tessellation_shader_vertex_ordering vertex_ordering, 543e5c31af7Sopenharmony_ci unsigned int n_modified_outer_tess_level); 544e5c31af7Sopenharmony_ci 545e5c31af7Sopenharmony_ci _test_iteration& getTestForIteration(unsigned int n_iteration); 546e5c31af7Sopenharmony_ci void initTestIterations(); 547e5c31af7Sopenharmony_ci 548e5c31af7Sopenharmony_ci bool isTriangleDefinedInVertexDataSet(const float* base_triangle_data, const float* vertex_data, 549e5c31af7Sopenharmony_ci unsigned int vertex_data_n_vertices); 550e5c31af7Sopenharmony_ci 551e5c31af7Sopenharmony_ci bool isVertexDefined(const float* vertex_data, unsigned int n_vertices, const float* vertex_data_seeked, 552e5c31af7Sopenharmony_ci unsigned int n_vertex_data_seeked_components); 553e5c31af7Sopenharmony_ci 554e5c31af7Sopenharmony_ci /* Private fields */ 555e5c31af7Sopenharmony_ci _test_iterations m_test_triangles_iterations; 556e5c31af7Sopenharmony_ci _test_iterations m_test_quads_iterations; 557e5c31af7Sopenharmony_ci}; 558e5c31af7Sopenharmony_ci 559e5c31af7Sopenharmony_ci} // namespace glcts 560e5c31af7Sopenharmony_ci 561e5c31af7Sopenharmony_ci#endif // _ESEXTCTESSELLATIONSHADERINVARIANCE_HPP 562