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")) { | |
81 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test..."; | |
82 return; | |
83 } | |
84 | |
85 uint8 pixels[1 * 4] = {255u, 0u, 0u, 255u}; | |
86 | |
87 glBindTexture(GL_TEXTURE_2D, textures_[0]); | |
88 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | |
89 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | |
90 pixels); | |
91 | |
92 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
93 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | |
94 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | |
95 textures_[1], 0); | |
96 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
97 | |
98 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, | |
99 GL_UNSIGNED_BYTE); | |
100 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
101 | |
102 // Check the FB is still bound. | |
103 GLint value = 0; | |
104 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | |
105 GLuint fb_id = value; | |
106 EXPECT_EQ(framebuffer_id_, fb_id); | |
107 | |
108 // Check that FB is complete. | |
109 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | |
110 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | |
111 | |
112 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | |
113 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
114 } | |
115 | |
116 TEST_F(GLCopyTextureCHROMIUMTest, InternalFormat) { | 79 TEST_F(GLCopyTextureCHROMIUMTest, InternalFormat) { |
117 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, | 80 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, |
118 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; | 81 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; |
119 GLint dest_formats[] = {GL_RGB, GL_RGBA}; | 82 GLint dest_formats[] = {GL_RGB, GL_RGBA}; |
120 | 83 |
121 for (size_t src_index = 0; src_index < arraysize(src_formats); src_index++) { | 84 for (size_t src_index = 0; src_index < arraysize(src_formats); src_index++) { |
122 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); | 85 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); |
123 dest_index++) { | 86 dest_index++) { |
124 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 87 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
125 glTexImage2D(GL_TEXTURE_2D, | 88 glTexImage2D(GL_TEXTURE_2D, |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 EXPECT_EQ(0, pixels[y][x][1]); | 623 EXPECT_EQ(0, pixels[y][x][1]); |
661 EXPECT_EQ(0, pixels[y][x][2]); | 624 EXPECT_EQ(0, pixels[y][x][2]); |
662 EXPECT_EQ(0, pixels[y][x][3]); | 625 EXPECT_EQ(0, pixels[y][x][3]); |
663 } | 626 } |
664 } | 627 } |
665 | 628 |
666 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 629 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
667 } | 630 } |
668 | 631 |
669 } // namespace gpu | 632 } // namespace gpu |
OLD | NEW |