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 | 8 |
9 #include "gpu/command_buffer/client/gles2_lib.h" | 9 #include "gpu/command_buffer/client/gles2_lib.h" |
10 #include "gpu/command_buffer/common/mailbox.h" | 10 #include "gpu/command_buffer/common/mailbox.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 gl2_.decoder()->ProduceFrontBuffer(mailbox); | 334 gl2_.decoder()->ProduceFrontBuffer(mailbox); |
335 | 335 |
336 gl1_.MakeCurrent(); | 336 gl1_.MakeCurrent(); |
337 GLuint tex1; | 337 GLuint tex1; |
338 glGenTextures(1, &tex1); | 338 glGenTextures(1, &tex1); |
339 glBindTexture(GL_TEXTURE_2D, tex1); | 339 glBindTexture(GL_TEXTURE_2D, tex1); |
340 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 340 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
341 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 341 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
342 | 342 |
343 gl2_.MakeCurrent(); | 343 gl2_.MakeCurrent(); |
344 glResizeCHROMIUM(10, 10, 1); | 344 glResizeCHROMIUM(10, 10, 1, true); |
345 glClearColor(1, 0, 0, 1); | 345 glClearColor(1, 0, 0, 1); |
346 glClear(GL_COLOR_BUFFER_BIT); | 346 glClear(GL_COLOR_BUFFER_BIT); |
347 ::gles2::GetGLContext()->SwapBuffers(); | 347 ::gles2::GetGLContext()->SwapBuffers(); |
348 | 348 |
349 gl1_.MakeCurrent(); | 349 gl1_.MakeCurrent(); |
350 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 0, 0)); | 350 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 0, 0)); |
351 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 9, 9)); | 351 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 9, 9)); |
352 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 352 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
353 | 353 |
354 gl2_.MakeCurrent(); | 354 gl2_.MakeCurrent(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 gl1_.MakeCurrent(); | 424 gl1_.MakeCurrent(); |
425 for (size_t i = 0; i < 2; ++i) { | 425 for (size_t i = 0; i < 2; ++i) { |
426 glBindTexture(GL_TEXTURE_2D, tex[i]); | 426 glBindTexture(GL_TEXTURE_2D, tex[i]); |
427 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox[i].name); | 427 glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox[i].name); |
428 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 428 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
429 } | 429 } |
430 | 430 |
431 for (size_t i = 0; i < 2; ++i) { | 431 for (size_t i = 0; i < 2; ++i) { |
432 other_gl[i].MakeCurrent(); | 432 other_gl[i].MakeCurrent(); |
433 glResizeCHROMIUM(10, 10, 1); | 433 glResizeCHROMIUM(10, 10, 1, true); |
434 glClearColor(1-i%2, i%2, 0, 1); | 434 glClearColor(1-i%2, i%2, 0, 1); |
435 glClear(GL_COLOR_BUFFER_BIT); | 435 glClear(GL_COLOR_BUFFER_BIT); |
436 ::gles2::GetGLContext()->SwapBuffers(); | 436 ::gles2::GetGLContext()->SwapBuffers(); |
437 } | 437 } |
438 | 438 |
439 gl1_.MakeCurrent(); | 439 gl1_.MakeCurrent(); |
440 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex[0], 0, 0)); | 440 EXPECT_EQ(0xFF0000FFu, ReadTexel(tex[0], 0, 0)); |
441 EXPECT_EQ(0xFF00FF00u, ReadTexel(tex[1], 9, 9)); | 441 EXPECT_EQ(0xFF00FF00u, ReadTexel(tex[1], 9, 9)); |
442 | 442 |
443 for (size_t i = 0; i < 2; ++i) { | 443 for (size_t i = 0; i < 2; ++i) { |
444 other_gl[i].MakeCurrent(); | 444 other_gl[i].MakeCurrent(); |
445 other_gl[i].Destroy(); | 445 other_gl[i].Destroy(); |
446 } | 446 } |
447 | 447 |
448 gl1_.MakeCurrent(); | 448 gl1_.MakeCurrent(); |
449 glDeleteTextures(2, tex); | 449 glDeleteTextures(2, tex); |
450 } | 450 } |
451 #endif | 451 #endif |
452 | 452 |
453 } // namespace gpu | 453 } // namespace gpu |
454 | 454 |
OLD | NEW |