1 /*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES 3.1 Module 3 * ------------------------------------------------- 4 * 5 * Copyright 2014 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 Texture buffer tests 22 *//*--------------------------------------------------------------------*/ 23 24 #include "es31fTextureBufferTests.hpp" 25 26 #include "glsTextureBufferCase.hpp" 27 #include "glsStateQueryUtil.hpp" 28 29 #include "tcuTestLog.hpp" 30 31 #include "gluRenderContext.hpp" 32 #include "gluContextInfo.hpp" 33 #include "gluCallLogWrapper.hpp" 34 #include "gluStrUtil.hpp" 35 36 #include "glwEnums.hpp" 37 38 #include "deStringUtil.hpp" 39 40 #include <string> 41 42 using std::string; 43 using namespace deqp::gls::TextureBufferCaseUtil; 44 using deqp::gls::TextureBufferCase; 45 46 namespace deqp 47 { 48 namespace gles31 49 { 50 namespace Functional 51 { 52 namespace 53 { 54 55 string toTestName (RenderBits renderBits) 56 { 57 struct 58 { 59 RenderBits bit; 60 const char* str; 61 } bitInfos[] = 62 { 63 { RENDERBITS_AS_VERTEX_ARRAY, "as_vertex_array" }, 64 { RENDERBITS_AS_INDEX_ARRAY, "as_index_array" }, 65 { RENDERBITS_AS_VERTEX_TEXTURE, "as_vertex_texture" }, 66 { RENDERBITS_AS_FRAGMENT_TEXTURE, "as_fragment_texture" } 67 }; 68 69 std::ostringstream stream; 70 bool first = true; 71 72 DE_ASSERT(renderBits != 0); 73 74 for (int infoNdx = 0; infoNdx < DE_LENGTH_OF_ARRAY(bitInfos); infoNdx++) 75 { 76 if (renderBits & bitInfos[infoNdx].bit) 77 { 78 stream << (first ? "" : "_") << bitInfos[infoNdx].str; 79 first = false; 80 } 81 } 82 83 return stream.str(); 84 } 85 86 string toTestName (ModifyBits modifyBits) 87 { 88 struct 89 { 90 ModifyBits bit; 91 const char* str; 92 } bitInfos[] = 93 { 94 { MODIFYBITS_BUFFERDATA, "bufferdata" }, 95 { MODIFYBITS_BUFFERSUBDATA, "buffersubdata" }, 96 { MODIFYBITS_MAPBUFFER_WRITE, "mapbuffer_write" }, 97 { MODIFYBITS_MAPBUFFER_READWRITE, "mapbuffer_readwrite" } 98 }; 99 100 std::ostringstream stream; 101 bool first = true; 102 103 DE_ASSERT(modifyBits != 0); 104 105 for (int infoNdx = 0; infoNdx < DE_LENGTH_OF_ARRAY(bitInfos); infoNdx++) 106 { 107 if (modifyBits & bitInfos[infoNdx].bit) 108 { 109 stream << (first ? "" : "_") << bitInfos[infoNdx].str; 110 first = false; 111 } 112 } 113 114 return stream.str(); 115 } 116 117 RenderBits operator| (RenderBits a, RenderBits b) 118 { 119 return (RenderBits)(deUint32(a) | deUint32(b)); 120 } 121 122 } // anonymous 123 124 // Queries 125 126 namespace 127 { 128 129 using namespace gls::StateQueryUtil; 130 131 class LimitQueryCase : public TestCase 132 { 133 public: 134 LimitQueryCase (Context& ctx, const char* name, const char* desc, glw::GLenum target, int minLimit, QueryType type); 135 136 private: 137 IterateResult iterate (void); 138 139 const glw::GLenum m_target; 140 const int m_minValue; 141 const QueryType m_type; 142 }; 143 144 LimitQueryCase::LimitQueryCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minLimit, QueryType type) 145 : TestCase (context, name, desc) 146 , m_target (target) 147 , m_minValue (minLimit) 148 , m_type (type) 149 { 150 } 151 152 LimitQueryCase::IterateResult LimitQueryCase::iterate (void) 153 { 154 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 155 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 156 157 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 158 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 159 160 gl.enableLogging(true); 161 verifyStateIntegerMin(result, gl, m_target, m_minValue, m_type); 162 163 result.setTestContextResult(m_testCtx); 164 return STOP; 165 } 166 167 class AlignmentQueryCase : public TestCase 168 { 169 public: 170 AlignmentQueryCase (Context& ctx, const char* name, const char* desc, glw::GLenum target, int maxAlign, QueryType type); 171 172 private: 173 IterateResult iterate (void); 174 175 const glw::GLenum m_target; 176 const int m_maxValue; 177 const QueryType m_type; 178 }; 179 180 AlignmentQueryCase::AlignmentQueryCase (Context& context, const char* name, const char* desc, glw::GLenum target, int maxAlign, QueryType type) 181 : TestCase (context, name, desc) 182 , m_target (target) 183 , m_maxValue (maxAlign) 184 , m_type (type) 185 { 186 } 187 188 AlignmentQueryCase::IterateResult AlignmentQueryCase::iterate (void) 189 { 190 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 191 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 192 193 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 194 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 195 196 gl.enableLogging(true); 197 verifyStateIntegerMax(result, gl, m_target, m_maxValue, m_type); 198 199 result.setTestContextResult(m_testCtx); 200 return STOP; 201 } 202 203 class TextureBufferBindingQueryCase : public TestCase 204 { 205 public: 206 TextureBufferBindingQueryCase (Context& ctx, const char* name, const char* desc, QueryType type); 207 208 private: 209 IterateResult iterate (void); 210 211 const QueryType m_type; 212 }; 213 214 TextureBufferBindingQueryCase::TextureBufferBindingQueryCase (Context& context, const char* name, const char* desc, QueryType type) 215 : TestCase (context, name, desc) 216 , m_type (type) 217 { 218 } 219 220 TextureBufferBindingQueryCase::IterateResult TextureBufferBindingQueryCase::iterate (void) 221 { 222 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 223 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 224 225 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 226 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 227 228 gl.enableLogging(true); 229 230 // initial 231 { 232 const tcu::ScopedLogSection section(m_testCtx.getLog(), "initial", "Initial value"); 233 234 verifyStateInteger(result, gl, GL_TEXTURE_BUFFER_BINDING, 0, m_type); 235 } 236 237 // bind 238 { 239 const tcu::ScopedLogSection section(m_testCtx.getLog(), "bind", "After bind"); 240 241 glw::GLuint buffer; 242 243 gl.glGenBuffers(1, &buffer); 244 gl.glBindBuffer(GL_TEXTURE_BUFFER, buffer); 245 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind buffer"); 246 247 verifyStateInteger(result, gl, GL_TEXTURE_BUFFER_BINDING, buffer, m_type); 248 249 gl.glDeleteBuffers(1, &buffer); 250 } 251 252 // after delete 253 { 254 const tcu::ScopedLogSection section(m_testCtx.getLog(), "bind", "After delete"); 255 256 verifyStateInteger(result, gl, GL_TEXTURE_BUFFER_BINDING, 0, m_type); 257 } 258 259 result.setTestContextResult(m_testCtx); 260 return STOP; 261 } 262 263 class TextureBindingBufferQueryCase : public TestCase 264 { 265 public: 266 TextureBindingBufferQueryCase (Context& ctx, const char* name, const char* desc, QueryType type); 267 268 private: 269 IterateResult iterate (void); 270 271 const QueryType m_type; 272 }; 273 274 TextureBindingBufferQueryCase::TextureBindingBufferQueryCase (Context& context, const char* name, const char* desc, QueryType type) 275 : TestCase (context, name, desc) 276 , m_type (type) 277 { 278 } 279 280 TextureBindingBufferQueryCase::IterateResult TextureBindingBufferQueryCase::iterate (void) 281 { 282 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 283 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 284 285 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 286 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 287 288 gl.enableLogging(true); 289 290 // initial 291 { 292 const tcu::ScopedLogSection section(m_testCtx.getLog(), "initial", "Initial value"); 293 294 verifyStateInteger(result, gl, GL_TEXTURE_BINDING_BUFFER, 0, m_type); 295 } 296 297 // bind 298 { 299 const tcu::ScopedLogSection section(m_testCtx.getLog(), "bind", "After bind"); 300 301 glw::GLuint texture; 302 303 gl.glGenTextures(1, &texture); 304 gl.glBindTexture(GL_TEXTURE_BUFFER, texture); 305 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind texture"); 306 307 verifyStateInteger(result, gl, GL_TEXTURE_BINDING_BUFFER, texture, m_type); 308 309 gl.glDeleteTextures(1, &texture); 310 } 311 312 // after delete 313 { 314 const tcu::ScopedLogSection section(m_testCtx.getLog(), "bind", "After delete"); 315 316 verifyStateInteger(result, gl, GL_TEXTURE_BINDING_BUFFER, 0, m_type); 317 } 318 319 result.setTestContextResult(m_testCtx); 320 return STOP; 321 } 322 323 class TextureBufferDataStoreQueryCase : public TestCase 324 { 325 public: 326 TextureBufferDataStoreQueryCase (Context& ctx, const char* name, const char* desc, QueryType type); 327 328 private: 329 IterateResult iterate (void); 330 331 const QueryType m_type; 332 }; 333 334 TextureBufferDataStoreQueryCase::TextureBufferDataStoreQueryCase (Context& context, const char* name, const char* desc, QueryType type) 335 : TestCase (context, name, desc) 336 , m_type (type) 337 { 338 } 339 340 TextureBufferDataStoreQueryCase::IterateResult TextureBufferDataStoreQueryCase::iterate (void) 341 { 342 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 343 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 344 345 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 346 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 347 348 gl.enableLogging(true); 349 350 // non-buffer 351 { 352 const tcu::ScopedLogSection section(m_testCtx.getLog(), "NonBuffer", "Non-buffer"); 353 354 glw::GLuint texture; 355 356 gl.glGenTextures(1, &texture); 357 gl.glBindTexture(GL_TEXTURE_2D, texture); 358 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 359 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "gen texture"); 360 361 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_2D, 0, GL_TEXTURE_BUFFER_DATA_STORE_BINDING, 0, m_type); 362 363 gl.glDeleteTextures(1, &texture); 364 } 365 366 // buffer 367 { 368 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Buffer", "Texture buffer"); 369 370 glw::GLuint texture; 371 glw::GLuint buffer; 372 373 gl.glGenTextures(1, &texture); 374 gl.glBindTexture(GL_TEXTURE_BUFFER, texture); 375 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind texture"); 376 377 gl.glGenBuffers(1, &buffer); 378 gl.glBindBuffer(GL_TEXTURE_BUFFER, buffer); 379 gl.glBufferData(GL_TEXTURE_BUFFER, 32, DE_NULL, GL_STATIC_DRAW); 380 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind buf"); 381 382 gl.glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, buffer); 383 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "tex buffer"); 384 385 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_DATA_STORE_BINDING, buffer, m_type); 386 387 gl.glDeleteTextures(1, &texture); 388 gl.glDeleteBuffers(1, &buffer); 389 } 390 391 result.setTestContextResult(m_testCtx); 392 return STOP; 393 } 394 395 class TextureBufferOffsetQueryCase : public TestCase 396 { 397 public: 398 TextureBufferOffsetQueryCase (Context& ctx, const char* name, const char* desc, QueryType type); 399 400 private: 401 IterateResult iterate (void); 402 403 const QueryType m_type; 404 }; 405 406 TextureBufferOffsetQueryCase::TextureBufferOffsetQueryCase (Context& context, const char* name, const char* desc, QueryType type) 407 : TestCase (context, name, desc) 408 , m_type (type) 409 { 410 } 411 412 TextureBufferOffsetQueryCase::IterateResult TextureBufferOffsetQueryCase::iterate (void) 413 { 414 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 415 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 416 417 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 418 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 419 420 gl.enableLogging(true); 421 422 // non-buffer 423 { 424 const tcu::ScopedLogSection section(m_testCtx.getLog(), "NonBuffer", "Non-buffer"); 425 426 glw::GLuint texture; 427 428 gl.glGenTextures(1, &texture); 429 gl.glBindTexture(GL_TEXTURE_2D, texture); 430 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 431 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "gen texture"); 432 433 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_2D, 0, GL_TEXTURE_BUFFER_OFFSET, 0, m_type); 434 435 gl.glDeleteTextures(1, &texture); 436 } 437 438 // buffer 439 { 440 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Buffer", "Texture buffer"); 441 442 glw::GLuint texture; 443 glw::GLuint buffer; 444 445 gl.glGenTextures(1, &texture); 446 gl.glBindTexture(GL_TEXTURE_BUFFER, texture); 447 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind texture"); 448 449 gl.glGenBuffers(1, &buffer); 450 gl.glBindBuffer(GL_TEXTURE_BUFFER, buffer); 451 gl.glBufferData(GL_TEXTURE_BUFFER, 1024, DE_NULL, GL_STATIC_DRAW); 452 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind buf"); 453 454 { 455 const tcu::ScopedLogSection subsection(m_testCtx.getLog(), "Offset0", "Offset 0"); 456 gl.glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, buffer); 457 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "tex buffer"); 458 459 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_OFFSET, 0, m_type); 460 } 461 { 462 const tcu::ScopedLogSection subsection(m_testCtx.getLog(), "Offset256", "Offset 256"); 463 gl.glTexBufferRange(GL_TEXTURE_BUFFER, GL_R32UI, buffer, 256, 512); 464 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "tex buffer"); 465 466 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_OFFSET, 256, m_type); 467 } 468 469 gl.glDeleteTextures(1, &texture); 470 gl.glDeleteBuffers(1, &buffer); 471 } 472 473 result.setTestContextResult(m_testCtx); 474 return STOP; 475 } 476 477 class TextureBufferSizeQueryCase : public TestCase 478 { 479 public: 480 TextureBufferSizeQueryCase (Context& ctx, const char* name, const char* desc, QueryType type); 481 482 private: 483 IterateResult iterate (void); 484 485 const QueryType m_type; 486 }; 487 488 TextureBufferSizeQueryCase::TextureBufferSizeQueryCase (Context& context, const char* name, const char* desc, QueryType type) 489 : TestCase (context, name, desc) 490 , m_type (type) 491 { 492 } 493 494 TextureBufferSizeQueryCase::IterateResult TextureBufferSizeQueryCase::iterate (void) 495 { 496 const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); 497 TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"), "GL_EXT_texture_buffer is not supported"); 498 499 glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog()); 500 tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: "); 501 502 gl.enableLogging(true); 503 504 // non-buffer 505 { 506 const tcu::ScopedLogSection section(m_testCtx.getLog(), "NonBuffer", "Non-buffer"); 507 508 glw::GLuint texture; 509 510 gl.glGenTextures(1, &texture); 511 gl.glBindTexture(GL_TEXTURE_2D, texture); 512 gl.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 32, 32); 513 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "gen texture"); 514 515 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_2D, 0, GL_TEXTURE_BUFFER_SIZE, 0, m_type); 516 517 gl.glDeleteTextures(1, &texture); 518 } 519 520 // buffer 521 { 522 const tcu::ScopedLogSection section(m_testCtx.getLog(), "Buffer", "Texture buffer"); 523 524 glw::GLuint texture; 525 glw::GLuint buffer; 526 527 gl.glGenTextures(1, &texture); 528 gl.glBindTexture(GL_TEXTURE_BUFFER, texture); 529 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind texture"); 530 531 gl.glGenBuffers(1, &buffer); 532 gl.glBindBuffer(GL_TEXTURE_BUFFER, buffer); 533 gl.glBufferData(GL_TEXTURE_BUFFER, 1024, DE_NULL, GL_STATIC_DRAW); 534 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind buf"); 535 536 { 537 const tcu::ScopedLogSection subsection(m_testCtx.getLog(), "SizeAll", "Bind whole buffer"); 538 gl.glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, buffer); 539 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "tex buffer"); 540 541 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_SIZE, 1024, m_type); 542 } 543 { 544 const tcu::ScopedLogSection subsection(m_testCtx.getLog(), "Partial", "Partial buffer"); 545 gl.glTexBufferRange(GL_TEXTURE_BUFFER, GL_R32UI, buffer, 256, 512); 546 GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "tex buffer"); 547 548 verifyStateTextureLevelInteger(result, gl, GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_SIZE, 512, m_type); 549 } 550 551 gl.glDeleteTextures(1, &texture); 552 gl.glDeleteBuffers(1, &buffer); 553 } 554 555 result.setTestContextResult(m_testCtx); 556 return STOP; 557 } 558 559 } // anonymous 560 561 TestCaseGroup* createTextureBufferTests (Context& context) 562 { 563 TestCaseGroup* const root = new TestCaseGroup(context, "texture_buffer", "Texture buffer syncronization tests"); 564 565 const size_t bufferSizes[] = 566 { 567 512, 568 513, 569 65536, 570 65537, 571 131071 572 }; 573 574 const size_t rangeSizes[] = 575 { 576 512, 577 513, 578 65537, 579 98304, 580 }; 581 582 const size_t offsets[] = 583 { 584 1, 585 7 586 }; 587 588 const RenderBits renderTypeCombinations[] = 589 { 590 RENDERBITS_AS_VERTEX_ARRAY, 591 RENDERBITS_AS_INDEX_ARRAY, 592 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_INDEX_ARRAY, 593 594 RENDERBITS_AS_VERTEX_TEXTURE, 595 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_VERTEX_TEXTURE, 596 RENDERBITS_AS_INDEX_ARRAY | RENDERBITS_AS_VERTEX_TEXTURE, 597 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_INDEX_ARRAY | RENDERBITS_AS_VERTEX_TEXTURE, 598 599 RENDERBITS_AS_FRAGMENT_TEXTURE, 600 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_FRAGMENT_TEXTURE, 601 RENDERBITS_AS_INDEX_ARRAY | RENDERBITS_AS_FRAGMENT_TEXTURE, 602 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_INDEX_ARRAY | RENDERBITS_AS_FRAGMENT_TEXTURE, 603 RENDERBITS_AS_VERTEX_TEXTURE | RENDERBITS_AS_FRAGMENT_TEXTURE, 604 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_VERTEX_TEXTURE | RENDERBITS_AS_FRAGMENT_TEXTURE, 605 RENDERBITS_AS_INDEX_ARRAY | RENDERBITS_AS_VERTEX_TEXTURE | RENDERBITS_AS_FRAGMENT_TEXTURE, 606 RENDERBITS_AS_VERTEX_ARRAY | RENDERBITS_AS_INDEX_ARRAY | RENDERBITS_AS_VERTEX_TEXTURE | RENDERBITS_AS_FRAGMENT_TEXTURE 607 }; 608 609 const ModifyBits modifyTypes[] = 610 { 611 MODIFYBITS_BUFFERDATA, 612 MODIFYBITS_BUFFERSUBDATA, 613 MODIFYBITS_MAPBUFFER_WRITE, 614 MODIFYBITS_MAPBUFFER_READWRITE 615 }; 616 617 // State and limit queries 618 { 619 TestCaseGroup* const queryGroup = new TestCaseGroup(context, "state_query", "Query states and limits"); 620 root->addChild(queryGroup); 621 622 queryGroup->addChild(new LimitQueryCase (context, "max_texture_buffer_size_getboolean", "Test MAX_TEXTURE_BUFFER_SIZE", GL_MAX_TEXTURE_BUFFER_SIZE, 65536, QUERY_BOOLEAN)); 623 queryGroup->addChild(new LimitQueryCase (context, "max_texture_buffer_size_getinteger", "Test MAX_TEXTURE_BUFFER_SIZE", GL_MAX_TEXTURE_BUFFER_SIZE, 65536, QUERY_INTEGER)); 624 queryGroup->addChild(new LimitQueryCase (context, "max_texture_buffer_size_getinteger64", "Test MAX_TEXTURE_BUFFER_SIZE", GL_MAX_TEXTURE_BUFFER_SIZE, 65536, QUERY_INTEGER64)); 625 queryGroup->addChild(new LimitQueryCase (context, "max_texture_buffer_size_getfloat", "Test MAX_TEXTURE_BUFFER_SIZE", GL_MAX_TEXTURE_BUFFER_SIZE, 65536, QUERY_FLOAT)); 626 queryGroup->addChild(new AlignmentQueryCase (context, "texture_buffer_offset_alignment_getboolean", "Test TEXTURE_BUFFER_OFFSET_ALIGNMENT", GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, 256, QUERY_BOOLEAN)); 627 queryGroup->addChild(new AlignmentQueryCase (context, "texture_buffer_offset_alignment_getinteger", "Test TEXTURE_BUFFER_OFFSET_ALIGNMENT", GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, 256, QUERY_INTEGER)); 628 queryGroup->addChild(new AlignmentQueryCase (context, "texture_buffer_offset_alignment_getinteger64", "Test TEXTURE_BUFFER_OFFSET_ALIGNMENT", GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, 256, QUERY_INTEGER64)); 629 queryGroup->addChild(new AlignmentQueryCase (context, "texture_buffer_offset_alignment_getfloat", "Test TEXTURE_BUFFER_OFFSET_ALIGNMENT", GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, 256, QUERY_FLOAT)); 630 631 queryGroup->addChild(new TextureBufferBindingQueryCase(context, "texture_buffer_binding_getboolean", "TEXTURE_BUFFER_BINDING", QUERY_BOOLEAN)); 632 queryGroup->addChild(new TextureBufferBindingQueryCase(context, "texture_buffer_binding_getinteger", "TEXTURE_BUFFER_BINDING", QUERY_INTEGER)); 633 queryGroup->addChild(new TextureBufferBindingQueryCase(context, "texture_buffer_binding_getinteger64", "TEXTURE_BUFFER_BINDING", QUERY_INTEGER64)); 634 queryGroup->addChild(new TextureBufferBindingQueryCase(context, "texture_buffer_binding_getfloat", "TEXTURE_BUFFER_BINDING", QUERY_FLOAT)); 635 636 queryGroup->addChild(new TextureBindingBufferQueryCase(context, "texture_binding_buffer_getboolean", "TEXTURE_BINDING_BUFFER", QUERY_BOOLEAN)); 637 queryGroup->addChild(new TextureBindingBufferQueryCase(context, "texture_binding_buffer_getinteger", "TEXTURE_BINDING_BUFFER", QUERY_INTEGER)); 638 queryGroup->addChild(new TextureBindingBufferQueryCase(context, "texture_binding_buffer_getinteger64", "TEXTURE_BINDING_BUFFER", QUERY_INTEGER64)); 639 queryGroup->addChild(new TextureBindingBufferQueryCase(context, "texture_binding_buffer_getfloat", "TEXTURE_BINDING_BUFFER", QUERY_FLOAT)); 640 641 queryGroup->addChild(new TextureBufferDataStoreQueryCase(context, "texture_buffer_data_store_binding_integer", "TEXTURE_BUFFER_DATA_STORE_BINDING", QUERY_TEXTURE_LEVEL_INTEGER)); 642 queryGroup->addChild(new TextureBufferDataStoreQueryCase(context, "texture_buffer_data_store_binding_float", "TEXTURE_BUFFER_DATA_STORE_BINDING", QUERY_TEXTURE_LEVEL_FLOAT)); 643 644 queryGroup->addChild(new TextureBufferOffsetQueryCase(context, "texture_buffer_offset_integer", "TEXTURE_BUFFER_OFFSET", QUERY_TEXTURE_LEVEL_INTEGER)); 645 queryGroup->addChild(new TextureBufferOffsetQueryCase(context, "texture_buffer_offset_float", "TEXTURE_BUFFER_OFFSET", QUERY_TEXTURE_LEVEL_FLOAT)); 646 647 queryGroup->addChild(new TextureBufferSizeQueryCase(context, "texture_buffer_size_integer", "TEXTURE_BUFFER_SIZE", QUERY_TEXTURE_LEVEL_INTEGER)); 648 queryGroup->addChild(new TextureBufferSizeQueryCase(context, "texture_buffer_size_float", "TEXTURE_BUFFER_SIZE", QUERY_TEXTURE_LEVEL_FLOAT)); 649 } 650 651 // Rendering test 652 { 653 TestCaseGroup* const renderGroup = new TestCaseGroup(context, "render", "Setup texture buffer with glBufferData and render data in different ways"); 654 root->addChild(renderGroup); 655 656 for (int renderTypeNdx = 0; renderTypeNdx < DE_LENGTH_OF_ARRAY(renderTypeCombinations); renderTypeNdx++) 657 { 658 const RenderBits renderType = renderTypeCombinations[renderTypeNdx]; 659 TestCaseGroup* const renderTypeGroup = new TestCaseGroup(context, toTestName(renderType).c_str(), toTestName(renderType).c_str()); 660 661 renderGroup->addChild(renderTypeGroup); 662 663 for (int sizeNdx = 0; sizeNdx < DE_LENGTH_OF_ARRAY(bufferSizes); sizeNdx++) 664 { 665 const size_t size = bufferSizes[sizeNdx]; 666 const string name ("buffer_size_" + de::toString(size)); 667 668 renderTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, size, 0, 0, RENDERBITS_NONE, MODIFYBITS_NONE, renderType, name.c_str(), name.c_str())); 669 } 670 671 for (int sizeNdx = 0; sizeNdx < DE_LENGTH_OF_ARRAY(rangeSizes); sizeNdx++) 672 { 673 const size_t size = rangeSizes[sizeNdx]; 674 const string name ("range_size_" + de::toString(size)); 675 const size_t bufferSize = 131072; 676 677 renderTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, bufferSize, 0, size, RENDERBITS_NONE, MODIFYBITS_NONE, renderType, name.c_str(), name.c_str())); 678 } 679 680 for (int offsetNdx = 0; offsetNdx < DE_LENGTH_OF_ARRAY(offsets); offsetNdx++) 681 { 682 const size_t offset = offsets[offsetNdx]; 683 const size_t bufferSize = 131072; 684 const size_t size = 65537; 685 const string name ("offset_" + de::toString(offset) + "_alignments"); 686 687 renderTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, bufferSize, offset, size, RENDERBITS_NONE, MODIFYBITS_NONE, renderType, name.c_str(), name.c_str())); 688 } 689 } 690 } 691 692 // Modify tests 693 { 694 TestCaseGroup* const modifyGroup = new TestCaseGroup(context, "modify", "Modify texture buffer content in multiple ways"); 695 root->addChild(modifyGroup); 696 697 for (int modifyNdx = 0; modifyNdx < DE_LENGTH_OF_ARRAY(modifyTypes); modifyNdx++) 698 { 699 const ModifyBits modifyType = modifyTypes[modifyNdx]; 700 TestCaseGroup* const modifyTypeGroup = new TestCaseGroup(context, toTestName(modifyType).c_str(), toTestName(modifyType).c_str()); 701 702 modifyGroup->addChild(modifyTypeGroup); 703 704 for (int sizeNdx = 0; sizeNdx < DE_LENGTH_OF_ARRAY(bufferSizes); sizeNdx++) 705 { 706 const size_t size = bufferSizes[sizeNdx]; 707 const string name ("buffer_size_" + de::toString(size)); 708 709 modifyTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, size, 0, 0, RENDERBITS_NONE, modifyType, RENDERBITS_AS_FRAGMENT_TEXTURE, name.c_str(), name.c_str())); 710 } 711 712 for (int sizeNdx = 0; sizeNdx < DE_LENGTH_OF_ARRAY(rangeSizes); sizeNdx++) 713 { 714 const size_t size = rangeSizes[sizeNdx]; 715 const string name ("range_size_" + de::toString(size)); 716 const size_t bufferSize = 131072; 717 718 modifyTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, bufferSize, 0, size, RENDERBITS_NONE, modifyType, RENDERBITS_AS_FRAGMENT_TEXTURE, name.c_str(), name.c_str())); 719 } 720 721 for (int offsetNdx = 0; offsetNdx < DE_LENGTH_OF_ARRAY(offsets); offsetNdx++) 722 { 723 const size_t offset = offsets[offsetNdx]; 724 const size_t bufferSize = 131072; 725 const size_t size = 65537; 726 const string name ("offset_" + de::toString(offset) + "_alignments"); 727 728 modifyTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, bufferSize, offset, size, RENDERBITS_NONE, modifyType, RENDERBITS_AS_FRAGMENT_TEXTURE, name.c_str(), name.c_str())); 729 } 730 } 731 } 732 733 // Modify-Render tests 734 { 735 TestCaseGroup* const modifyRenderGroup = new TestCaseGroup(context, "modify_render", "Modify texture buffer content in multiple ways and render in different ways"); 736 root->addChild(modifyRenderGroup); 737 738 for (int modifyNdx = 0; modifyNdx < DE_LENGTH_OF_ARRAY(modifyTypes); modifyNdx++) 739 { 740 const ModifyBits modifyType = modifyTypes[modifyNdx]; 741 TestCaseGroup* const modifyTypeGroup = new TestCaseGroup(context, toTestName(modifyType).c_str(), toTestName(modifyType).c_str()); 742 743 modifyRenderGroup->addChild(modifyTypeGroup); 744 745 for (int renderTypeNdx = 0; renderTypeNdx < DE_LENGTH_OF_ARRAY(renderTypeCombinations); renderTypeNdx++) 746 { 747 const RenderBits renderType = renderTypeCombinations[renderTypeNdx]; 748 const size_t size = 16*1024; 749 const string name (toTestName(renderType)); 750 751 modifyTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, size, 0, 0, RENDERBITS_NONE, modifyType, renderType, name.c_str(), name.c_str())); 752 } 753 } 754 } 755 756 // Render-Modify tests 757 { 758 TestCaseGroup* const renderModifyGroup = new TestCaseGroup(context, "render_modify", "Render texture buffer and modify."); 759 root->addChild(renderModifyGroup); 760 761 for (int renderTypeNdx = 0; renderTypeNdx < DE_LENGTH_OF_ARRAY(renderTypeCombinations); renderTypeNdx++) 762 { 763 const RenderBits renderType = renderTypeCombinations[renderTypeNdx]; 764 TestCaseGroup* const renderTypeGroup = new TestCaseGroup(context, toTestName(renderType).c_str(), toTestName(renderType).c_str()); 765 766 renderModifyGroup->addChild(renderTypeGroup); 767 768 for (int modifyNdx = 0; modifyNdx < DE_LENGTH_OF_ARRAY(modifyTypes); modifyNdx++) 769 { 770 const ModifyBits modifyType = modifyTypes[modifyNdx]; 771 const size_t size = 16*1024; 772 const string name (toTestName(modifyType)); 773 774 renderTypeGroup->addChild(new TextureBufferCase(context.getTestContext(), context.getRenderContext(), GL_RGBA8, size, 0, 0, renderType, modifyType, RENDERBITS_AS_FRAGMENT_TEXTURE, name.c_str(), name.c_str())); 775 } 776 } 777 } 778 779 return root; 780 } 781 782 } // Functional 783 } // gles31 784 } // deqp 785