Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef GL_GLEXT_PROTOTYPES | 5 #ifndef GL_GLEXT_PROTOTYPES |
| 6 #define GL_GLEXT_PROTOTYPES | 6 #define GL_GLEXT_PROTOTYPES |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 EXPECT_EQ(framebuffer_id_, fb_id); | 69 EXPECT_EQ(framebuffer_id_, fb_id); |
| 70 | 70 |
| 71 // Check that FB is complete. | 71 // Check that FB is complete. |
| 72 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 72 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 73 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 73 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 74 | 74 |
| 75 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | 75 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); |
| 76 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 76 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 TEST_F(GLCopyTextureCHROMIUMTest, ImmutableTexture) { | |
| 80 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { | |
|
no sievers
2014/11/21 18:39:49
nit: can you put LOG(INFO) << "GL_EXT_texture_stor
| |
| 81 return; | |
| 82 } | |
| 83 | |
| 84 uint8 pixels[1 * 4] = {255u, 0u, 0u, 255u}; | |
| 85 | |
| 86 glBindTexture(GL_TEXTURE_2D, textures_[0]); | |
| 87 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | |
| 88 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | |
| 89 pixels); | |
| 90 | |
| 91 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
| 92 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | |
| 93 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | |
| 94 textures_[1], 0); | |
| 95 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 96 | |
| 97 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, | |
| 98 GL_UNSIGNED_BYTE); | |
| 99 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
| 100 | |
| 101 // Check the FB is still bound. | |
| 102 GLint value = 0; | |
| 103 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | |
| 104 GLuint fb_id = value; | |
| 105 EXPECT_EQ(framebuffer_id_, fb_id); | |
| 106 | |
| 107 // Check that FB is complete. | |
| 108 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | |
| 109 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | |
| 110 | |
| 111 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | |
| 112 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
| 113 } | |
| 114 | |
| 79 TEST_F(GLCopyTextureCHROMIUMTest, InternalFormat) { | 115 TEST_F(GLCopyTextureCHROMIUMTest, InternalFormat) { |
| 80 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, | 116 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, |
| 81 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; | 117 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; |
| 82 GLint dest_formats[] = {GL_RGB, GL_RGBA}; | 118 GLint dest_formats[] = {GL_RGB, GL_RGBA}; |
| 83 | 119 |
| 84 for (size_t src_index = 0; src_index < arraysize(src_formats); src_index++) { | 120 for (size_t src_index = 0; src_index < arraysize(src_formats); src_index++) { |
| 85 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); | 121 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); |
| 86 dest_index++) { | 122 dest_index++) { |
| 87 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 123 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 88 glTexImage2D(GL_TEXTURE_2D, | 124 glTexImage2D(GL_TEXTURE_2D, |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 EXPECT_EQ(0, pixels[y][x][1]); | 659 EXPECT_EQ(0, pixels[y][x][1]); |
| 624 EXPECT_EQ(0, pixels[y][x][2]); | 660 EXPECT_EQ(0, pixels[y][x][2]); |
| 625 EXPECT_EQ(0, pixels[y][x][3]); | 661 EXPECT_EQ(0, pixels[y][x][3]); |
| 626 } | 662 } |
| 627 } | 663 } |
| 628 | 664 |
| 629 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 665 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 630 } | 666 } |
| 631 | 667 |
| 632 } // namespace gpu | 668 } // namespace gpu |
| OLD | NEW |