1 /*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES 3.1 Module 3 * ------------------------------------------------- 4 * 5 * Copyright 2015 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 *//*! 20 * \file 21 * \brief Indexed state query tests 22 *//*--------------------------------------------------------------------*/ 23 24 #include "es31fIndexedStateQueryTests.hpp" 25 #include "tcuTestLog.hpp" 26 #include "tcuFormatUtil.hpp" 27 #include "gluRenderContext.hpp" 28 #include "gluCallLogWrapper.hpp" 29 #include "gluStrUtil.hpp" 30 #include "gluContextInfo.hpp" 31 #include "gluObjectWrapper.hpp" 32 #include "glwFunctions.hpp" 33 #include "glwEnums.hpp" 34 #include "glsStateQueryUtil.hpp" 35 #include "deRandom.hpp" 36 #include "deStringUtil.hpp" 37 38 namespace deqp 39 { 40 namespace gles31 41 { 42 namespace Functional 43 { 44 namespace 45 { 46 47 using namespace gls::StateQueryUtil; 48 49 static const char* getVerifierSuffix (QueryType type) 50 { 51 switch (type) 52 { 53 case QUERY_INDEXED_BOOLEAN: return "getbooleani_v"; 54 case QUERY_INDEXED_INTEGER: return "getintegeri_v"; 55 case QUERY_INDEXED_INTEGER64: return "getinteger64i_v"; 56 case QUERY_INDEXED_BOOLEAN_VEC4: return "getbooleani_v"; 57 case QUERY_INDEXED_INTEGER_VEC4: return "getintegeri_v"; 58 case QUERY_INDEXED_INTEGER64_VEC4: return "getinteger64i_v"; 59 case QUERY_INDEXED_ISENABLED: return "isenabledi"; 60 default: 61 DE_ASSERT(DE_FALSE); 62 return DE_NULL; 63 } 64 } 65 66 void isExtensionSupported (Context& context, std::string extensionName) 67 { 68 if (extensionName == "GL_EXT_draw_buffers_indexed" || extensionName == "GL_KHR_blend_equation_advanced") 69 { 70 if (!contextSupports(context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !context.getContextInfo().isExtensionSupported(extensionName.c_str())) 71 TCU_THROW(NotSupportedError, (std::string("Extension ") + extensionName + std::string(" not supported.")).c_str()); 72 } 73 else if (!context.getContextInfo().isExtensionSupported(extensionName.c_str())) 74 TCU_THROW(NotSupportedError, (std::string("Extension ") + extensionName + std::string(" not supported.")).c_str()); 75 } 76 77 class SampleMaskCase : public TestCase 78 { 79 public: 80 SampleMaskCase (Context& context, const char* name, const char* desc, QueryType verifierType); 81 82 private: 83 void init (void); 84 IterateResult iterate (void); 85 86 const QueryType m_verifierType; 87 int m_maxSampleMaskWords; 88 }; 89 90 SampleMaskCase::SampleMaskCase (Context& context, const char* name, const char* desc, QueryType verifierType) 91 : TestCase (context, name, desc) 92 , m_verifierType (verifierType) 93 , m_maxSampleMaskWords (-1) 94 { 95 } 96 97 void SampleMaskCase::init (void) 98 { 99 const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 100 101 gl.getIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &m_maxSampleMaskWords); 102 GLU_EXPECT_NO_ERROR(gl.getError(), "query sample mask words"); 103 104 // mask word count ok? 105 if (m_maxSampleMaskWords <= 0) 106 throw tcu::TestError("Minimum value of GL_MAX_SAMPLE_MASK_WORDS is 1. Got " + de::toString(m_maxSampleMaskWords)); 107 108 m_testCtx.getLog() << tcu::TestLog::Message << "GL_MAX_SAMPLE_MASK_WORDS = " << m_maxSampleMaskWords << tcu::TestLog::EndMessage; 109 } 110 111 SampleMaskCase::IterateResult SampleMaskCase::iterate (void) 112 { 113 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 114 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 115 116 gl.enableLogging(true); 117 118 // initial values 119 { 120 const tcu::ScopedLogSection section(m_testCtx.getLog(), "initial", "Initial values"); 121 122 for (int ndx = 0; ndx < m_maxSampleMaskWords; ++ndx) 123 verifyStateIndexedInteger(result, gl, GL_SAMPLE_MASK_VALUE, ndx, -1, m_verifierType); 124 } 125 126 // fixed values 127 { 128 const tcu::ScopedLogSection section(m_testCtx.getLog(), "fixed", "Fixed values"); 129 130 for (int ndx = 0; ndx < m_maxSampleMaskWords; ++ndx) 131 { 132 gl.glSampleMaski(ndx, 0); 133 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glSampleMaski"); 134 135 verifyStateIndexedInteger(result, gl, GL_SAMPLE_MASK_VALUE, ndx, 0, m_verifierType); 136 } 137 } 138 139 // random masks 140 { 141 const int numRandomTest = 20; 142 const tcu::ScopedLogSection section (m_testCtx.getLog(), "random", "Random values"); 143 de::Random rnd (0x4312); 144 145 for (int testNdx = 0; testNdx < numRandomTest; ++testNdx) 146 { 147 const glw::GLint maskIndex = (glw::GLint)(rnd.getUint32() % m_maxSampleMaskWords); 148 glw::GLint mask = (glw::GLint)(rnd.getUint32()); 149 150 gl.glSampleMaski(maskIndex, mask); 151 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glSampleMaski"); 152 153 verifyStateIndexedInteger(result, gl, GL_SAMPLE_MASK_VALUE, maskIndex, mask, m_verifierType); 154 } 155 } 156 157 result.setTestContextResult(m_testCtx); 158 return STOP; 159 } 160 161 class MinValueIndexed3Case : public TestCase 162 { 163 public: 164 MinValueIndexed3Case (Context& context, const char* name, const char* desc, glw::GLenum target, const tcu::IVec3& ref, QueryType verifierType); 165 166 private: 167 IterateResult iterate (void); 168 169 const glw::GLenum m_target; 170 const tcu::IVec3 m_ref; 171 const QueryType m_verifierType; 172 }; 173 174 MinValueIndexed3Case::MinValueIndexed3Case (Context& context, const char* name, const char* desc, glw::GLenum target, const tcu::IVec3& ref, QueryType verifierType) 175 : TestCase (context, name, desc) 176 , m_target (target) 177 , m_ref (ref) 178 , m_verifierType (verifierType) 179 { 180 } 181 182 MinValueIndexed3Case::IterateResult MinValueIndexed3Case::iterate (void) 183 { 184 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 185 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 186 187 gl.enableLogging(true); 188 189 for (int ndx = 0; ndx < 3; ++ndx) 190 { 191 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Element", "Element " + de::toString(ndx)); 192 193 verifyStateIndexedIntegerMin(result, gl, m_target, ndx, m_ref[ndx], m_verifierType); 194 } 195 196 result.setTestContextResult(m_testCtx); 197 return STOP; 198 } 199 200 class BufferBindingCase : public TestCase 201 { 202 public: 203 BufferBindingCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType); 204 205 private: 206 IterateResult iterate (void); 207 208 const glw::GLenum m_queryTarget; 209 const glw::GLenum m_bufferTarget; 210 const glw::GLenum m_numBindingsTarget; 211 const QueryType m_verifierType; 212 }; 213 214 BufferBindingCase::BufferBindingCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType) 215 : TestCase (context, name, desc) 216 , m_queryTarget (queryTarget) 217 , m_bufferTarget (bufferTarget) 218 , m_numBindingsTarget (numBindingsTarget) 219 , m_verifierType (verifierType) 220 { 221 } 222 223 BufferBindingCase::IterateResult BufferBindingCase::iterate (void) 224 { 225 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 226 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 227 int maxBindings = -1; 228 229 gl.enableLogging(true); 230 231 gl.glGetIntegerv(m_numBindingsTarget, &maxBindings); 232 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 233 234 { 235 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 236 237 for (int ndx = 0; ndx < maxBindings; ++ndx) 238 verifyStateIndexedInteger(result, gl, m_queryTarget, ndx, 0, m_verifierType); 239 } 240 241 { 242 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 243 glu::Buffer bufferA (m_context.getRenderContext()); 244 glu::Buffer bufferB (m_context.getRenderContext()); 245 const int ndxA = 0; 246 const int ndxB = maxBindings / 2; 247 248 { 249 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Generic", "After setting generic binding point"); 250 251 gl.glBindBuffer(m_bufferTarget, *bufferA); 252 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glBindBuffer"); 253 254 verifyStateIndexedInteger(result, gl, m_queryTarget, 0, 0, m_verifierType); 255 } 256 { 257 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferBase"); 258 259 gl.glBindBufferBase(m_bufferTarget, ndxA, *bufferA); 260 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glBindBufferBase"); 261 262 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, *bufferA, m_verifierType); 263 } 264 { 265 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferRange"); 266 267 gl.glBindBufferRange(m_bufferTarget, ndxB, *bufferB, 0, 8); 268 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glBindBufferRange"); 269 270 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxB, *bufferB, m_verifierType); 271 } 272 if (ndxA != ndxB) 273 { 274 const tcu::ScopedLogSection section(m_testCtx.getLog(), "DifferentStates", "Original state did not change"); 275 276 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, *bufferA, m_verifierType); 277 } 278 } 279 280 result.setTestContextResult(m_testCtx); 281 return STOP; 282 } 283 284 class BufferStartCase : public TestCase 285 { 286 public: 287 BufferStartCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType); 288 289 private: 290 IterateResult iterate (void); 291 292 const glw::GLenum m_queryTarget; 293 const glw::GLenum m_bufferTarget; 294 const glw::GLenum m_numBindingsTarget; 295 const QueryType m_verifierType; 296 }; 297 298 BufferStartCase::BufferStartCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType) 299 : TestCase (context, name, desc) 300 , m_queryTarget (queryTarget) 301 , m_bufferTarget (bufferTarget) 302 , m_numBindingsTarget (numBindingsTarget) 303 , m_verifierType (verifierType) 304 { 305 } 306 307 BufferStartCase::IterateResult BufferStartCase::iterate (void) 308 { 309 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 310 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 311 int maxBindings = -1; 312 313 gl.enableLogging(true); 314 315 gl.glGetIntegerv(m_numBindingsTarget, &maxBindings); 316 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 317 318 { 319 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 320 321 for (int ndx = 0; ndx < maxBindings; ++ndx) 322 verifyStateIndexedInteger(result, gl, m_queryTarget, ndx, 0, m_verifierType); 323 } 324 325 326 { 327 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 328 glu::Buffer bufferA (m_context.getRenderContext()); 329 glu::Buffer bufferB (m_context.getRenderContext()); 330 const int ndxA = 0; 331 const int ndxB = maxBindings / 2; 332 int offset = -1; 333 334 if (m_bufferTarget == GL_ATOMIC_COUNTER_BUFFER) 335 offset = 4; 336 else if (m_bufferTarget == GL_SHADER_STORAGE_BUFFER) 337 { 338 gl.glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, &offset); 339 GLU_EXPECT_NO_ERROR(gl.glGetError(), "get align"); 340 } 341 else 342 DE_ASSERT(false); 343 344 TCU_CHECK(offset >= 0); 345 346 { 347 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Generic", "After setting generic binding point"); 348 349 gl.glBindBuffer(m_bufferTarget, *bufferA); 350 gl.glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_READ); 351 gl.glBindBuffer(m_bufferTarget, *bufferB); 352 gl.glBufferData(m_bufferTarget, 32, DE_NULL, GL_DYNAMIC_READ); 353 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen bufs"); 354 355 verifyStateIndexedInteger(result, gl, m_queryTarget, 0, 0, m_verifierType); 356 } 357 { 358 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferBase"); 359 360 gl.glBindBufferBase(m_bufferTarget, ndxA, *bufferA); 361 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf"); 362 363 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType); 364 } 365 { 366 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferRange"); 367 368 gl.glBindBufferRange(m_bufferTarget, ndxB, *bufferB, offset, 8); 369 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf"); 370 371 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxB, offset, m_verifierType); 372 } 373 if (ndxA != ndxB) 374 { 375 const tcu::ScopedLogSection section(m_testCtx.getLog(), "DifferentStates", "Original state did not change"); 376 377 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType); 378 } 379 } 380 381 result.setTestContextResult(m_testCtx); 382 return STOP; 383 } 384 385 class BufferSizeCase : public TestCase 386 { 387 public: 388 BufferSizeCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType); 389 390 private: 391 IterateResult iterate (void); 392 393 const glw::GLenum m_queryTarget; 394 const glw::GLenum m_bufferTarget; 395 const glw::GLenum m_numBindingsTarget; 396 const QueryType m_verifierType; 397 }; 398 399 BufferSizeCase::BufferSizeCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bufferTarget, glw::GLenum numBindingsTarget, QueryType verifierType) 400 : TestCase (context, name, desc) 401 , m_queryTarget (queryTarget) 402 , m_bufferTarget (bufferTarget) 403 , m_numBindingsTarget (numBindingsTarget) 404 , m_verifierType (verifierType) 405 { 406 } 407 408 BufferSizeCase::IterateResult BufferSizeCase::iterate (void) 409 { 410 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 411 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 412 int maxBindings = -1; 413 414 gl.enableLogging(true); 415 416 gl.glGetIntegerv(m_numBindingsTarget, &maxBindings); 417 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 418 419 { 420 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 421 422 for (int ndx = 0; ndx < maxBindings; ++ndx) 423 verifyStateIndexedInteger(result, gl, m_queryTarget, ndx, 0, m_verifierType); 424 } 425 426 { 427 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 428 glu::Buffer bufferA (m_context.getRenderContext()); 429 glu::Buffer bufferB (m_context.getRenderContext()); 430 const int ndxA = 0; 431 const int ndxB = maxBindings / 2; 432 433 { 434 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Generic", "After setting generic binding point"); 435 436 gl.glBindBuffer(m_bufferTarget, *bufferA); 437 gl.glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_READ); 438 gl.glBindBuffer(m_bufferTarget, *bufferB); 439 gl.glBufferData(m_bufferTarget, 32, DE_NULL, GL_DYNAMIC_READ); 440 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen bufs"); 441 442 verifyStateIndexedInteger(result, gl, m_queryTarget, 0, 0, m_verifierType); 443 } 444 { 445 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferBase"); 446 447 gl.glBindBufferBase(m_bufferTarget, ndxA, *bufferA); 448 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf"); 449 450 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType); 451 } 452 { 453 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Indexed", "After setting with glBindBufferRange"); 454 455 gl.glBindBufferRange(m_bufferTarget, ndxB, *bufferB, 0, 8); 456 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind buf"); 457 458 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxB, 8, m_verifierType); 459 } 460 if (ndxA != ndxB) 461 { 462 const tcu::ScopedLogSection section(m_testCtx.getLog(), "DifferentStates", "Original state did not change"); 463 464 verifyStateIndexedInteger(result, gl, m_queryTarget, ndxA, 0, m_verifierType); 465 } 466 } 467 468 result.setTestContextResult(m_testCtx); 469 return STOP; 470 } 471 472 class ImageBindingNameCase : public TestCase 473 { 474 public: 475 ImageBindingNameCase (Context& context, const char* name, const char* desc, QueryType verifierType); 476 477 private: 478 IterateResult iterate (void); 479 480 const QueryType m_verifierType; 481 }; 482 483 ImageBindingNameCase::ImageBindingNameCase (Context& context, const char* name, const char* desc, QueryType verifierType) 484 : TestCase (context, name, desc) 485 , m_verifierType (verifierType) 486 { 487 } 488 489 ImageBindingNameCase::IterateResult ImageBindingNameCase::iterate (void) 490 { 491 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 492 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 493 int maxImages = -1; 494 495 gl.enableLogging(true); 496 497 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages); 498 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 499 500 { 501 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 502 503 for (int ndx = 0; ndx < maxImages; ++ndx) 504 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_NAME, ndx, 0, m_verifierType); 505 } 506 507 { 508 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 509 glu::Texture textureA (m_context.getRenderContext()); 510 glu::Texture textureB (m_context.getRenderContext()); 511 const int ndxA = 0; 512 const int ndxB = maxImages / 2; 513 514 gl.glBindTexture(GL_TEXTURE_2D, *textureA); 515 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 516 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 517 518 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 519 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 520 521 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB); 522 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4); 523 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 524 525 gl.glBindImageTexture(ndxB, *textureB, 0, GL_FALSE, 2, GL_READ_ONLY, GL_RGBA8UI); 526 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 527 528 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_NAME, ndxA, *textureA, m_verifierType); 529 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_NAME, ndxB, *textureB, m_verifierType); 530 } 531 532 result.setTestContextResult(m_testCtx); 533 return STOP; 534 } 535 536 class ImageBindingLevelCase : public TestCase 537 { 538 public: 539 ImageBindingLevelCase (Context& context, const char* name, const char* desc, QueryType verifierType); 540 541 private: 542 IterateResult iterate (void); 543 544 const QueryType m_verifierType; 545 }; 546 547 ImageBindingLevelCase::ImageBindingLevelCase (Context& context, const char* name, const char* desc, QueryType verifierType) 548 : TestCase (context, name, desc) 549 , m_verifierType (verifierType) 550 { 551 } 552 553 ImageBindingLevelCase::IterateResult ImageBindingLevelCase::iterate (void) 554 { 555 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 556 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 557 int maxImages = -1; 558 559 gl.enableLogging(true); 560 561 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages); 562 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 563 564 { 565 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 566 567 for (int ndx = 0; ndx < maxImages; ++ndx) 568 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LEVEL, ndx, 0, m_verifierType); 569 } 570 571 { 572 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 573 glu::Texture textureA (m_context.getRenderContext()); 574 glu::Texture textureB (m_context.getRenderContext()); 575 const int ndxA = 0; 576 const int ndxB = maxImages / 2; 577 578 gl.glBindTexture(GL_TEXTURE_2D, *textureA); 579 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 580 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 581 582 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 583 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 584 585 gl.glBindTexture(GL_TEXTURE_2D, *textureB); 586 gl.glTexStorage2D(GL_TEXTURE_2D, 3, GL_RGBA8, 32, 32); 587 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 588 589 gl.glBindImageTexture(ndxB, *textureB, 2, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 590 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 591 592 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LEVEL, ndxA, 0, m_verifierType); 593 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LEVEL, ndxB, 2, m_verifierType); 594 } 595 596 result.setTestContextResult(m_testCtx); 597 return STOP; 598 } 599 600 class ImageBindingLayeredCase : public TestCase 601 { 602 public: 603 ImageBindingLayeredCase (Context& context, const char* name, const char* desc, QueryType verifierType); 604 605 private: 606 IterateResult iterate (void); 607 608 const QueryType m_verifierType; 609 }; 610 611 ImageBindingLayeredCase::ImageBindingLayeredCase (Context& context, const char* name, const char* desc, QueryType verifierType) 612 : TestCase (context, name, desc) 613 , m_verifierType (verifierType) 614 { 615 } 616 617 ImageBindingLayeredCase::IterateResult ImageBindingLayeredCase::iterate (void) 618 { 619 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 620 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 621 int maxImages = -1; 622 623 gl.enableLogging(true); 624 625 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages); 626 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 627 628 { 629 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 630 631 for (int ndx = 0; ndx < maxImages; ++ndx) 632 verifyStateIndexedBoolean(result, gl, GL_IMAGE_BINDING_LAYERED, ndx, false, m_verifierType); 633 } 634 635 { 636 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 637 glu::Texture textureA (m_context.getRenderContext()); 638 glu::Texture textureB (m_context.getRenderContext()); 639 const int ndxA = 0; 640 const int ndxB = maxImages / 2; 641 642 gl.glBindTexture(GL_TEXTURE_2D, *textureA); 643 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 644 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 645 646 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 647 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 648 649 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB); 650 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4); 651 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 652 653 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_ONLY, GL_RGBA8UI); 654 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 655 656 verifyStateIndexedBoolean(result, gl, GL_IMAGE_BINDING_LAYERED, ndxA, false, m_verifierType); 657 verifyStateIndexedBoolean(result, gl, GL_IMAGE_BINDING_LAYERED, ndxB, true, m_verifierType); 658 } 659 660 result.setTestContextResult(m_testCtx); 661 return STOP; 662 } 663 664 class ImageBindingLayerCase : public TestCase 665 { 666 public: 667 ImageBindingLayerCase (Context& context, const char* name, const char* desc, QueryType verifierType); 668 669 private: 670 IterateResult iterate (void); 671 672 const QueryType m_verifierType; 673 }; 674 675 ImageBindingLayerCase::ImageBindingLayerCase (Context& context, const char* name, const char* desc, QueryType verifierType) 676 : TestCase (context, name, desc) 677 , m_verifierType (verifierType) 678 { 679 } 680 681 ImageBindingLayerCase::IterateResult ImageBindingLayerCase::iterate (void) 682 { 683 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 684 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 685 int maxImages = -1; 686 687 gl.enableLogging(true); 688 689 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages); 690 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 691 692 { 693 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 694 695 for (int ndx = 0; ndx < maxImages; ++ndx) 696 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LAYER, ndx, 0, m_verifierType); 697 } 698 699 { 700 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 701 glu::Texture textureA (m_context.getRenderContext()); 702 glu::Texture textureB (m_context.getRenderContext()); 703 const int ndxA = 0; 704 const int ndxB = maxImages / 2; 705 706 gl.glBindTexture(GL_TEXTURE_2D, *textureA); 707 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 708 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 709 710 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 711 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 712 713 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB); 714 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4); 715 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 716 717 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_ONLY, GL_RGBA8UI); 718 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 719 720 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LAYER, ndxA, 0, m_verifierType); 721 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_LAYER, ndxB, 2, m_verifierType); 722 } 723 724 result.setTestContextResult(m_testCtx); 725 return STOP; 726 } 727 728 class ImageBindingAccessCase : public TestCase 729 { 730 public: 731 ImageBindingAccessCase (Context& context, const char* name, const char* desc, QueryType verifierType); 732 733 private: 734 IterateResult iterate (void); 735 736 const QueryType m_verifierType; 737 }; 738 739 ImageBindingAccessCase::ImageBindingAccessCase (Context& context, const char* name, const char* desc, QueryType verifierType) 740 : TestCase (context, name, desc) 741 , m_verifierType (verifierType) 742 { 743 } 744 745 ImageBindingAccessCase::IterateResult ImageBindingAccessCase::iterate (void) 746 { 747 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 748 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 749 int maxImages = -1; 750 751 gl.enableLogging(true); 752 753 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages); 754 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 755 756 { 757 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 758 759 for (int ndx = 0; ndx < maxImages; ++ndx) 760 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_ACCESS, ndx, GL_READ_ONLY, m_verifierType); 761 } 762 763 { 764 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 765 glu::Texture textureA (m_context.getRenderContext()); 766 glu::Texture textureB (m_context.getRenderContext()); 767 const int ndxA = 0; 768 const int ndxB = maxImages / 2; 769 770 gl.glBindTexture(GL_TEXTURE_2D, *textureA); 771 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 772 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 773 774 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 775 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 776 777 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB); 778 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 32, 32, 4); 779 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 780 781 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_WRITE, GL_RGBA8UI); 782 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 783 784 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_ACCESS, ndxA, GL_READ_ONLY, m_verifierType); 785 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_ACCESS, ndxB, GL_READ_WRITE, m_verifierType); 786 } 787 788 result.setTestContextResult(m_testCtx); 789 return STOP; 790 } 791 792 class ImageBindingFormatCase : public TestCase 793 { 794 public: 795 ImageBindingFormatCase (Context& context, const char* name, const char* desc, QueryType verifierType); 796 797 private: 798 IterateResult iterate (void); 799 800 const QueryType m_verifierType; 801 }; 802 803 ImageBindingFormatCase::ImageBindingFormatCase (Context& context, const char* name, const char* desc, QueryType verifierType) 804 : TestCase (context, name, desc) 805 , m_verifierType (verifierType) 806 { 807 } 808 809 ImageBindingFormatCase::IterateResult ImageBindingFormatCase::iterate (void) 810 { 811 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 812 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 813 int maxImages = -1; 814 815 gl.enableLogging(true); 816 817 gl.glGetIntegerv(GL_MAX_IMAGE_UNITS, &maxImages); 818 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 819 820 { 821 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 822 823 for (int ndx = 0; ndx < maxImages; ++ndx) 824 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndx, GL_R32UI, m_verifierType); 825 } 826 827 { 828 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSetting", "After setting"); 829 glu::Texture textureA (m_context.getRenderContext()); 830 glu::Texture textureB (m_context.getRenderContext()); 831 const int ndxA = 0; 832 const int ndxB = maxImages / 2; 833 834 gl.glBindTexture(GL_TEXTURE_2D, *textureA); 835 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 836 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 837 838 gl.glBindImageTexture(ndxA, *textureA, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8UI); 839 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 840 841 gl.glBindTexture(GL_TEXTURE_2D_ARRAY, *textureB); 842 gl.glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_R32F, 32, 32, 4); 843 GLU_EXPECT_NO_ERROR(gl.glGetError(), "gen tex"); 844 845 gl.glBindImageTexture(ndxB, *textureB, 0, GL_TRUE, 2, GL_READ_WRITE, GL_R32F); 846 GLU_EXPECT_NO_ERROR(gl.glGetError(), "bind unit"); 847 848 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndxA, GL_RGBA8UI, m_verifierType); 849 verifyStateIndexedInteger(result, gl, GL_IMAGE_BINDING_FORMAT, ndxB, GL_R32F, m_verifierType); 850 } 851 852 result.setTestContextResult(m_testCtx); 853 return STOP; 854 } 855 856 class EnableBlendCase : public TestCase 857 { 858 public: 859 EnableBlendCase (Context& context, const char* name, const char* desc, QueryType verifierType); 860 861 void init (void); 862 private: 863 IterateResult iterate (void); 864 865 const QueryType m_verifierType; 866 }; 867 868 EnableBlendCase::EnableBlendCase (Context& context, const char* name, const char* desc, QueryType verifierType) 869 : TestCase (context, name, desc) 870 , m_verifierType (verifierType) 871 { 872 } 873 874 void EnableBlendCase::init (void) 875 { 876 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed"); 877 } 878 879 EnableBlendCase::IterateResult EnableBlendCase::iterate (void) 880 { 881 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 882 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 883 deInt32 maxDrawBuffers = 0; 884 885 gl.enableLogging(true); 886 887 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); 888 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 889 890 { 891 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 892 893 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 894 verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, false, m_verifierType); 895 } 896 { 897 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSettingCommon", "After setting common"); 898 899 gl.glEnable(GL_BLEND); 900 901 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 902 verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, true, m_verifierType); 903 904 } 905 { 906 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed"); 907 908 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 909 { 910 if (ndx % 2 == 0) 911 gl.glEnablei(GL_BLEND, ndx); 912 else 913 gl.glDisablei(GL_BLEND, ndx); 914 } 915 916 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 917 verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, (ndx % 2 == 0), m_verifierType); 918 } 919 { 920 const tcu::ScopedLogSection superSection (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common"); 921 922 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 923 { 924 if (ndx % 2 == 0) 925 gl.glEnablei(GL_BLEND, ndx); 926 else 927 gl.glDisablei(GL_BLEND, ndx); 928 } 929 930 gl.glEnable(GL_BLEND); 931 932 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 933 verifyStateIndexedBoolean(result, gl, GL_BLEND, ndx, true, m_verifierType); 934 } 935 936 result.setTestContextResult(m_testCtx); 937 return STOP; 938 } 939 940 class ColorMaskCase : public TestCase 941 { 942 public: 943 ColorMaskCase (Context& context, const char* name, const char* desc, QueryType verifierType); 944 945 void init (void); 946 private: 947 IterateResult iterate (void); 948 949 const QueryType m_verifierType; 950 }; 951 952 ColorMaskCase::ColorMaskCase (Context& context, const char* name, const char* desc, QueryType verifierType) 953 : TestCase (context, name, desc) 954 , m_verifierType (verifierType) 955 { 956 } 957 958 void ColorMaskCase::init (void) 959 { 960 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed"); 961 } 962 963 ColorMaskCase::IterateResult ColorMaskCase::iterate (void) 964 { 965 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 966 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 967 deInt32 maxDrawBuffers = 0; 968 969 gl.enableLogging(true); 970 971 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); 972 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 973 974 { 975 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 976 977 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 978 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(true), m_verifierType); 979 } 980 { 981 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common"); 982 983 gl.glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); 984 985 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 986 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(false, true, true, false), m_verifierType); 987 } 988 { 989 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed"); 990 991 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 992 gl.glColorMaski(ndx, (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE), (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE)); 993 994 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 995 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, (ndx % 2 == 0 ? tcu::BVec4(true, false, true, false) : tcu::BVec4(false, true, false, true)), m_verifierType); 996 } 997 { 998 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common"); 999 1000 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1001 gl.glColorMaski(ndx, (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE), (ndx % 2 == 0 ? GL_TRUE : GL_FALSE), (ndx % 2 == 1 ? GL_TRUE : GL_FALSE)); 1002 1003 gl.glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); 1004 1005 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1006 verifyStateIndexedBooleanVec4(result, gl, GL_COLOR_WRITEMASK, ndx, tcu::BVec4(false, true, true, false), m_verifierType); 1007 } 1008 1009 result.setTestContextResult(m_testCtx); 1010 return STOP; 1011 } 1012 1013 class BlendFuncCase : public TestCase 1014 { 1015 public: 1016 BlendFuncCase (Context& context, const char* name, const char* desc, QueryType verifierType); 1017 1018 void init (void); 1019 private: 1020 IterateResult iterate (void); 1021 1022 const QueryType m_verifierType; 1023 }; 1024 1025 BlendFuncCase::BlendFuncCase (Context& context, const char* name, const char* desc, QueryType verifierType) 1026 : TestCase (context, name, desc) 1027 , m_verifierType (verifierType) 1028 { 1029 } 1030 1031 void BlendFuncCase::init (void) 1032 { 1033 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed"); 1034 } 1035 1036 BlendFuncCase::IterateResult BlendFuncCase::iterate (void) 1037 { 1038 const deUint32 blendFuncs[] = 1039 { 1040 GL_ZERO, 1041 GL_ONE, 1042 GL_SRC_COLOR, 1043 GL_ONE_MINUS_SRC_COLOR, 1044 GL_DST_COLOR, 1045 GL_ONE_MINUS_DST_COLOR, 1046 GL_SRC_ALPHA, 1047 GL_ONE_MINUS_SRC_ALPHA, 1048 GL_DST_ALPHA, 1049 GL_ONE_MINUS_DST_ALPHA, 1050 GL_CONSTANT_COLOR, 1051 GL_ONE_MINUS_CONSTANT_COLOR, 1052 GL_CONSTANT_ALPHA, 1053 GL_ONE_MINUS_CONSTANT_ALPHA, 1054 GL_SRC_ALPHA_SATURATE 1055 }; 1056 1057 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 1058 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 1059 deInt32 maxDrawBuffers = 0; 1060 1061 gl.enableLogging(true); 1062 1063 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); 1064 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 1065 1066 { 1067 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 1068 1069 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1070 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_ONE, m_verifierType); 1071 1072 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1073 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ZERO, m_verifierType); 1074 1075 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1076 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_ONE, m_verifierType); 1077 1078 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1079 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ZERO, m_verifierType); 1080 } 1081 { 1082 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common"); 1083 1084 gl.glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); 1085 1086 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1087 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_ALPHA, m_verifierType); 1088 1089 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1090 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_DST_ALPHA, m_verifierType); 1091 1092 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1093 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_SRC_ALPHA, m_verifierType); 1094 1095 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1096 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_DST_ALPHA, m_verifierType); 1097 } 1098 { 1099 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommonSeparate", "After setting common separate"); 1100 1101 gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA); 1102 1103 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1104 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_COLOR, m_verifierType); 1105 1106 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1107 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ONE_MINUS_SRC_ALPHA, m_verifierType); 1108 1109 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1110 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_DST_COLOR, m_verifierType); 1111 1112 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1113 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ONE_MINUS_DST_ALPHA, m_verifierType); 1114 } 1115 { 1116 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed"); 1117 1118 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1119 gl.glBlendFunci(ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)]); 1120 1121 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1122 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1123 1124 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1125 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1126 1127 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1128 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1129 1130 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1131 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1132 } 1133 { 1134 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexedSeparate", "After setting indexed separate"); 1135 1136 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1137 gl.glBlendFuncSeparatei(ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)], 1138 blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)], 1139 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], 1140 blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)]); 1141 1142 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1143 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1144 1145 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1146 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1147 1148 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1149 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1150 1151 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1152 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)], m_verifierType); 1153 1154 } 1155 { 1156 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common"); 1157 1158 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1159 gl.glBlendFunci(ndx, blendFuncs[ndx % DE_LENGTH_OF_ARRAY(blendFuncs)], blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)]); 1160 1161 gl.glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); 1162 1163 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1164 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_ALPHA, m_verifierType); 1165 1166 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1167 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_DST_ALPHA, m_verifierType); 1168 1169 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1170 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_SRC_ALPHA, m_verifierType); 1171 1172 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1173 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_DST_ALPHA, m_verifierType); 1174 } 1175 { 1176 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommonSeparate", "After resetting indexed with common separate"); 1177 1178 gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA); 1179 1180 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1181 gl.glBlendFuncSeparatei(ndx, blendFuncs[(ndx + 3) % DE_LENGTH_OF_ARRAY(blendFuncs)], 1182 blendFuncs[(ndx + 2) % DE_LENGTH_OF_ARRAY(blendFuncs)], 1183 blendFuncs[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendFuncs)], 1184 blendFuncs[(ndx + 0) % DE_LENGTH_OF_ARRAY(blendFuncs)]); 1185 1186 gl.glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_ONE_MINUS_DST_ALPHA); 1187 1188 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1189 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_RGB, ndx, GL_SRC_COLOR, m_verifierType); 1190 1191 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1192 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_RGB, ndx, GL_ONE_MINUS_SRC_ALPHA, m_verifierType); 1193 1194 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1195 verifyStateIndexedInteger(result, gl, GL_BLEND_SRC_ALPHA, ndx, GL_DST_COLOR, m_verifierType); 1196 1197 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1198 verifyStateIndexedInteger(result, gl, GL_BLEND_DST_ALPHA, ndx, GL_ONE_MINUS_DST_ALPHA, m_verifierType); 1199 } 1200 1201 result.setTestContextResult(m_testCtx); 1202 return STOP; 1203 } 1204 1205 class BlendEquationCase : public TestCase 1206 { 1207 public: 1208 BlendEquationCase (Context& context, const char* name, const char* desc, QueryType verifierType); 1209 1210 void init (void); 1211 private: 1212 IterateResult iterate (void); 1213 1214 const QueryType m_verifierType; 1215 }; 1216 1217 BlendEquationCase::BlendEquationCase (Context& context, const char* name, const char* desc, QueryType verifierType) 1218 : TestCase (context, name, desc) 1219 , m_verifierType (verifierType) 1220 { 1221 } 1222 1223 void BlendEquationCase::init (void) 1224 { 1225 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed"); 1226 } 1227 1228 BlendEquationCase::IterateResult BlendEquationCase::iterate (void) 1229 { 1230 const deUint32 blendEquations[] = 1231 { 1232 GL_FUNC_ADD, 1233 GL_FUNC_SUBTRACT, 1234 GL_FUNC_REVERSE_SUBTRACT, 1235 GL_MIN, 1236 GL_MAX 1237 }; 1238 1239 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 1240 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 1241 deInt32 maxDrawBuffers = 0; 1242 1243 gl.enableLogging(true); 1244 1245 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); 1246 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 1247 1248 { 1249 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial value"); 1250 1251 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1252 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_ADD, m_verifierType); 1253 1254 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1255 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_ADD, m_verifierType); 1256 } 1257 { 1258 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common"); 1259 1260 gl.glBlendEquation(GL_FUNC_SUBTRACT); 1261 1262 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1263 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_SUBTRACT, m_verifierType); 1264 1265 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1266 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType); 1267 } 1268 { 1269 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommonSeparate", "After setting common separate"); 1270 1271 gl.glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_SUBTRACT); 1272 1273 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1274 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_REVERSE_SUBTRACT, m_verifierType); 1275 1276 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1277 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType); 1278 } 1279 { 1280 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed"); 1281 1282 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1283 gl.glBlendEquationi(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)]); 1284 1285 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1286 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType); 1287 1288 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1289 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType); 1290 } 1291 { 1292 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexedSeparate", "After setting indexed separate"); 1293 1294 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1295 gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]); 1296 1297 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1298 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType); 1299 1300 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1301 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)], m_verifierType); 1302 } 1303 { 1304 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common"); 1305 1306 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1307 gl.glBlendEquationi(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)]); 1308 1309 gl.glBlendEquation(GL_FUNC_SUBTRACT); 1310 1311 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1312 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_SUBTRACT, m_verifierType); 1313 1314 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1315 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType); 1316 } 1317 { 1318 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommonSeparate", "After resetting indexed with common separate"); 1319 1320 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1321 gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]); 1322 1323 gl.glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_SUBTRACT); 1324 1325 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1326 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_FUNC_REVERSE_SUBTRACT, m_verifierType); 1327 1328 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1329 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_FUNC_SUBTRACT, m_verifierType); 1330 } 1331 1332 result.setTestContextResult(m_testCtx); 1333 return STOP; 1334 } 1335 1336 class BlendEquationAdvancedCase : public TestCase 1337 { 1338 public: 1339 BlendEquationAdvancedCase (Context& context, const char* name, const char* desc, QueryType verifierType); 1340 1341 void init (void); 1342 private: 1343 IterateResult iterate (void); 1344 1345 const QueryType m_verifierType; 1346 }; 1347 1348 BlendEquationAdvancedCase::BlendEquationAdvancedCase (Context& context, const char* name, const char* desc, QueryType verifierType) 1349 : TestCase (context, name, desc) 1350 , m_verifierType (verifierType) 1351 { 1352 } 1353 1354 void BlendEquationAdvancedCase::init (void) 1355 { 1356 isExtensionSupported(m_context, "GL_EXT_draw_buffers_indexed"); 1357 isExtensionSupported(m_context, "GL_KHR_blend_equation_advanced"); 1358 } 1359 1360 BlendEquationAdvancedCase::IterateResult BlendEquationAdvancedCase::iterate (void) 1361 { 1362 const deUint32 blendEquations[] = 1363 { 1364 GL_FUNC_ADD, 1365 GL_FUNC_SUBTRACT, 1366 GL_FUNC_REVERSE_SUBTRACT, 1367 GL_MIN, 1368 GL_MAX 1369 }; 1370 1371 const deUint32 blendEquationAdvanced[] = 1372 { 1373 GL_MULTIPLY, 1374 GL_SCREEN, 1375 GL_OVERLAY, 1376 GL_DARKEN, 1377 GL_LIGHTEN, 1378 GL_COLORDODGE, 1379 GL_COLORBURN, 1380 GL_HARDLIGHT, 1381 GL_SOFTLIGHT, 1382 GL_DIFFERENCE, 1383 GL_EXCLUSION, 1384 GL_HSL_HUE, 1385 GL_HSL_SATURATION, 1386 GL_HSL_COLOR, 1387 GL_HSL_LUMINOSITY 1388 }; 1389 1390 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 1391 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 1392 deInt32 maxDrawBuffers = 0; 1393 1394 gl.enableLogging(true); 1395 1396 gl.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); 1397 GLU_EXPECT_NO_ERROR(gl.glGetError(), "glGetIntegerv"); 1398 1399 { 1400 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingCommon", "After setting common"); 1401 1402 gl.glBlendEquation(GL_SCREEN); 1403 1404 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1405 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_SCREEN, m_verifierType); 1406 1407 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1408 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_SCREEN, m_verifierType); 1409 } 1410 { 1411 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterSettingIndexed", "After setting indexed"); 1412 1413 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1414 gl.glBlendEquationi(ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)]); 1415 1416 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1417 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)], m_verifierType); 1418 1419 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1420 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)], m_verifierType); 1421 } 1422 { 1423 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedWithCommon", "After resetting indexed with common"); 1424 1425 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1426 gl.glBlendEquationi(ndx, blendEquationAdvanced[ndx % DE_LENGTH_OF_ARRAY(blendEquationAdvanced)]); 1427 1428 gl.glBlendEquation(GL_MULTIPLY); 1429 1430 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1431 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_MULTIPLY, m_verifierType); 1432 1433 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1434 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_MULTIPLY, m_verifierType); 1435 } 1436 { 1437 const tcu::ScopedLogSection section (m_testCtx.getLog(), "AfterResettingIndexedSeparateWithCommon", "After resetting indexed separate with common"); 1438 1439 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1440 gl.glBlendEquationSeparatei(ndx, blendEquations[ndx % DE_LENGTH_OF_ARRAY(blendEquations)], blendEquations[(ndx + 1) % DE_LENGTH_OF_ARRAY(blendEquations)]); 1441 1442 gl.glBlendEquation(GL_LIGHTEN); 1443 1444 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1445 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_RGB, ndx, GL_LIGHTEN, m_verifierType); 1446 1447 for (int ndx = 0; ndx < maxDrawBuffers; ++ndx) 1448 verifyStateIndexedInteger(result, gl, GL_BLEND_EQUATION_ALPHA, ndx, GL_LIGHTEN, m_verifierType); 1449 } 1450 1451 result.setTestContextResult(m_testCtx); 1452 return STOP; 1453 } 1454 1455 } // anonymous 1456 1457 IndexedStateQueryTests::IndexedStateQueryTests (Context& context) 1458 : TestCaseGroup(context, "indexed", "Indexed state queries") 1459 { 1460 } 1461 1462 IndexedStateQueryTests::~IndexedStateQueryTests (void) 1463 { 1464 } 1465 1466 void IndexedStateQueryTests::init (void) 1467 { 1468 static const QueryType verifiers[] = { QUERY_INDEXED_BOOLEAN, QUERY_INDEXED_INTEGER, QUERY_INDEXED_INTEGER64 }; 1469 static const QueryType vec4Verifiers[] = { QUERY_INDEXED_BOOLEAN_VEC4, QUERY_INDEXED_INTEGER_VEC4, QUERY_INDEXED_INTEGER64_VEC4 }; 1470 1471 #define FOR_EACH_VERIFIER(X) \ 1472 for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx) \ 1473 { \ 1474 const QueryType verifier = verifiers[verifierNdx]; \ 1475 const char* verifierSuffix = getVerifierSuffix(verifier); \ 1476 this->addChild(X); \ 1477 } 1478 1479 #define FOR_EACH_VEC4_VERIFIER(X) \ 1480 for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(vec4Verifiers); ++verifierNdx) \ 1481 { \ 1482 const QueryType verifier = vec4Verifiers[verifierNdx]; \ 1483 const char* verifierSuffix = getVerifierSuffix(verifier); \ 1484 this->addChild(X); \ 1485 } 1486 1487 FOR_EACH_VERIFIER(new SampleMaskCase (m_context, (std::string() + "sample_mask_value_" + verifierSuffix).c_str(), "Test SAMPLE_MASK_VALUE", verifier)) 1488 1489 FOR_EACH_VERIFIER(new MinValueIndexed3Case (m_context, (std::string() + "max_compute_work_group_count_" + verifierSuffix).c_str(), "Test MAX_COMPUTE_WORK_GROUP_COUNT", GL_MAX_COMPUTE_WORK_GROUP_COUNT, tcu::IVec3(65535,65535,65535), verifier)) 1490 FOR_EACH_VERIFIER(new MinValueIndexed3Case (m_context, (std::string() + "max_compute_work_group_size_" + verifierSuffix).c_str(), "Test MAX_COMPUTE_WORK_GROUP_SIZE", GL_MAX_COMPUTE_WORK_GROUP_SIZE, tcu::IVec3(128, 128, 64), verifier)) 1491 1492 FOR_EACH_VERIFIER(new BufferBindingCase (m_context, (std::string() + "atomic_counter_buffer_binding_" + verifierSuffix).c_str(), "Test ATOMIC_COUNTER_BUFFER_BINDING", GL_ATOMIC_COUNTER_BUFFER_BINDING, GL_ATOMIC_COUNTER_BUFFER, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, verifier)) 1493 FOR_EACH_VERIFIER(new BufferStartCase (m_context, (std::string() + "atomic_counter_buffer_start_" + verifierSuffix).c_str(), "Test ATOMIC_COUNTER_BUFFER_START", GL_ATOMIC_COUNTER_BUFFER_START, GL_ATOMIC_COUNTER_BUFFER, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, verifier)) 1494 FOR_EACH_VERIFIER(new BufferSizeCase (m_context, (std::string() + "atomic_counter_buffer_size_" + verifierSuffix).c_str(), "Test ATOMIC_COUNTER_BUFFER_SIZE", GL_ATOMIC_COUNTER_BUFFER_SIZE, GL_ATOMIC_COUNTER_BUFFER, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, verifier)) 1495 1496 FOR_EACH_VERIFIER(new BufferBindingCase (m_context, (std::string() + "shader_storage_buffer_binding_" + verifierSuffix).c_str(), "Test SHADER_STORAGE_BUFFER_BINDING", GL_SHADER_STORAGE_BUFFER_BINDING, GL_SHADER_STORAGE_BUFFER, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, verifier)) 1497 FOR_EACH_VERIFIER(new BufferStartCase (m_context, (std::string() + "shader_storage_buffer_start_" + verifierSuffix).c_str(), "Test SHADER_STORAGE_BUFFER_START", GL_SHADER_STORAGE_BUFFER_START, GL_SHADER_STORAGE_BUFFER, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, verifier)) 1498 FOR_EACH_VERIFIER(new BufferSizeCase (m_context, (std::string() + "shader_storage_buffer_size_" + verifierSuffix).c_str(), "Test SHADER_STORAGE_BUFFER_SIZE", GL_SHADER_STORAGE_BUFFER_SIZE, GL_SHADER_STORAGE_BUFFER, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, verifier)) 1499 1500 FOR_EACH_VERIFIER(new ImageBindingNameCase (m_context, (std::string() + "image_binding_name_" + verifierSuffix).c_str(), "Test IMAGE_BINDING_NAME", verifier)) 1501 FOR_EACH_VERIFIER(new ImageBindingLevelCase (m_context, (std::string() + "image_binding_level_" + verifierSuffix).c_str(), "Test IMAGE_BINDING_LEVEL", verifier)) 1502 FOR_EACH_VERIFIER(new ImageBindingLayeredCase (m_context, (std::string() + "image_binding_layered_" + verifierSuffix).c_str(), "Test IMAGE_BINDING_LAYERED", verifier)) 1503 FOR_EACH_VERIFIER(new ImageBindingLayerCase (m_context, (std::string() + "image_binding_layer_" + verifierSuffix).c_str(), "Test IMAGE_BINDING_LAYER", verifier)) 1504 FOR_EACH_VERIFIER(new ImageBindingAccessCase (m_context, (std::string() + "image_binding_access_" + verifierSuffix).c_str(), "Test IMAGE_BINDING_ACCESS", verifier)) 1505 FOR_EACH_VERIFIER(new ImageBindingFormatCase (m_context, (std::string() + "image_binding_format_" + verifierSuffix).c_str(), "Test IMAGE_BINDING_FORMAT", verifier)) 1506 1507 { 1508 const QueryType verifier = QUERY_INDEXED_ISENABLED; 1509 const char* verifierSuffix = getVerifierSuffix(verifier); 1510 this->addChild(new EnableBlendCase (m_context, (std::string() + "blend_" + verifierSuffix).c_str(), "BLEND", verifier)); 1511 } 1512 FOR_EACH_VEC4_VERIFIER(new ColorMaskCase (m_context, (std::string() + "color_mask_" + verifierSuffix).c_str(), "COLOR_WRITEMASK", verifier)) 1513 FOR_EACH_VERIFIER(new BlendFuncCase (m_context, (std::string() + "blend_func_" + verifierSuffix).c_str(), "BLEND_SRC and BLEND_DST", verifier)) 1514 FOR_EACH_VERIFIER(new BlendEquationCase (m_context, (std::string() + "blend_equation_" + verifierSuffix).c_str(), "BLEND_EQUATION_RGB and BLEND_DST", verifier)) 1515 FOR_EACH_VERIFIER(new BlendEquationAdvancedCase (m_context, (std::string() + "blend_equation_advanced_" + verifierSuffix).c_str(), "BLEND_EQUATION_RGB and BLEND_DST", verifier)) 1516 1517 #undef FOR_EACH_VEC4_VERIFIER 1518 #undef FOR_EACH_VERIFIER 1519 } 1520 1521 } // Functional 1522 } // gles31 1523 } // deqp 1524