1 #ifndef _ESEXTCDRAWELEMENTSBASEVERTEXTESTS_HPP 2 #define _ESEXTCDRAWELEMENTSBASEVERTEXTESTS_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 /** 27 */ /*! 28 * \file esextcDrawElementsBaseVertexTests.hpp 29 * \brief Declares test classes that verify conformance of the 30 * "draw elements base vertex" functionality for both 31 * ES and GL. 32 */ /*-------------------------------------------------------------------*/ 33 #include <memory.h> 34 35 #include "glcTestCase.hpp" 36 #include "glwDefs.hpp" 37 #include "tcuDefs.hpp" 38 #include <string.h> 39 40 #include "../esextcTestCaseBase.hpp" 41 42 namespace glcts 43 { 44 using deqp::Context; 45 using deqp::TestCaseGroup; 46 47 /** Base test class implementation for "draw elements base vertex" functionality 48 * conformance tests. 49 * 50 * Functional tests fill m_test_cases instance with test case descriptors, 51 * and then call base class' executeTestCases() method to process these 52 * test cases. The base class also initializes all required function 53 * pointers and reassures that no test cases which are dependent on other 54 * ES extensions are not executed, if any of these extensions are not 55 * supported. 56 */ 57 class DrawElementsBaseVertexTestBase : public TestCaseBase 58 { 59 public: 60 /* Public methods */ 61 DrawElementsBaseVertexTestBase(glcts::Context& context, const ExtParameters& extParams, const char* name, 62 const char* description); 63 64 protected: 65 /* Protected type definitions */ 66 /** Defines a draw call type that should be used for a single 67 * test case iteration. 68 */ 69 enum _function_type 70 { 71 FUNCTION_GL_DRAW_ELEMENTS_BASE_VERTEX, 72 FUNCTION_GL_DRAW_ELEMENTS_INSTANCED_BASE_VERTEX, 73 FUNCTION_GL_DRAW_RANGE_ELEMENTS_BASE_VERTEX, 74 FUNCTION_GL_MULTI_DRAW_ELEMENTS_BASE_VERTEX, 75 76 FUNCTION_COUNT 77 }; 78 79 /** Defines a single test case. Each functional test fills the 80 * m_test_cases vector with test case descriptors, which are 81 * then traversed by base class'executeTestCases() method. 82 */ 83 typedef struct _test_case 84 { 85 glw::GLint basevertex; /* Tells the value of <basevertex> argument for the tested 86 * basevertex draw call. */ 87 _function_type function_type; /* Tells the type of the basevertex draw call that should 88 * be used for the described iteration. */ 89 const glw::GLuint* index_offset; /* Tells the value of <indices> argument for both basevertex 90 * and regular draw calls */ 91 glw::GLenum index_type; /* GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT or GL_UNSIGNED_INT */ 92 glw::GLuint range_start; /* The range start for DrawRangeElements */ 93 glw::GLuint range_end; /* The range end for DrawRangeElements */ 94 glw::GLsizei multi_draw_call_count_array[3]; /* an array of three elements storing "count" arguments 95 * for multi draw calls used to generate contents of both 96 * textures. */ 97 glw::GLuint* multi_draw_call_indices_array[3]; /* an array of three elements holding "indices" arguments 98 * for multi draw call used rto generate contents of base 99 * texture */ 100 glw::GLenum primitive_mode; /* Tells the primitive type that should be used for both 101 * types of draw calls. */ 102 glw::GLuint regular_draw_call_offset; /* offset to be used for non-basevertex draw calls made 103 * to generate reference texture contents. This value will 104 * be added to test_case.index_offset for non-basevertex 105 * draw calls. */ 106 glw::GLuint* regular_draw_call_offset2; /* offset to be used for non-basevertex draw calls made 107 * to generate reference texture contents. This value will 108 * NOT be added to test_case.index_offset for non-basevertex 109 * draw calls. */ 110 glw::GLenum regular_draw_call_index_type; /* index type to be used for non-basevertex draw calls made 111 * to generate reference texture contents. The index type 112 is differenet with base draw call in overflow test.*/ 113 glw::GLuint** regular_multi_draw_call_offseted_array[3]; /* an array of three elements storing offsets for the 114 * multi draw call used to generate reference texture 115 * contents */ 116 bool should_base_texture_match_reference_texture; /* Tells if the iteration passes if the base and the reference 117 * texture are a match (true), or if it should only pass if 118 * contents of the textures are different. */ 119 bool use_clientside_index_data; /* Tells if the index data should be taken from a client-side 120 * buffer, or from a VBO */ 121 bool use_clientside_vertex_data; /* Tells if the vertex (color & position) data should be taken 122 * from a client-side buffer, or from a VBO */ 123 bool use_geometry_shader_stage; /* Tells if the program object used for the iteration should 124 * include geometry shader */ 125 bool use_tessellation_shader_stage; /* Tells if the program object used for the iteration should 126 * include tessellation control & evaluation shaders. */ 127 bool use_vertex_attrib_binding; /* Tells if the iteration should use vertex attribute bindings 128 * instead of setting vertex attribute arrays with 129 * glVertexAttribPointer() call(s) */ 130 bool use_overflow_test_vertices; 131 132 /** Constructor */ _test_caseglcts::DrawElementsBaseVertexTestBase::_test_case133 _test_case() 134 : basevertex(0) 135 , function_type(FUNCTION_COUNT) 136 , index_offset(NULL) 137 , index_type(0) 138 , range_start(0) 139 , range_end(0) 140 , primitive_mode((glw::GLenum)-1) 141 , regular_draw_call_offset(0) 142 , regular_draw_call_offset2(NULL) 143 , regular_draw_call_index_type(0) 144 , should_base_texture_match_reference_texture(false) 145 , use_clientside_index_data(false) 146 , use_clientside_vertex_data(false) 147 , use_geometry_shader_stage(false) 148 , use_tessellation_shader_stage(false) 149 , use_vertex_attrib_binding(false) 150 , use_overflow_test_vertices(false) 151 { 152 memset(multi_draw_call_count_array, 0, sizeof(multi_draw_call_count_array)); 153 memset(multi_draw_call_indices_array, 0, sizeof(multi_draw_call_indices_array)); 154 memset(regular_multi_draw_call_offseted_array, 0, sizeof(regular_multi_draw_call_offseted_array)); 155 } 156 } _test_case; 157 158 /** Type definitions for test case container */ 159 typedef std::vector<_test_case> _test_cases; 160 typedef _test_cases::const_iterator _test_cases_const_iterator; 161 typedef _test_cases::iterator _test_cases_iterator; 162 163 /* Protected methods */ 164 void compareBaseAndReferenceTextures(bool should_be_equal); 165 166 void computeVBODataOffsets(bool use_clientside_index_data, bool use_clientside_vertex_data); 167 168 virtual void deinit(); 169 170 void executeTestCases(); 171 172 std::string getFunctionName(_function_type function_type); 173 174 virtual void init(); 175 176 void setUpFunctionalTestObjects(bool use_clientside_vertex_data, bool use_clientside_index_data, 177 bool use_tessellation_shader_stage, bool use_geometry_shader_stage, 178 bool use_vertex_attrib_binding, bool use_overflow_test_vertices); 179 180 virtual void deinitPerTestObjects(); 181 182 void setUpNegativeTestObjects(bool use_clientside_vertex_data, bool use_clientside_index_data); 183 184 /* Protected variables */ 185 bool m_is_draw_elements_base_vertex_supported; /* Corresponds to GL_EXT_draw_elements_base_vertex availability 186 * under ES contexts and to GL_ARB_draw_elements_base_vertex 187 * availability under GL contexts. 188 */ 189 bool m_is_ext_multi_draw_arrays_supported; /* Corresponds to GL_EXT_multi_draw_arrays availability under 190 * both ES and GL contexts. 191 */ 192 bool m_is_geometry_shader_supported; /* Corresponds to GL_EXT_geometry_shader availability under 193 * ES contexts and to GL_ARB_geometry_shader4 availability under 194 * GL contexts. 195 */ 196 bool m_is_tessellation_shader_supported; /* Corresponds to GL_EXT_tessellation_shader availability under 197 * ES contexts and to GL_ARB_tessellation_shader availability 198 * under GL contexts. 199 */ 200 bool m_is_vertex_attrib_binding_supported; /* Corresponds to GL_ARB_vertex_attrib_binding availability under 201 * GL contexts. Under ES always set to true, since the conformance 202 * tests are only run for >= ES 3.1 contexts, where VAA bindings 203 * are core functionality. 204 */ 205 206 glw::GLuint m_bo_id; 207 glw::GLuint m_bo_id_2; 208 glw::GLuint m_fbo_id; 209 glw::GLuint m_fs_id; 210 glw::GLuint m_gs_id; 211 glw::GLuint m_po_id; 212 glw::GLint m_po_color_attribute_location; 213 bool m_po_uses_gs_stage; 214 bool m_po_uses_tc_te_stages; 215 bool m_po_uses_vertex_attrib_binding; 216 glw::GLint m_po_vertex_attribute_location; 217 glw::GLuint m_tc_id; 218 glw::GLuint m_te_id; 219 glw::GLuint m_to_base_id; 220 glw::GLuint m_to_ref_id; 221 glw::GLuint m_vao_id; 222 glw::GLuint m_vs_id; 223 224 const glw::GLuint* m_bo_functional2_data_index; /* Holds functional second index data set data */ 225 unsigned int m_bo_functional2_data_index_size; /* Holds size of functional second index data set */ 226 const glw::GLfloat* m_bo_functional2_data_vertex; /* Holds functional second vertex data set data */ 227 unsigned int m_bo_functional2_data_vertex_size; /* Holds size of functional second vertex data set */ 228 const glw::GLubyte* m_bo_functional3_data_index; /* Holds functional third index data set data */ 229 unsigned int m_bo_functional3_data_index_size; /* Holds size of functional third index data set */ 230 const glw::GLushort* m_bo_functional4_data_index; /* Holds functional fourth index data set data */ 231 unsigned int m_bo_functional4_data_index_size; /* Holds size of functional fourth index data set */ 232 const glw::GLuint* m_bo_functional5_data_index; /* Holds functional fifth index data set data */ 233 unsigned int m_bo_functional5_data_index_size; /* Holds size of functional fifth index data set */ 234 const glw::GLfloat* m_bo_functional_data_color; /* Holds functional first color data set data */ 235 unsigned int m_bo_functional_data_color_size; /* Holds size of functional first color data set */ 236 const glw::GLuint* m_bo_functional_data_index; /* Holds functional first index data set data */ 237 unsigned int m_bo_functional_data_index_size; /* Holds size of functional first index data set */ 238 const glw::GLfloat* m_bo_functional_data_vertex; /* Holds functional first vertex data set data */ 239 unsigned int m_bo_functional_data_vertex_size; /* Holds size of functional first vertex data set */ 240 const glw::GLuint* m_bo_negative_data_index; /* Holds negative index data set data */ 241 unsigned int m_bo_negative_data_index_size; /* Holds size of negative index data set */ 242 const glw::GLfloat* m_bo_negative_data_vertex; /* Holds negative vertex data set data */ 243 unsigned int m_bo_negative_data_vertex_size; /* Holds size of negative vertex data set */ 244 const glw::GLfloat* m_draw_call_color_offset; /* Either holds buffer object storage offset to color data set OR 245 * is a raw pointer to the color data store. Actual contents 246 * is iteration-dependent */ 247 const glw::GLuint* m_draw_call_index_offset; /* Either holds buffer object storage offset to first index data set OR 248 * is a raw pointer to the index data store. Actual contents 249 * is iteration-dependent */ 250 const glw::GLuint* 251 m_draw_call_index2_offset; /* Either holds buffer object storage offset to second index data set OR 252 * is a raw pointer to the index data store. Actual contents 253 * is iteration-dependent */ 254 const glw::GLubyte* 255 m_draw_call_index3_offset; /* Either holds buffer object storage offset to third index data set OR 256 * is a raw pointer to the index data store. Actual contents 257 * is iteration-dependent */ 258 const glw::GLushort* 259 m_draw_call_index4_offset; /* Either holds buffer object storage offset to fourth index data set OR 260 * is a raw pointer to the index data store. Actual contents 261 * is iteration-dependent */ 262 const glw::GLuint* 263 m_draw_call_index5_offset; /* Either holds buffer object storage offset to fifth index data set OR 264 * is a raw pointer to the index data store. Actual contents 265 * is iteration-dependent */ 266 const glw::GLfloat* 267 m_draw_call_vertex_offset; /* Either holds buffer object storage offset to first vertex data set OR 268 * is a raw pointer to the first vertex data store. Actual contents 269 * is iteration-dependent */ 270 const glw::GLfloat* 271 m_draw_call_vertex2_offset; /* Either holds buffer object storage offset to second vertex data set OR 272 * is a raw pointer to the second vertex data store. Actual contents 273 * is iteration-dependent */ 274 275 _test_cases m_test_cases; /* Holds all test cases */ 276 277 private: 278 /* Private methods */ 279 void buildProgram(const char* fs_code, const char* vs_code, const char* tc_code, const char* te_code, 280 const char* gs_code); 281 void deinitProgramAndShaderObjects(); 282 283 /* Private data */ 284 const unsigned int m_to_height; 285 const unsigned int m_to_width; 286 287 unsigned char* m_to_base_data; 288 unsigned char* m_to_ref_data; 289 }; 290 291 /** Implements functional Tests I, II, III and IV. For clarity, the description 292 * of these functional tests is included below. 293 * 294 * (note: the description below refers to ES entry-points, but these are 295 * replaced with GL equivalents under GL contexts) 296 * 297 * Functional Test I: 298 * 299 * I.1. Define vertex coordinates and corresponding indices array (as shown 300 * above). 301 * I.1.a. Render a triangle to texture using glDrawElementsBaseVertexEXT() 302 * call. Use '10' for the 'basevertex' argument value. Use process-side 303 * memory to store vertex coordinates and index data. Assert that 304 * data read from the result texture is the same as for reference texture. 305 * I.1.b. Repeat the test (I.1.a.) for glDrawRangeElementsBaseVertexEXT(). 306 * I.1.c. Repeat the test (I.1.a.) for glDrawElementsInstancedBaseVertexEXT(): 307 * draw 3 instances of triangle object, compare with a corresponding 308 * texture. 309 * I.1.d. If EXT_multi_draw_arrays extension is supported, repeat the test 310 * (I.1.a.) for glMultiDrawElementsBaseVertexEXT(). 311 * 312 * Functional Test II: 313 * 314 * II.1. Repeat the tests (I.1) using buffer object storing vertex coordinates 315 * attached to GL_ARRAY_BUFFER buffer binding point and client-side 316 * memory to store indices. 317 * II.2. Repeat the tests (I.1) using client-side memory to store vertex 318 * coordinates and a buffer object holding index data attached to 319 * GL_ELEMENT_ARRAY_BUFFER buffer binding point. 320 * II.3. Repeat the tests (I.1) using buffer object storing vertex coordinates 321 * attached to GL_ARRAY_BUFFER buffer binding point and 322 * a buffer object holding index data attached to GL_ELEMENT_ARRAY_BUFFER 323 * buffer binding point. 324 * 325 * Functional Test III: 326 * 327 * III.1. Repeat the tests (I.1 - II.3) using '0' for the 'basevertex' argument 328 * value. Assert that data read from the result texture differs from 329 * the reference texture. 330 * 331 * Functional Test IV: 332 * 333 * IV.1. Repeat the tests (I.1 - II.3) using '10' for 'basevertex' 334 * argument value, but this time use different indices array (values 335 * that should be used for element indices are: 10, 11, 12). Assert 336 * that data read from the result texture differs from the reference 337 * texture. 338 * 339 * 340 **/ 341 class DrawElementsBaseVertexFunctionalCorrectBaseVertexBehavior : public DrawElementsBaseVertexTestBase 342 { 343 public: 344 /* Public methods */ 345 DrawElementsBaseVertexFunctionalCorrectBaseVertexBehavior(Context& context, const ExtParameters& extParams); 346 347 virtual tcu::TestNode::IterateResult iterate(); 348 349 private: 350 /* Private methods */ 351 void setUpTestCases(); 352 }; 353 354 /** Implements Functional Test V. For clarity, the description is included below: 355 * 356 * (note: the description below refers to ES entry-points, but these are 357 * replaced with GL equivalents under GL contexts) 358 * 359 * V.1. Define new vertex coordinates array so that the triangle coordinates 360 * are placed at the beginning of the array (starting at element of index 361 * 0). The rest of the array should be filled with random values, but 362 * must not duplicate the requested triangle coordinates (as presented 363 * in the new_vertices array). 364 * V.1.a. Render a triangle to texture using glDrawElementsBaseVertexEXT() 365 * call. Use '5' for the 'basevertex' argument value. The client-side 366 * memory should be used to store vertex coordinates and client-side 367 * memory to store indices. Assert that data read from the result 368 * texture differs from the reference texture. 369 * V.1.b. Repeat the test (V.1.a.) for glDrawRangeElementsBaseVertexEXT(). 370 * V.1.c. Repeat the test (V.1.a.) for glDrawElementsInstancedBaseVertexEXT(): 371 * draw 3 instances of triangle object, compare with a corresponding 372 * texture. 373 * V.1.d. If EXT_multi_draw_arrays extension is supported, repeat the test 374 * (V.1.a.) for glMultiDrawElementsBaseVertexEXT(). 375 * V.2. Repeat the tests (V.1) using buffer object holding vertex coordinates 376 * data attached to GL_ARRAY_BUFFER buffer binding point and client-side 377 * memory to store indices. 378 * V.3. Repeat the tests (V.1) using client-side memory to store vertex 379 * coordinates and a buffer object holding index data attached to 380 * GL_ELEMENT_ARRAY_BUFFER buffer binding point. 381 * V.4. Repeat the tests (V.1) using buffer object holding vertex coordinates 382 * attached to GL_ARRAY_BUFFER buffer binding point and 383 * a buffer object holding index data attached to GL_ELEMENT_ARRAY_BUFFER 384 * buffer binding point. 385 * 386 */ 387 class DrawElementsBaseVertexFunctionalCorrectBaseVertexBehavior2 : public DrawElementsBaseVertexTestBase 388 { 389 public: 390 /* Public methods */ 391 DrawElementsBaseVertexFunctionalCorrectBaseVertexBehavior2(Context& context, const ExtParameters& extParams); 392 393 virtual tcu::TestNode::IterateResult iterate(); 394 395 private: 396 /* Private methods */ 397 void setUpTestCases(); 398 }; 399 400 /** Implements Functional Test VIII. For clarity, the description is included below: 401 * 402 * (note: the description below refers to ES entry-points, but these are 403 * replaced with GL equivalents under GL contexts) 404 * 405 * VIII.1. Test whether glDraw*BaseVertexEXT() works correctly when 406 * 'basevertex' parameter value is negative (however the condition 407 * "indices[i] + basevertex >= 0" must always be met, otherwise the 408 * behaviour is undefined and should not be tested). 409 * Use vertices array (as declared above) to store vertex coordinates 410 * data: triangle vertex coordinates are declared at the beginning 411 * of the array, the rest of the array is filled with random values. 412 * Index array should store 3 values: 10, 11, 12. 413 * VIII.1.a. Execute glDrawElementsBaseVertexEXT() using '-10' for the 414 * 'basevertex' argument value. Use data described in the example. 415 * Use client-side memory to store the index data. 416 * Assert that the result texture does not differ from a reference 417 * texture object (which we get by calling a simple glDrawArrays() 418 * command with the same settings as described for this test case). 419 * VIII.1.b. Repeat the tests (VIII.1.a.) for 420 * glDrawRangeElementsBaseVertexEXT(). 421 * VIII.1.c. Repeat the tests (VIII.1.a.) for 422 * glDrawElementsInstancedBaseVertexEXT(): 423 * draw 3 instances of triangle object, compare with a corresponding 424 * texture. 425 * VIII.1.d. If EXT_multi_draw_arrays extension is supported, repeat the test 426 * (VIII.1.a.) for glMultiDrawElementsBaseVertexEXT(). 427 * VIII.2. Repeat the tests (VIII.1) using a buffer object holding index data 428 * attached to GL_ELEMENT_ARRAY_BUFFER buffer binding point. 429 * 430 */ 431 class DrawElementsBaseVertexFunctionalCorrectBaseVertexBehaviorUnderflow : public DrawElementsBaseVertexTestBase 432 { 433 public: 434 /* Public methods */ 435 DrawElementsBaseVertexFunctionalCorrectBaseVertexBehaviorUnderflow(Context& context, 436 const ExtParameters& extParams); 437 438 virtual tcu::TestNode::IterateResult iterate(); 439 440 private: 441 /* Private methods */ 442 void setUpTestCases(); 443 }; 444 445 /** Implements Functional Test IX. For clarity, the description is included below: 446 * 447 * (note: the description below refers to ES entry-points, but these are 448 * replaced with GL equivalents under GL contexts) 449 * 450 * IX.1. Test whether glDraw*BaseVertexEXT() works correctly when 451 * ("indices[i]" + "basevertex") is larger than the maximum value 452 * representable by "type". 453 * Use vertices array (as declared above) to store vertex coordinates 454 * data: triangle vertex coordinates are declared at the beginning 455 * of the array, the rest of the array is filled with random values. 456 * Index array should store 3 values: 0, 1, 2. 457 * Use "basevertex" argument value that equals to (maximum value 458 * representable by a type + 1). 459 * IX.1.a. Execute glDrawElementsBaseVertexEXT() using 'basevertex' argument 460 * that equals to (maximum value representable by a type + 1). 461 * Use data described in the example. Use client-side memory to store 462 * the index data. 463 * Assert that the result texture does not differ from a reference 464 * texture object (which we get by calling a simple glDrawArrays() 465 * command with the same settings as described for this test case). 466 * The test should be executed for all of the types listed below: 467 * - GL_UNSIGNED_BYTE, 468 * - GL_UNSIGNED_SHORT. 469 * GL_UNSIGNED_INT is excluded from the test. 470 * IX.1.b. Repeat the tests (IX.1.a.) for 471 * glDrawRangeElementsBaseVertexEXT(). "start" and "end" should be 472 * equal to 0 and 3 accordingly. 473 * IX.1.c. Repeat the tests (IX.1.a.) for 474 * glDrawElementsInstancedBaseVertexEXT(): 475 * draw 3 instances of triangle object, compare with a corresponding 476 * texture. 477 * IX.1.d. If EXT_multi_draw_arrays extension is supported, repeat the test 478 * (IX.1.a.) for glMultiDrawElementsBaseVertexEXT(). 479 * IX.2. Repeat the tests (IX.1) using a buffer object holding index data 480 * attached to GL_ELEMENT_ARRAY_BUFFER buffer binding point. 481 * IX.3. Repeat the above tests (IX.1 - IX.2), but this time indices array 482 * should store 4 values: 0, 1, 2, 3. 'basevertex' argument should be 483 * equal to (maximum value representable by a type + 2). 484 * Assert that the result texture differs from a reference one. 485 * 486 */ 487 class DrawElementsBaseVertexFunctionalCorrectBaseVertexBehaviorOverflow : public DrawElementsBaseVertexTestBase 488 { 489 public: 490 /* Public methods */ 491 DrawElementsBaseVertexFunctionalCorrectBaseVertexBehaviorOverflow(Context& context, const ExtParameters& extParams); 492 493 virtual tcu::TestNode::IterateResult iterate(); 494 495 private: 496 /* Private methods */ 497 void setUpTestCases(); 498 }; 499 500 /** Implements Functional Test VI. For clarity, the description is included below: 501 * 502 * (note: the description below refers to ES entry-points, but these are 503 * replaced with GL equivalents under GL contexts) 504 * 505 * VI.1. If EXT_tessellation_shader extension is supported, test whether 506 * the tessellation works correctly when glDraw*BaseVertexEXT() 507 * entry-points are used. 508 * Draw a single patch consisting of 3 patch vertices. In Tessellation 509 * Control shader, set gl_TessLevelInner[0], gl_TessLevelOuter[1], 510 * gl_TessLevelOuter[2] to 3. 511 * In the Tessellation Evaluation shader, define 512 * layout(triangles, equal_spacing, cw) in; 513 * Coordinates generated by the tessellator should be stored in gl_Position, 514 * after having been adjusted to completely fit the screen space. 515 * Set different color for each vertex. As a result we expect 516 * a multi-colored triangle to be drawn into the result texture. 517 * VI.1.a. Execute glDrawElementsBaseVertexEXT() using '10' for the 'basevertex' 518 * argument value. Use data described in the example. Use client-side 519 * memory to store vertex coordinates and client-side memory to store 520 * indices. Assert that the result texture does not differ from reference 521 * texture (which we get by calling a simple glDrawArrays() command with 522 * the same settings as described for this test case). 523 * VI.1.b. Repeat the tests (VI.1.a.) for 524 * glDrawRangeElementsBaseVertexEXT(). 525 * VI.1.c. Repeat the tests (VI.1.a.) for 526 * glDrawElementsInstancedBaseVertexEXT(): 527 * draw 3 instances of triangle object, compare with a corresponding 528 * texture. 529 * VI.1.d. If EXT_multi_draw_arrays extension is supported, repeat the test 530 * (VI.1.a.) for glMultiDrawElementsBaseVertexEXT(). 531 * VI.2. Repeat the tests (VI.1) using buffer object holding vertex 532 * coordinates attached to GL_ARRAY_BUFFER buffer binding point and 533 * client-side memory to store indices. 534 * VI.3. Repeat the tests (VI.1) using client-side memory to store vertex 535 * coordinates and a buffer object holding index data attached to 536 * GL_ELEMENT_ARRAY_BUFFER buffer binding point. 537 * VI.4. Repeat the tests (VI.1) using buffer object holding vertex 538 * coordinates attached to GL_ARRAY_BUFFER buffer binding point and 539 * a buffer object holding index data attached to 540 * GL_ELEMENT_ARRAY_BUFFER buffer binding point. 541 * VI.5. Repeat the tests (VI.1 - VI.4) using '0' for the 'basevertex' 542 * argument value. Assert that data read from the result texture 543 * differs from the reference texture. 544 * VI.6 Add Geometry Shader Execution step before the fragment operation 545 * are handled. The shader should output input triangles, with negated 546 * y component. Repeat tests (VI.1 - VI.5). 547 * The new reference texture should be prepared (a multi-colored triangle 548 * rendered based on the assumption described in the test case, with 549 * a simple glDrawArrays() call). 550 * 551 */ 552 class DrawElementsBaseVertexFunctionalCorrectBaseVertexBehaviorAEPShaderStages : public DrawElementsBaseVertexTestBase 553 { 554 public: 555 /* Public methods */ 556 DrawElementsBaseVertexFunctionalCorrectBaseVertexBehaviorAEPShaderStages(Context& context, 557 const ExtParameters& extParams); 558 559 virtual tcu::TestNode::IterateResult iterate(); 560 561 private: 562 /* Private methods */ 563 void setUpTestCases(); 564 }; 565 566 /** Implements Negative Test IV. For clarity, the description is included below: 567 * 568 * (note: the description below refers to ES entry-points, but these are 569 * replaced with GL equivalents under GL contexts) 570 * 571 * IV.1. Check if proper error code is generated when transform feedback is 572 * active and not paused. 573 * IV.1.a. Generate, bind and begin transform feedback prepared to record 574 * GL_TRIANGLES type of primitives. Execute glDrawElementsBaseVertexEXT() 575 * as shown in the description. Expect GL_INVALID_OPERATION to be 576 * generated. 577 * IV.1.b. Repeat the test (IV.1.a.) for glDrawRangeElementsBaseVertexEXT(). 578 * IV.1.c. Repeat the test (IV.1.a.) for glDrawElementsInstancedBaseVertexEXT(). 579 * 580 */ 581 class DrawElementsBaseVertexNegativeActiveTransformFeedbackTest : public DrawElementsBaseVertexTestBase 582 { 583 public: 584 /* Public methods */ 585 DrawElementsBaseVertexNegativeActiveTransformFeedbackTest(Context& context, const ExtParameters& extParams); 586 587 virtual void deinit(); 588 virtual void init(); 589 virtual tcu::TestNode::IterateResult iterate(); 590 591 private: 592 /* Private variables */ 593 glw::GLuint m_bo_tf_result_id; 594 595 /* Private methods */ 596 virtual void deinitPerTestObjects(); 597 }; 598 599 /** Implements Negative Test I.2 and II.1, II.2, II.3 (for the original test). 600 * For clarity, the description is included below: 601 * 602 * (note: the description below refers to ES entry-points, but these are 603 * replaced with GL equivalents under GL contexts) 604 * 605 * I.2. Check if proper error code is generated when 'count' argument is 606 * invalid. 607 * I.2.a. Prepare the environment as described above. Execute 608 * glDrawElementsBaseVertexEXT() using '-1' as 'count' argument value. 609 * Expect GL_INVALID_VALUE error to be generated. 610 * I.2.b. Repeat the test (I.2.a.) for glDrawRangeElementsBaseVertexEXT(). 611 * I.2.c. Repeat the test (I.2.a.) for glDrawElementsInstancedBaseVertexEXT(). 612 * I.2.d. If EXT_multi_draw_arrays extension is supported, repeat the test 613 * (I.2.a.) for glMultiDrawElementsBaseVertexEXT(). 614 * 615 * II.1. Repeat the tests (I.1 - I.6) using client-side memory to store indices 616 * and buffer object storing vertex coordinates attached to 617 * GL_ARRAY_BUFFER buffer binding point. 618 * 619 * II.2. Repeat the tests (I.1 - I.6) when a buffer object holding index data 620 * is attached to GL_ELEMENT_ARRAY_BUFFER buffer binding point and 621 * client-side memory is used to store vertex coordinates. Replace 622 * value of 'indices' argument from the functions described above 623 * with NULL. 624 * 625 * II.3. Repeat the tests (I.1 - I.6) when a buffer object storing index data 626 * is attached to GL_ELEMENT_ARRAY_BUFFER buffer binding point and 627 * buffer object storing vertex coordinates data is attached to 628 * GL_ARRAY_BUFFER buffer binding point. 629 * Replace value of 'indices' argument from the functions described 630 * above with NULL. 631 */ 632 class DrawElementsBaseVertexNegativeInvalidCountArgumentTest : public DrawElementsBaseVertexTestBase 633 { 634 public: 635 /* Public methods */ 636 DrawElementsBaseVertexNegativeInvalidCountArgumentTest(Context& context, const ExtParameters& extParams); 637 638 virtual tcu::TestNode::IterateResult iterate(); 639 }; 640 641 /** Implements Negative Test I.6 and II.1, II.2, II.3 (for the original test). 642 * For clarity, the description for I.6 is included below. II.1, II.2 and II.3 643 * have already been cited above. 644 * 645 * (note: the description below refers to ES entry-points, but these are 646 * replaced with GL equivalents under GL contexts) 647 * 648 * I.6 Check if proper error code is generated when 'instancecount' argument 649 * value is invalid for glDrawElementsInstancedBaseVertexEXT() call. 650 * Prepare the environment as described above. The client-side memory 651 * should be used in the draw calls to store vertex coordinates and 652 * indices data. Execute glDrawElementsInstancedBaseVertexEXT() using 653 * '-1' for 'instancecount' argument value. Expect GL_INVALID_VALUE 654 * to be generated. 655 * 656 */ 657 class DrawElementsBaseVertexNegativeInvalidInstanceCountArgumentTest : public DrawElementsBaseVertexTestBase 658 { 659 public: 660 /* Public methods */ 661 DrawElementsBaseVertexNegativeInvalidInstanceCountArgumentTest(Context& context, const ExtParameters& extParams); 662 663 virtual tcu::TestNode::IterateResult iterate(); 664 }; 665 666 /** Implements Negative Test I.1 and II.1, II.2, II.3 (for the original test). 667 * For clarity, the description for I.1 is included below. II.1, II.2 and II.3 668 * have already been cited above. 669 * 670 * (note: the description below refers to ES entry-points, but these are 671 * replaced with GL equivalents under GL contexts) 672 * 673 * I.1. Check if proper error code is generated when 'mode' argument is 674 * invalid. The client-side memory should be used in the draw calls to 675 * store vertex coordinates and indices data. 676 * I.1.a. Prepare the environment as described above. Execute 677 * glDrawElementsBaseVertexEXT() using GL_NONE for 'mode' argument 678 * value. Expect GL_INVALID_ENUM error to be generated. 679 * I.1.b. Repeat the test (I.1.a.) for glDrawRangeElementsBaseVertexEXT(). 680 * I.1.c. Repeat the test (I.1.a.) for glDrawElementsInstancedBaseVertexEXT(). 681 * I.1.d. If EXT_multi_draw_arrays extension is supported, repeat the test 682 * (I.1.a.) for glMultiDrawElementsBaseVertexEXT(). 683 * 684 */ 685 class DrawElementsBaseVertexNegativeInvalidModeArgumentTest : public DrawElementsBaseVertexTestBase 686 { 687 public: 688 /* Public methods */ 689 DrawElementsBaseVertexNegativeInvalidModeArgumentTest(Context& context, const ExtParameters& extParams); 690 691 virtual tcu::TestNode::IterateResult iterate(); 692 }; 693 694 /** Implements Negative Test I.4 and II.1, II.2, II.3 (for the original test). 695 * For clarity, the description for I.4 is included below. II.1, II.2 and II.3 696 * have already been cited above. 697 * 698 * (note: the description below refers to ES entry-points, but these are 699 * replaced with GL equivalents under GL contexts) 700 * 701 * I.4 Check if proper error code is generated when 'primcount' argument is 702 * invalid. If EXT_multi_draw_arrays extension is supported, prepare 703 * the environment as described above, execute 704 * glMultiDrawElementsBaseVertexEXT() with negative 'primcount' value. 705 * The client-side memory should be used in the draw calls to store 706 * vertex coordinates and indices data. Expect GL_INVALID_VALUE error 707 * to be generated. 708 * 709 */ 710 class DrawElementsBaseVertexNegativeInvalidPrimcountArgumentTest : public DrawElementsBaseVertexTestBase 711 { 712 public: 713 /* Public methods */ 714 DrawElementsBaseVertexNegativeInvalidPrimcountArgumentTest(Context& context, const ExtParameters& extParams); 715 716 virtual tcu::TestNode::IterateResult iterate(); 717 }; 718 719 /** Implements Negative Test I.5 and II.1, II.2, II.3 (for the original test). 720 * For clarity, the description for I.5 is included below. II.1, II.2 and II.3 721 * have already been cited above. 722 * 723 * (note: the description below refers to ES entry-points, but these are 724 * replaced with GL equivalents under GL contexts) 725 * 726 * I.5 Check if proper error code is generated when 'start' and 'end' 727 * arguments combination is invalid for glDrawRangeElementsBaseVertexEXT() 728 * call. Prepare the environment as described above. Execute the 729 * glDrawRangeElementsBaseVertexEXT() using '3' for 'start' and '0' 730 * for 'end' argument values. The client-side memory should be used in the 731 * draw calls to store vertex coordinates and indices data. Expect 732 * GL_INVALID_VALUE to be generated. 733 * 734 */ 735 class DrawElementsBaseVertexNegativeInvalidStartEndArgumentsTest : public DrawElementsBaseVertexTestBase 736 { 737 public: 738 /* Public methods */ 739 DrawElementsBaseVertexNegativeInvalidStartEndArgumentsTest(Context& context, const ExtParameters& extParams); 740 741 virtual tcu::TestNode::IterateResult iterate(); 742 }; 743 744 /** Implements Negative Test I.3 and II.1, II.2, II.3 (for the original test). 745 * For clarity, the description for I.3 is included below. II.1, II.2 and II.3 746 * have already been cited above. 747 * 748 * (note: the description below refers to ES entry-points, but these are 749 * replaced with GL equivalents under GL contexts) 750 * 751 * I.3. Check if proper error code is generated when 'type' argument is 752 * invalid. The client-side memory should be used in the draw calls to 753 * store vertex coordinates and indices data. 754 * I.3.a. Prepare the environment as described above. Execute 755 * glDrawElementsBaseVertexEXT() using 'GL_NONE' as 'type' argument 756 * value. Expect GL_INVALID_ENUM error to be generated. 757 * I.3.b. Repeat the test (I.3.a.) for glDrawRangeElementsBaseVertexEXT(). 758 * I.3.c. Repeat the test (I.3.a.) for glDrawElementsInstancedBaseVertexEXT(). 759 * I.3.d. If EXT_multi_draw_arrays extension is supported, repeat the test 760 * (I.3.a.) for glMultiDrawElementsBaseVertexEXT(). 761 * 762 */ 763 class DrawElementsBaseVertexNegativeInvalidTypeArgumentTest : public DrawElementsBaseVertexTestBase 764 { 765 public: 766 /* Public methods */ 767 DrawElementsBaseVertexNegativeInvalidTypeArgumentTest(Context& context, const ExtParameters& extParams); 768 769 virtual tcu::TestNode::IterateResult iterate(); 770 }; 771 772 /** Implements Negative Test III. For clarity, the description is included below: 773 * 774 * (note: the description below refers to ES entry-points, but these are 775 * replaced with GL equivalents under GL contexts) 776 * 777 * III.1. Check if proper error code is generated when element array buffer 778 * object is mapped for the draw call. 779 * III.1.a. Call glMapBufferRange() to map the element array buffer object 780 * that stores vertex indices used in the draw call. Execute 781 * glDrawElementsBaseVertexEXT() as shown in the description using 782 * element array buffer object as a vertex indices data source 783 * (the buffer object which is currently mapped). The client-side 784 * memory should be used to store vertex coordinates. Expect 785 * GL_INVALID_OPERATION to be generated. 786 * III.1.b. Repeat the test (III.1.a.) for glDrawRangeElementsBaseVertexEXT(). 787 * III.1.c. Repeat the test (III.1.a.) for glDrawElementsInstancedBaseVertexEXT(). 788 * III.1.d. Repeat the test (III.1.a - III.1.c) with buffer object holding 789 * vertex coordinates attached to GL_ARRAY_BUFFER buffer binding point. 790 * 791 */ 792 class DrawElementsBaseVertexNegativeMappedBufferObjectsTest : public DrawElementsBaseVertexTestBase 793 { 794 public: 795 /* Public methods */ 796 DrawElementsBaseVertexNegativeMappedBufferObjectsTest(Context& context, const ExtParameters& extParams); 797 798 virtual tcu::TestNode::IterateResult iterate(); 799 }; 800 801 /** Test group which encapsulates all conformance tests for "draw elements base vertex" 802 * functionality. 803 */ 804 class DrawElementsBaseVertexTests : public glcts::TestCaseGroupBase 805 { 806 public: 807 /* Public methods */ 808 DrawElementsBaseVertexTests(glcts::Context& context, const ExtParameters& extParams); 809 810 void init(void); 811 812 private: 813 DrawElementsBaseVertexTests(const DrawElementsBaseVertexTests& other); 814 DrawElementsBaseVertexTests& operator=(const DrawElementsBaseVertexTests& other); 815 }; 816 817 } /* glcts namespace */ 818 819 #endif // _ESEXTCDRAWELEMENTSBASEVERTEXTESTS_HPP 820