| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
| 6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
| 7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 glBindFramebuffer(GL_FRAMEBUFFER, old_fbo); | 49 glBindFramebuffer(GL_FRAMEBUFFER, old_fbo); |
| 50 | 50 |
| 51 glDeleteFramebuffers(1, &fbo); | 51 glDeleteFramebuffers(1, &fbo); |
| 52 | 52 |
| 53 return texel; | 53 return texel; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 class GLTextureMailboxTest : public testing::Test { | 57 class GLTextureMailboxTest : public testing::Test { |
| 58 protected: | 58 protected: |
| 59 void SetUp() override { | 59 void SetUpContexts() { |
| 60 gl1_.Initialize(GLManager::Options()); | 60 gl1_.Initialize(GLManager::Options()); |
| 61 GLManager::Options options; | 61 GLManager::Options options; |
| 62 options.share_mailbox_manager = &gl1_; | 62 options.share_mailbox_manager = &gl1_; |
| 63 gl2_.Initialize(options); | 63 gl2_.Initialize(options); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void TearDown() override { | 66 void TearDown() override { |
| 67 gl1_.Destroy(); | 67 gl1_.Destroy(); |
| 68 gl2_.Destroy(); | 68 gl2_.Destroy(); |
| 69 } | 69 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 89 glFlush(); | 89 glFlush(); |
| 90 gl1_.MakeCurrent(); | 90 gl1_.MakeCurrent(); |
| 91 return mailbox; | 91 return mailbox; |
| 92 } | 92 } |
| 93 | 93 |
| 94 GLManager gl1_; | 94 GLManager gl1_; |
| 95 GLManager gl2_; | 95 GLManager gl2_; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 TEST_F(GLTextureMailboxTest, ProduceAndConsumeTexture) { | 98 TEST_F(GLTextureMailboxTest, ProduceAndConsumeTexture) { |
| 99 SetUpContexts(); |
| 99 gl1_.MakeCurrent(); | 100 gl1_.MakeCurrent(); |
| 100 | 101 |
| 101 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; | 102 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; |
| 102 glGenMailboxCHROMIUM(mailbox1); | 103 glGenMailboxCHROMIUM(mailbox1); |
| 103 | 104 |
| 104 GLbyte mailbox2[GL_MAILBOX_SIZE_CHROMIUM]; | 105 GLbyte mailbox2[GL_MAILBOX_SIZE_CHROMIUM]; |
| 105 glGenMailboxCHROMIUM(mailbox2); | 106 glGenMailboxCHROMIUM(mailbox2); |
| 106 | 107 |
| 107 GLuint tex1; | 108 GLuint tex1; |
| 108 glGenTextures(1, &tex1); | 109 glGenTextures(1, &tex1); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 133 glFlush(); | 134 glFlush(); |
| 134 | 135 |
| 135 gl1_.MakeCurrent(); | 136 gl1_.MakeCurrent(); |
| 136 | 137 |
| 137 glBindTexture(GL_TEXTURE_2D, tex1); | 138 glBindTexture(GL_TEXTURE_2D, tex1); |
| 138 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox2); | 139 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox2); |
| 139 EXPECT_EQ(source_pixel, ReadTexel(tex1, 0, 0)); | 140 EXPECT_EQ(source_pixel, ReadTexel(tex1, 0, 0)); |
| 140 } | 141 } |
| 141 | 142 |
| 142 TEST_F(GLTextureMailboxTest, ProduceAndConsumeTextureRGB) { | 143 TEST_F(GLTextureMailboxTest, ProduceAndConsumeTextureRGB) { |
| 144 SetUpContexts(); |
| 143 gl1_.MakeCurrent(); | 145 gl1_.MakeCurrent(); |
| 144 | 146 |
| 145 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; | 147 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; |
| 146 glGenMailboxCHROMIUM(mailbox1); | 148 glGenMailboxCHROMIUM(mailbox1); |
| 147 | 149 |
| 148 GLbyte mailbox2[GL_MAILBOX_SIZE_CHROMIUM]; | 150 GLbyte mailbox2[GL_MAILBOX_SIZE_CHROMIUM]; |
| 149 glGenMailboxCHROMIUM(mailbox2); | 151 glGenMailboxCHROMIUM(mailbox2); |
| 150 | 152 |
| 151 GLuint tex1; | 153 GLuint tex1; |
| 152 glGenTextures(1, &tex1); | 154 glGenTextures(1, &tex1); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 177 glFlush(); | 179 glFlush(); |
| 178 | 180 |
| 179 gl1_.MakeCurrent(); | 181 gl1_.MakeCurrent(); |
| 180 | 182 |
| 181 glBindTexture(GL_TEXTURE_2D, tex1); | 183 glBindTexture(GL_TEXTURE_2D, tex1); |
| 182 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox2); | 184 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox2); |
| 183 EXPECT_EQ(source_pixel, ReadTexel(tex1, 0, 0)); | 185 EXPECT_EQ(source_pixel, ReadTexel(tex1, 0, 0)); |
| 184 } | 186 } |
| 185 | 187 |
| 186 TEST_F(GLTextureMailboxTest, ProduceAndConsumeTextureDirect) { | 188 TEST_F(GLTextureMailboxTest, ProduceAndConsumeTextureDirect) { |
| 189 SetUpContexts(); |
| 187 gl1_.MakeCurrent(); | 190 gl1_.MakeCurrent(); |
| 188 | 191 |
| 189 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; | 192 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; |
| 190 glGenMailboxCHROMIUM(mailbox1); | 193 glGenMailboxCHROMIUM(mailbox1); |
| 191 | 194 |
| 192 GLbyte mailbox2[GL_MAILBOX_SIZE_CHROMIUM]; | 195 GLbyte mailbox2[GL_MAILBOX_SIZE_CHROMIUM]; |
| 193 glGenMailboxCHROMIUM(mailbox2); | 196 glGenMailboxCHROMIUM(mailbox2); |
| 194 | 197 |
| 195 GLuint tex1; | 198 GLuint tex1; |
| 196 glGenTextures(1, &tex1); | 199 glGenTextures(1, &tex1); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 218 glFlush(); | 221 glFlush(); |
| 219 | 222 |
| 220 gl1_.MakeCurrent(); | 223 gl1_.MakeCurrent(); |
| 221 | 224 |
| 222 GLuint tex3 = glCreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox2); | 225 GLuint tex3 = glCreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox2); |
| 223 glBindTexture(GL_TEXTURE_2D, tex3); | 226 glBindTexture(GL_TEXTURE_2D, tex3); |
| 224 EXPECT_EQ(source_pixel, ReadTexel(tex3, 0, 0)); | 227 EXPECT_EQ(source_pixel, ReadTexel(tex3, 0, 0)); |
| 225 } | 228 } |
| 226 | 229 |
| 227 TEST_F(GLTextureMailboxTest, ConsumeTextureValidatesKey) { | 230 TEST_F(GLTextureMailboxTest, ConsumeTextureValidatesKey) { |
| 231 SetUpContexts(); |
| 228 GLuint tex; | 232 GLuint tex; |
| 229 glGenTextures(1, &tex); | 233 glGenTextures(1, &tex); |
| 230 | 234 |
| 231 glBindTexture(GL_TEXTURE_2D, tex); | 235 glBindTexture(GL_TEXTURE_2D, tex); |
| 232 uint32_t source_pixel = 0xFF0000FF; | 236 uint32_t source_pixel = 0xFF0000FF; |
| 233 glTexImage2D(GL_TEXTURE_2D, | 237 glTexImage2D(GL_TEXTURE_2D, |
| 234 0, | 238 0, |
| 235 GL_RGBA, | 239 GL_RGBA, |
| 236 1, 1, | 240 1, 1, |
| 237 0, | 241 0, |
| 238 GL_RGBA, | 242 GL_RGBA, |
| 239 GL_UNSIGNED_BYTE, | 243 GL_UNSIGNED_BYTE, |
| 240 &source_pixel); | 244 &source_pixel); |
| 241 | 245 |
| 242 GLbyte invalid_mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | 246 GLbyte invalid_mailbox[GL_MAILBOX_SIZE_CHROMIUM]; |
| 243 glGenMailboxCHROMIUM(invalid_mailbox); | 247 glGenMailboxCHROMIUM(invalid_mailbox); |
| 244 | 248 |
| 245 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 249 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 246 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, invalid_mailbox); | 250 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, invalid_mailbox); |
| 247 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); | 251 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
| 248 | 252 |
| 249 // Ensure level 0 is still intact after glConsumeTextureCHROMIUM fails. | 253 // Ensure level 0 is still intact after glConsumeTextureCHROMIUM fails. |
| 250 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 254 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 251 EXPECT_EQ(source_pixel, ReadTexel(tex, 0, 0)); | 255 EXPECT_EQ(source_pixel, ReadTexel(tex, 0, 0)); |
| 252 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 256 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 253 } | 257 } |
| 254 | 258 |
| 255 TEST_F(GLTextureMailboxTest, SharedTextures) { | 259 TEST_F(GLTextureMailboxTest, SharedTextures) { |
| 260 SetUpContexts(); |
| 256 gl1_.MakeCurrent(); | 261 gl1_.MakeCurrent(); |
| 257 GLuint tex1; | 262 GLuint tex1; |
| 258 glGenTextures(1, &tex1); | 263 glGenTextures(1, &tex1); |
| 259 | 264 |
| 260 glBindTexture(GL_TEXTURE_2D, tex1); | 265 glBindTexture(GL_TEXTURE_2D, tex1); |
| 261 uint32_t source_pixel = 0xFF0000FF; | 266 uint32_t source_pixel = 0xFF0000FF; |
| 262 glTexImage2D(GL_TEXTURE_2D, | 267 glTexImage2D(GL_TEXTURE_2D, |
| 263 0, | 268 0, |
| 264 GL_RGBA, | 269 GL_RGBA, |
| 265 1, 1, | 270 1, 1, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // Mailbox should be gone now. | 349 // Mailbox should be gone now. |
| 345 glGenTextures(1, &tex2); | 350 glGenTextures(1, &tex2); |
| 346 glBindTexture(GL_TEXTURE_2D, tex2); | 351 glBindTexture(GL_TEXTURE_2D, tex2); |
| 347 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox); | 352 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox); |
| 348 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); | 353 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
| 349 glDeleteTextures(1, &tex2); | 354 glDeleteTextures(1, &tex2); |
| 350 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 355 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 351 } | 356 } |
| 352 | 357 |
| 353 TEST_F(GLTextureMailboxTest, TakeFrontBuffer) { | 358 TEST_F(GLTextureMailboxTest, TakeFrontBuffer) { |
| 359 SetUpContexts(); |
| 354 gl1_.MakeCurrent(); | 360 gl1_.MakeCurrent(); |
| 355 Mailbox mailbox; | 361 Mailbox mailbox; |
| 356 glGenMailboxCHROMIUM(mailbox.name); | 362 glGenMailboxCHROMIUM(mailbox.name); |
| 357 | 363 |
| 358 gl2_.MakeCurrent(); | 364 gl2_.MakeCurrent(); |
| 359 glResizeCHROMIUM(10, 10, 1, true); | 365 glResizeCHROMIUM(10, 10, 1, true); |
| 360 glClearColor(0, 1, 1, 1); | 366 glClearColor(0, 1, 1, 1); |
| 361 glClear(GL_COLOR_BUFFER_BIT); | 367 glClear(GL_COLOR_BUFFER_BIT); |
| 362 ::gles2::GetGLContext()->SwapBuffers(); | 368 ::gles2::GetGLContext()->SwapBuffers(); |
| 363 gl2_.decoder()->TakeFrontBuffer(mailbox); | 369 gl2_.decoder()->TakeFrontBuffer(mailbox); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 411 |
| 406 gl1_.MakeCurrent(); | 412 gl1_.MakeCurrent(); |
| 407 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 0, 0)); | 413 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 0, 0)); |
| 408 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 414 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 409 glDeleteTextures(1, &tex1); | 415 glDeleteTextures(1, &tex1); |
| 410 } | 416 } |
| 411 | 417 |
| 412 // The client, represented by |gl2_|, will request 5 frontbuffers, and then | 418 // The client, represented by |gl2_|, will request 5 frontbuffers, and then |
| 413 // start returning them. | 419 // start returning them. |
| 414 TEST_F(GLTextureMailboxTest, FrontBufferCache) { | 420 TEST_F(GLTextureMailboxTest, FrontBufferCache) { |
| 421 SetUpContexts(); |
| 415 gl1_.MakeCurrent(); | 422 gl1_.MakeCurrent(); |
| 416 | 423 |
| 417 std::vector<Mailbox> mailboxes; | 424 std::vector<Mailbox> mailboxes; |
| 418 for (int i = 0; i < 5; ++i) { | 425 for (int i = 0; i < 5; ++i) { |
| 419 Mailbox mailbox = TakeAndConsumeMailbox(); | 426 Mailbox mailbox = TakeAndConsumeMailbox(); |
| 420 mailboxes.push_back(mailbox); | 427 mailboxes.push_back(mailbox); |
| 421 } | 428 } |
| 422 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); | 429 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); |
| 423 EXPECT_EQ(5u, gl1_.decoder()->GetCreatedBackTextureCountForTest()); | 430 EXPECT_EQ(5u, gl1_.decoder()->GetCreatedBackTextureCountForTest()); |
| 424 | 431 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 444 } | 451 } |
| 445 | 452 |
| 446 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); | 453 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); |
| 447 EXPECT_EQ(105u, gl1_.decoder()->GetCreatedBackTextureCountForTest()); | 454 EXPECT_EQ(105u, gl1_.decoder()->GetCreatedBackTextureCountForTest()); |
| 448 } | 455 } |
| 449 | 456 |
| 450 // The client, represented by |gl2_|, will request and return 5 frontbuffers. | 457 // The client, represented by |gl2_|, will request and return 5 frontbuffers. |
| 451 // Then the size of the buffer will be changed. All cached frontbuffers should | 458 // Then the size of the buffer will be changed. All cached frontbuffers should |
| 452 // be discarded. | 459 // be discarded. |
| 453 TEST_F(GLTextureMailboxTest, FrontBufferChangeSize) { | 460 TEST_F(GLTextureMailboxTest, FrontBufferChangeSize) { |
| 461 SetUpContexts(); |
| 454 gl1_.MakeCurrent(); | 462 gl1_.MakeCurrent(); |
| 455 | 463 |
| 456 std::vector<Mailbox> mailboxes; | 464 std::vector<Mailbox> mailboxes; |
| 457 for (int i = 0; i < 5; ++i) { | 465 for (int i = 0; i < 5; ++i) { |
| 458 Mailbox mailbox = TakeAndConsumeMailbox(); | 466 Mailbox mailbox = TakeAndConsumeMailbox(); |
| 459 mailboxes.push_back(mailbox); | 467 mailboxes.push_back(mailbox); |
| 460 } | 468 } |
| 461 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); | 469 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); |
| 462 | 470 |
| 463 for (int i = 0; i < 5; ++i) { | 471 for (int i = 0; i < 5; ++i) { |
| 464 gl1_.decoder()->ReturnFrontBuffer(mailboxes[i], false); | 472 gl1_.decoder()->ReturnFrontBuffer(mailboxes[i], false); |
| 465 } | 473 } |
| 466 mailboxes.clear(); | 474 mailboxes.clear(); |
| 467 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); | 475 EXPECT_EQ(5u, gl1_.decoder()->GetSavedBackTextureCountForTest()); |
| 468 | 476 |
| 469 glResizeCHROMIUM(21, 31, 1, true); | 477 glResizeCHROMIUM(21, 31, 1, true); |
| 470 ::gles2::GetGLContext()->SwapBuffers(); | 478 ::gles2::GetGLContext()->SwapBuffers(); |
| 471 EXPECT_EQ(0u, gl1_.decoder()->GetSavedBackTextureCountForTest()); | 479 EXPECT_EQ(0u, gl1_.decoder()->GetSavedBackTextureCountForTest()); |
| 472 } | 480 } |
| 473 | 481 |
| 482 // The client, represented by |gl2_|, will request and return 5 frontbuffers. |
| 483 // Then |gl1_| will start drawing with a different color. The returned |
| 484 // frontbuffers should pick up the new color. |
| 485 TEST_F(GLTextureMailboxTest, FrontBufferChangeColor) { |
| 486 GLManager::Options options1; |
| 487 options1.multisampled = true; |
| 488 gl1_.Initialize(options1); |
| 489 |
| 490 GLManager::Options options2; |
| 491 options2.share_mailbox_manager = &gl1_; |
| 492 gl2_.Initialize(options2); |
| 493 |
| 494 gl1_.MakeCurrent(); |
| 495 std::vector<Mailbox> mailboxes; |
| 496 for (int i = 0; i < 5; ++i) { |
| 497 Mailbox mailbox = TakeAndConsumeMailbox(); |
| 498 mailboxes.push_back(mailbox); |
| 499 } |
| 500 |
| 501 for (int i = 0; i < 5; ++i) { |
| 502 gl1_.decoder()->ReturnFrontBuffer(mailboxes[i], false); |
| 503 } |
| 504 mailboxes.clear(); |
| 505 |
| 506 for (int i = 0; i < 5; ++i) { |
| 507 glClearColor(1, 0, 0, 1); |
| 508 glClear(GL_COLOR_BUFFER_BIT); |
| 509 ::gles2::GetGLContext()->SwapBuffers(); |
| 510 |
| 511 Mailbox mailbox; |
| 512 glGenMailboxCHROMIUM(mailbox.name); |
| 513 gl1_.decoder()->TakeFrontBuffer(mailbox); |
| 514 |
| 515 // Normally, consumers of TakeFrontBuffer() must supply their own |
| 516 // synchronization mechanism. For this test, just use a glFinish(). |
| 517 glFinish(); |
| 518 |
| 519 gl2_.MakeCurrent(); |
| 520 GLuint tex; |
| 521 glGenTextures(1, &tex); |
| 522 glBindTexture(GL_TEXTURE_2D, tex); |
| 523 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 524 |
| 525 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex, 0, 0)); |
| 526 |
| 527 glDeleteTextures(1, &tex); |
| 528 glFlush(); |
| 529 gl1_.MakeCurrent(); |
| 530 } |
| 531 } |
| 532 |
| 474 TEST_F(GLTextureMailboxTest, ProduceTextureDirectInvalidTarget) { | 533 TEST_F(GLTextureMailboxTest, ProduceTextureDirectInvalidTarget) { |
| 534 SetUpContexts(); |
| 475 gl1_.MakeCurrent(); | 535 gl1_.MakeCurrent(); |
| 476 | 536 |
| 477 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; | 537 GLbyte mailbox1[GL_MAILBOX_SIZE_CHROMIUM]; |
| 478 glGenMailboxCHROMIUM(mailbox1); | 538 glGenMailboxCHROMIUM(mailbox1); |
| 479 | 539 |
| 480 GLuint tex1; | 540 GLuint tex1; |
| 481 glGenTextures(1, &tex1); | 541 glGenTextures(1, &tex1); |
| 482 | 542 |
| 483 glBindTexture(GL_TEXTURE_CUBE_MAP, tex1); | 543 glBindTexture(GL_TEXTURE_CUBE_MAP, tex1); |
| 484 uint32_t source_pixel = 0xFF0000FF; | 544 uint32_t source_pixel = 0xFF0000FF; |
| 485 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, | 545 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, |
| 486 0, | 546 0, |
| 487 GL_RGBA, | 547 GL_RGBA, |
| 488 1, 1, | 548 1, 1, |
| 489 0, | 549 0, |
| 490 GL_RGBA, | 550 GL_RGBA, |
| 491 GL_UNSIGNED_BYTE, | 551 GL_UNSIGNED_BYTE, |
| 492 &source_pixel); | 552 &source_pixel); |
| 493 | 553 |
| 494 glProduceTextureDirectCHROMIUM(tex1, GL_TEXTURE_2D, mailbox1); | 554 glProduceTextureDirectCHROMIUM(tex1, GL_TEXTURE_2D, mailbox1); |
| 495 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); | 555 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
| 496 } | 556 } |
| 497 | 557 |
| 498 // http://crbug.com/281565 | 558 // http://crbug.com/281565 |
| 499 #if !defined(OS_ANDROID) | 559 #if !defined(OS_ANDROID) |
| 500 TEST_F(GLTextureMailboxTest, TakeFrontBufferMultipleContexts) { | 560 TEST_F(GLTextureMailboxTest, TakeFrontBufferMultipleContexts) { |
| 561 SetUpContexts(); |
| 501 gl1_.MakeCurrent(); | 562 gl1_.MakeCurrent(); |
| 502 Mailbox mailbox[2]; | 563 Mailbox mailbox[2]; |
| 503 glGenMailboxCHROMIUM(mailbox[0].name); | 564 glGenMailboxCHROMIUM(mailbox[0].name); |
| 504 glGenMailboxCHROMIUM(mailbox[1].name); | 565 glGenMailboxCHROMIUM(mailbox[1].name); |
| 505 GLuint tex[2]; | 566 GLuint tex[2]; |
| 506 glGenTextures(2, tex); | 567 glGenTextures(2, tex); |
| 507 | 568 |
| 508 GLManager::Options options; | 569 GLManager::Options options; |
| 509 options.share_mailbox_manager = &gl1_; | 570 options.share_mailbox_manager = &gl1_; |
| 510 GLManager other_gl[2]; | 571 GLManager other_gl[2]; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 537 other_gl[i].Destroy(); | 598 other_gl[i].Destroy(); |
| 538 } | 599 } |
| 539 | 600 |
| 540 gl1_.MakeCurrent(); | 601 gl1_.MakeCurrent(); |
| 541 glDeleteTextures(2, tex); | 602 glDeleteTextures(2, tex); |
| 542 } | 603 } |
| 543 #endif | 604 #endif |
| 544 | 605 |
| 545 } // namespace gpu | 606 } // namespace gpu |
| 546 | 607 |
| OLD | NEW |