1 #ifndef _GL4CMULTIBINDTESTS_HPP 2 #define _GL4CMULTIBINDTESTS_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 * \file gl4cMultiBindTests.hpp 28 * \brief Declares test classes for "Multi Bind" functionality. 29 */ /*-------------------------------------------------------------------*/ 30 31 #include "glcTestCase.hpp" 32 #include "glwDefs.hpp" 33 34 namespace gl4cts 35 { 36 namespace MultiBind 37 { 38 /** Implementation of test ErrorsBindBuffers. Description follows: 39 * 40 * Verifies that BindBuffersBase and BindBuffersRange commands generate errors 41 * as expected: 42 * - INVALID_ENUM when <target> is not valid; 43 * - INVALID_OPERATION when <first> + <count> is greater than allowed limit; 44 * - INVALID_OPERATION if any value in <buffers> is not zero or the name of 45 * existing buffer; 46 * - INVALID_VALUE if any value in <offsets> is less than zero; 47 * - INVALID_VALUE if any pair of <offsets> and <sizes> exceeds limits. 48 **/ 49 class ErrorsBindBuffersTest : public deqp::TestCase 50 { 51 public: 52 /* Public methods */ 53 ErrorsBindBuffersTest(deqp::Context& context); 54 ~ErrorsBindBuffersTest()55 virtual ~ErrorsBindBuffersTest() 56 { 57 } 58 59 /* Public methods inherited from TestCase */ 60 virtual tcu::TestNode::IterateResult iterate(void); 61 }; 62 63 /** Implementation of test ErrorsBindTextures. Description follows: 64 * 65 * Verifies that BindTextures generate errors as expected: 66 * - INVALID_OPERATION when <first> + <count> exceed limits; 67 * - INVALID_OPERATION if any value in <textures> is not zero or name of 68 * existing texture. 69 **/ 70 class ErrorsBindTexturesTest : public deqp::TestCase 71 { 72 public: 73 /* Public methods */ 74 ErrorsBindTexturesTest(deqp::Context& context); 75 ~ErrorsBindTexturesTest()76 virtual ~ErrorsBindTexturesTest() 77 { 78 } 79 80 /* Public methods inherited from TestCase */ 81 virtual tcu::TestNode::IterateResult iterate(void); 82 }; 83 84 /** Implementation of test ErrorsBindSamplers. Description follows: 85 * 86 * Verifies that BindSamplers generate errors as expected: 87 * - INVALID_OPERATION when <first> + <count> exceed limits; 88 * - INVALID_OPERATION if any value in <samplers> is not zero or name of 89 * existing texture. 90 **/ 91 class ErrorsBindSamplersTest : public deqp::TestCase 92 { 93 public: 94 /* Public methods */ 95 ErrorsBindSamplersTest(deqp::Context& context); 96 ~ErrorsBindSamplersTest()97 virtual ~ErrorsBindSamplersTest() 98 { 99 } 100 101 /* Public methods inherited from TestCase */ 102 virtual tcu::TestNode::IterateResult iterate(void); 103 }; 104 105 /** Implementation of test ErrorsBindImageTextures. Description follows: 106 * 107 * Verifies that BindImageTextures generate errors as expected: 108 * - INVALID_OPERATION when <first> + <count> exceed limits; 109 * - INVALID_OPERATION if any value in <textures> is not zero or name of 110 * existing texture; 111 * - INVALID_OPERATION if any entry found in <textures> has invalid internal 112 * format at level 0; 113 * - INVALID_OPERATION when any entry in <textures> has any of dimensions equal 114 * to 0 at level 0. 115 **/ 116 class ErrorsBindImageTexturesTest : public deqp::TestCase 117 { 118 public: 119 /* Public methods */ 120 ErrorsBindImageTexturesTest(deqp::Context& context); 121 ~ErrorsBindImageTexturesTest()122 virtual ~ErrorsBindImageTexturesTest() 123 { 124 } 125 126 /* Public methods inherited from TestCase */ 127 virtual tcu::TestNode::IterateResult iterate(void); 128 }; 129 130 /** Implementation of test ErrorsBindVertexBuffers. Description follows: 131 * 132 * Verifies that BindVertexBuffers generate errors as expected: 133 * - INVALID_OPERATION when <first> + <count> exceeds limits; 134 * - INVALID_OPERATION if any value in <buffers> is not zero or the name of 135 * existing buffer; 136 * - INVALID_VALUE if any value in <offsets> or <strides> is less than zero. 137 **/ 138 class ErrorsBindVertexBuffersTest : public deqp::TestCase 139 { 140 public: 141 /* Public methods */ 142 ErrorsBindVertexBuffersTest(deqp::Context& context); 143 ~ErrorsBindVertexBuffersTest()144 virtual ~ErrorsBindVertexBuffersTest() 145 { 146 } 147 148 /* Public methods inherited from TestCase */ 149 virtual tcu::TestNode::IterateResult iterate(void); 150 }; 151 152 /** Implementation of test FunctionalBindBuffersBase. Description follows: 153 * 154 * Verifies that BindBuffersBase works as expected. 155 * 156 * Steps to be done for each valid target: 157 * - prepare MAX buffers with some store, where MAX is the maximum supported 158 * amount of bindings points for tested target; 159 * 160 * - execute BindBufferBase to bind all buffers to tested target; 161 * - inspect if bindings were modified; 162 * 163 * - execute BindBufferBase for first half of bindings with NULL as <buffers> 164 * to unbind first half of bindings for tested target; 165 * - inspect if bindings were modified; 166 * - execute BindBufferBase for second half of bindings with NULL as <buffers> 167 * to unbind rest of bindings; 168 * - inspect if bindings were modified; 169 * 170 * - change <buffers> so first entry is invalid; 171 * - execute BindBufferBase to bind all buffers to tested target; It is 172 * expected that INVALID_OPERATION will be generated; 173 * - inspect if all bindings but first were modified; 174 * 175 * - bind any buffer to first binding; 176 * - execute BindBufferBase for 0 as <first>, 1 as <count> and <buffers> filled 177 * with zeros to unbind 1st binding for tested target; 178 * - inspect if bindings were modified; 179 * 180 * - unbind all buffers. 181 **/ 182 class FunctionalBindBuffersBaseTest : public deqp::TestCase 183 { 184 public: 185 /* Public methods */ 186 FunctionalBindBuffersBaseTest(deqp::Context& context); 187 ~FunctionalBindBuffersBaseTest()188 virtual ~FunctionalBindBuffersBaseTest() 189 { 190 } 191 192 /* Public methods inherited from TestCase */ 193 virtual tcu::TestNode::IterateResult iterate(void); 194 }; 195 196 /** Implementation of test FunctionalBindBuffersRange. Description follows: 197 * 198 * Verifies that BindBuffersRange works as expected. 199 * 200 * Steps to be done for each valid target: 201 * - prepare MAX buffers with some store, where MAX is the maximum supported 202 * amount of bindings points for tested target; 203 * 204 * - execute BindBufferRange to bind all buffers to tested target; 205 * - inspect if bindings were modified; 206 * 207 * - execute BindBufferRange for first half of bindings with NULL as <buffers> 208 * to unbind first half of bindings for tested target; 209 * - inspect if bindings were modified; 210 * - execute BindBufferRange for second half of bindings with NULL as <buffers> 211 * to unbind rest of bindings for tested target; 212 * - inspect if bindings were modified; 213 * 214 * - change <buffers> so first entry is invalid; 215 * - execute BindBufferRange to bind all buffers to tested target; It is 216 * expected that INVALID_OPERATION will be generated; 217 * - inspect if all bindings but first were modified; 218 * 219 * - bind any buffer to first binding; 220 * - execute BindBufferRange for 0 as <first>, 1 as <count> and <buffers> 221 * filled with zeros to unbind first binding for tested target; 222 * - inspect if bindings were modified; 223 * 224 * - unbind all buffers. 225 **/ 226 class FunctionalBindBuffersRangeTest : public deqp::TestCase 227 { 228 public: 229 /* Public methods */ 230 FunctionalBindBuffersRangeTest(deqp::Context& context); 231 ~FunctionalBindBuffersRangeTest()232 virtual ~FunctionalBindBuffersRangeTest() 233 { 234 } 235 236 /* Public methods inherited from TestCase */ 237 virtual tcu::TestNode::IterateResult iterate(void); 238 }; 239 240 /** Implementation of test FunctionalBindTextures. Description follows: 241 * 242 * Verify that BindTextures works as expected. 243 * 244 * Steps: 245 * - prepare MAX_COMBINED_TEXTURE_IMAGE_UNITS textures with some store; 246 * Use all valid texture targets; 247 * 248 * - execute BindTextures to bind all textures; 249 * - inspect bindings of all texture units to verify that proper bindings were 250 * set; 251 * 252 * - execute BindTextures for the first half of units with <textures> filled 253 * with zeros, to unbind those units; 254 * - inspect bindings of all texture units to verify that proper bindings were 255 * unbound; 256 * 257 * - execute BindTextures for the second half of units with NULL as<textures>, 258 * to unbind those units; 259 * - inspect bindings of all texture units to verify that proper bindings were 260 * unbound; 261 * 262 * - modify <textures> so first entry is invalid; 263 * - execute BindTextures to bind all textures; It is expected that 264 * INVALID_OPERATION will be generated; 265 * - inspect bindings of all texture units to verify that proper bindings were 266 * set; 267 * 268 * - unbind all textures. 269 **/ 270 class FunctionalBindTexturesTest : public deqp::TestCase 271 { 272 public: 273 /* Public methods */ 274 FunctionalBindTexturesTest(deqp::Context& context); 275 ~FunctionalBindTexturesTest()276 virtual ~FunctionalBindTexturesTest() 277 { 278 } 279 280 /* Public methods inherited from TestCase */ 281 virtual tcu::TestNode::IterateResult iterate(void); 282 }; 283 284 /** Implementation of test FunctionalBindSamplers. Description follows: 285 * 286 * Verify that BindSamplers works as expected. 287 * 288 * Steps: 289 * - prepare MAX_COMBINED_TEXTURE_IMAGE_UNITS samplers; 290 * 291 * - execute BindSamplers to bind all samplers; 292 * - inspect bindings to verify that proper samplers were set; 293 * 294 * - execute BindSamplers for first half of bindings with <samplers> filled 295 * with zeros, to unbind those samplers; 296 * - inspect bindings to verify that proper samplers were unbound; 297 * 298 * - execute BindSamplers for second half of bindings with NULL as <samplers>, 299 * to unbind those samplers; 300 * - inspect bindings to verify that proper samplers were unbound; 301 * 302 * - modify <samplers> so first entry is invalid; 303 * - execute BindSamplers to bind all samplers; It is expected that 304 * INVALID_OPERATION will be generated; 305 * - inspect bindings to verify that proper samplers were set; 306 * 307 * - unbind all samplers. 308 **/ 309 class FunctionalBindSamplersTest : public deqp::TestCase 310 { 311 public: 312 /* Public methods */ 313 FunctionalBindSamplersTest(deqp::Context& context); 314 ~FunctionalBindSamplersTest()315 virtual ~FunctionalBindSamplersTest() 316 { 317 } 318 319 /* Public methods inherited from TestCase */ 320 virtual tcu::TestNode::IterateResult iterate(void); 321 }; 322 323 /** Implementation of test FunctionalBindImageTextures. Description follows: 324 * 325 * Verify that BindImageTextures works as expected. 326 * 327 * Steps: 328 * - prepare MAX_IMAGE_UNITS textures; Use TEXTURE_1D, TEXTURE_1D_ARRAY, 329 * TEXTURE_2D, TEXTURE_2D_ARRAY, TEXTURE_3D, TEXTURE_BUFFER, TEXTURE_CUBE_MAP 330 * and TEXTURE_CUBE_MAP_ARRAY; If possible use rest of targets; 331 * 332 * - execute BindImageTextures to bind all images; 333 * - inspect bindings to verify that proper images were set; 334 * 335 * - execute BindImageTextures for first half of units with <textures> filled 336 * with zeros, to unbind those images; 337 * - inspect bindings to verify that proper images were unbound; 338 * 339 * - execute BindImageTextures for second half of bindings with NULL as <samples>, 340 * to unbind those images; 341 * - inspect bindings to verify that proper images were unbound; 342 * 343 * - modify <textures> so first entry is invalid; 344 * - execute BindImageTextures to bind all textures; It is expected that 345 * INVALID_OPERATION will be generated; 346 * - inspect bindings to verify that proper images were set; 347 * 348 * - unbind all images. 349 **/ 350 class FunctionalBindImageTexturesTest : public deqp::TestCase 351 { 352 public: 353 /* Public methods */ 354 FunctionalBindImageTexturesTest(deqp::Context& context); 355 ~FunctionalBindImageTexturesTest()356 virtual ~FunctionalBindImageTexturesTest() 357 { 358 } 359 360 /* Public methods inherited from TestCase */ 361 virtual tcu::TestNode::IterateResult iterate(void); 362 }; 363 364 /** Implementation of test FunctionalBindVertexBuffers. Description follows: 365 * 366 * Verify that BindVertexBuffers works as expected. 367 * 368 * Steps: 369 * - prepare MAX_VERTEX_ATTRIB_BINDINGS buffers; 370 * 371 * - execute BindVertexBuffers to bind all buffer; 372 * - inspect bindings to verify that proper buffers were set; 373 * 374 * - execute BindVertexBuffers for first half of bindings with <buffers> filled 375 * with zeros, to unbind those buffers; 376 * - inspect bindings to verify that proper buffers were unbound; 377 * 378 * - execute BindVertexBuffers for second half of bindings with NULL as 379 * <buffers>, to unbind those buffers; 380 * - inspect bindings to verify that proper buffers were unbound; 381 * 382 * - modify <buffers> so first entry is invalid; 383 * - execute BindVertexBuffers to bind all buffers; It is expected that 384 * INVALID_OPERATION will be generated; 385 * - inspect bindings to verify that proper buffers were set; 386 * 387 * - unbind all buffers. 388 **/ 389 class FunctionalBindVertexBuffersTest : public deqp::TestCase 390 { 391 public: 392 /* Public methods */ 393 FunctionalBindVertexBuffersTest(deqp::Context& context); 394 ~FunctionalBindVertexBuffersTest()395 virtual ~FunctionalBindVertexBuffersTest() 396 { 397 } 398 399 /* Public methods inherited from TestCase */ 400 virtual tcu::TestNode::IterateResult iterate(void); 401 }; 402 403 /** Implementation of test DispatchBindBuffersBase. Description follows: 404 * 405 * Verifies that BindBuffersBase command works as expected. 406 * 407 * In compute shader declare the GL_MAX_COMPUTE_UNIFORM_BLOCKS uniform blocks: 408 * 409 * layout(std140, binding = 0) uniform B1 {vec4 a;} b1; 410 * layout(std140, binding = 0) uniform B2 {vec4 a;} b2; 411 * 412 * ... 413 * 414 * layout(std140, binding = (GL_MAX_COMPUTE_UNIFORM_BLOCKS-1)) uniform BX { 415 * vec4 a; 416 * } bx; 417 * 418 * The shader should sum b1.a, b2.a + ... + bx.a and store result in shader 419 * storage buffer. 420 * 421 * In test program, create GL_MAX_COMPUTE_UNIFORM_BLOCKS buffers, bind them 422 * using BindBuffersBase to B1 ... BX blocks, fill them with unique values. 423 * Create and bind shader storage buffer for result. Dispatch compute shader. 424 * 425 * Test pass if the result is correct. 426 **/ 427 class DispatchBindBuffersBaseTest : public deqp::TestCase 428 { 429 public: 430 /* Public methods */ 431 DispatchBindBuffersBaseTest(deqp::Context& context); 432 ~DispatchBindBuffersBaseTest()433 virtual ~DispatchBindBuffersBaseTest() 434 { 435 } 436 437 /* Public methods inherited from TestCase */ 438 virtual tcu::TestNode::IterateResult iterate(void); 439 }; 440 441 /** Implementation of test DispatchBindBuffersRange. Description follows: 442 * 443 * Verifies that BindBuffersRange command works as expected. 444 * 445 * In compute shader create the 4 of uniform blocks: 446 * 447 * layout(std140, binding = 0) uniform B1 {int a;} b1; 448 * layout(std140, binding = 1) uniform B2 {int a;} b2; 449 * layout(std140, binding = 2) uniform B4 {int a;} b3; 450 * layout(std140, binding = 3) uniform B4 {int a;} b4; 451 * 452 * The shader should be sum b1.a b2.a, b3.a b4.a and store result in shader 453 * storage buffer. 454 * 455 * 456 * In test program, create the buffer filled with the following 7 bytes: 457 * 458 * { 0x00 0x01 0x00 0x01 0x00 0x01 0x00 } 459 * 460 * Bind buffer with BindBuffersRange with the following parameters: 461 * - <target> GL_UNIFORM_BUFFER 462 * - <first> 0 463 * - <count> 4 464 * - <buffers> { ID, ID, ID, ID }, 465 * - <offsets> { 0, 1, 2, 3 }, 466 * - <sizes> { 4, 4, 4, 4 }. 467 * 468 * Create and bind shader storage buffer for result. Dispatch compute shader. 469 * 470 * Test pass if the result is 0x02020202. 471 **/ 472 class DispatchBindBuffersRangeTest : public deqp::TestCase 473 { 474 public: 475 /* Public methods */ 476 DispatchBindBuffersRangeTest(deqp::Context& context); 477 ~DispatchBindBuffersRangeTest()478 virtual ~DispatchBindBuffersRangeTest() 479 { 480 } 481 482 /* Public methods inherited from TestCase */ 483 virtual tcu::TestNode::IterateResult iterate(void); 484 }; 485 486 /** Implementation of test DispatchBindTextures. Description follows: 487 * 488 * Verifies that BindTextures command works as expected. 489 * 490 * Modify DispatchBindBuffersBase test in the following aspects: 491 * - use R32UI textures instead of uniform blocks; 492 * - use GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS textures; 493 * - use all texture targets; 494 * - use 1x1x1 textures, sample point (0.5, 0.5, 0.5). 495 **/ 496 class DispatchBindTexturesTest : public deqp::TestCase 497 { 498 public: 499 /* Public methods */ 500 DispatchBindTexturesTest(deqp::Context& context); ~DispatchBindTexturesTest()501 virtual ~DispatchBindTexturesTest() 502 { 503 } 504 505 /* Public methods inherited from TestCase */ 506 virtual tcu::TestNode::IterateResult iterate(void); 507 }; 508 509 /** Implementation of test DispatchBindImageTextures. Description follows: 510 * 511 * Verifies that BindImageTextures command works as expected. 512 * 513 * Modify DispatchBindTextures test in the following aspects: 514 * - use image units instead of texture units. 515 **/ 516 class DispatchBindImageTexturesTest : public deqp::TestCase 517 { 518 public: 519 /* Public methods */ 520 DispatchBindImageTexturesTest(deqp::Context& context); 521 ~DispatchBindImageTexturesTest()522 virtual ~DispatchBindImageTexturesTest() 523 { 524 } 525 526 /* Public methods inherited from TestCase */ 527 virtual tcu::TestNode::IterateResult iterate(void); 528 }; 529 530 /** Implementation of test DispatchBindSamplers. Description follows: 531 * 532 * Verifies that BindSamplers command works as expected. 533 * 534 * Prepare GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 8x8 2D R32UI textures filled so 535 * the edges are set to 1 and center area is set to 0. 536 * Prepare GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS samplers. Set parameter 537 * GL_TEXTURE_WRAP_S to GL_CLAMP_TO_EDGE for all samplers. 538 * 539 * Prepare compute program as in test DispatchBindTextures, but sample 540 * point (1.5, 0.5, 0.5). 541 * 542 * Test pass when the result stored in storage buffer is equal to 543 * GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS. 544 **/ 545 class DispatchBindSamplersTest : public deqp::TestCase 546 { 547 public: 548 /* Public methods */ 549 DispatchBindSamplersTest(deqp::Context& context); 550 ~DispatchBindSamplersTest()551 virtual ~DispatchBindSamplersTest() 552 { 553 } 554 555 /* Public methods inherited from TestCase */ 556 virtual tcu::TestNode::IterateResult iterate(void); 557 }; 558 559 /** Implementation of test DrawBindVertexBuffers. Description follows: 560 * 561 * Verifies that BindVertexBuffers command works as expected. 562 * 563 * Prepare program consisting of vertex, geometry and fragment shader. Vertex 564 * shader should: 565 * - declare GL_MAX_VERTEX_ATTRIB_BINDINGS attributes: 566 * 567 * layout(location = 0) in vec4 attr_0; 568 * layout(location = 1) in vec4 attr_0; 569 * 570 * ... 571 * 572 * layout(location = GL_MAX_VERTEX_ATTRIB_BINDINGS - 1) in vec4 attr_X; 573 * 574 * - calcualte sum of all attributes and store result in output varying. 575 * Geometry shader should: 576 * - output fullscreen quad; 577 * - pass-through the value of summed attributes to fragment shader. 578 * Fragment shader should pass-through the value of summed attributes to output 579 * color. 580 * 581 * Prepare and bind vertex array object. Prepare ARRAY buffer filled with all 582 * attributes. Values should be selected so the sum is equal 1.0 at each 583 * channel. Use BindVertexBuffers to set up all attributes to use the buffer. 584 * 585 * Prepare framebuffer with 8x8 2D RGBA8 texture attached as color 0. Fill 586 * texture with 0. 587 * 588 * Execute drawArrays for single vertex. 589 * 590 * Test pass if framebuffer is filled with value 1. 591 **/ 592 class DrawBindVertexBuffersTest : public deqp::TestCase 593 { 594 public: 595 /* Public methods */ 596 DrawBindVertexBuffersTest(deqp::Context& context); 597 ~DrawBindVertexBuffersTest()598 virtual ~DrawBindVertexBuffersTest() 599 { 600 } 601 602 /* Public methods inherited from TestCase */ 603 virtual tcu::TestNode::IterateResult iterate(void); 604 }; 605 } /* MultiBind */ 606 607 /** Group class for multi bind conformance tests */ 608 class MultiBindTests : public deqp::TestCaseGroup 609 { 610 public: 611 /* Public methods */ 612 MultiBindTests(deqp::Context& context); 613 ~MultiBindTests(void)614 virtual ~MultiBindTests(void) 615 { 616 } 617 618 virtual void init(void); 619 620 private: 621 /* Private methods */ 622 MultiBindTests(const MultiBindTests& other); 623 MultiBindTests& operator=(const MultiBindTests& other); 624 }; 625 626 } /* gl4cts */ 627 628 #endif // _GL4CMULTIBINDTESTS_HPP 629