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> |
11 #include <GLES2/gl2extchromium.h> | 11 #include <GLES2/gl2extchromium.h> |
12 | 12 |
13 #include "gpu/command_buffer/tests/gl_manager.h" | 13 #include "gpu/command_buffer/tests/gl_manager.h" |
14 #include "gpu/command_buffer/tests/gl_test_utils.h" | 14 #include "gpu/command_buffer/tests/gl_test_utils.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace gpu { | 18 namespace gpu { |
19 | 19 |
20 namespace { | |
21 enum CopyType { TexImage, TexSubImage }; | |
22 const CopyType kCopyTypes[] = { | |
23 TexImage, | |
24 TexSubImage, | |
25 }; | |
26 } | |
27 | |
28 // A collection of tests that exercise the GL_CHROMIUM_copy_texture extension. | 20 // A collection of tests that exercise the GL_CHROMIUM_copy_texture extension. |
29 class GLCopyTextureCHROMIUMTest | 21 class GLCopyTextureCHROMIUMTest : public testing::Test { |
30 : public testing::Test, | |
31 public ::testing::WithParamInterface<CopyType> { | |
32 protected: | 22 protected: |
33 void SetUp() override { | 23 void SetUp() override { |
34 gl_.Initialize(GLManager::Options()); | 24 gl_.Initialize(GLManager::Options()); |
35 | 25 |
36 glGenTextures(2, textures_); | 26 glGenTextures(2, textures_); |
37 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 27 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
38 | 28 |
39 // Some drivers (NVidia/SGX) require texture settings to be a certain way or | 29 // Some drivers (NVidia/SGX) require texture settings to be a certain way or |
40 // they won't report FRAMEBUFFER_COMPLETE. | 30 // they won't report FRAMEBUFFER_COMPLETE. |
41 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 31 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
(...skipping 11 matching lines...) Expand all Loading... |
53 glDeleteTextures(2, textures_); | 43 glDeleteTextures(2, textures_); |
54 glDeleteFramebuffers(1, &framebuffer_id_); | 44 glDeleteFramebuffers(1, &framebuffer_id_); |
55 gl_.Destroy(); | 45 gl_.Destroy(); |
56 } | 46 } |
57 | 47 |
58 GLManager gl_; | 48 GLManager gl_; |
59 GLuint textures_[2]; | 49 GLuint textures_[2]; |
60 GLuint framebuffer_id_; | 50 GLuint framebuffer_id_; |
61 }; | 51 }; |
62 | 52 |
63 INSTANTIATE_TEST_CASE_P(CopyType, | |
64 GLCopyTextureCHROMIUMTest, | |
65 ::testing::ValuesIn(kCopyTypes)); | |
66 | |
67 // Test to ensure that the basic functionality of the extension works. | 53 // Test to ensure that the basic functionality of the extension works. |
68 TEST_P(GLCopyTextureCHROMIUMTest, Basic) { | 54 TEST_F(GLCopyTextureCHROMIUMTest, Basic) { |
69 CopyType copy_type = GetParam(); | |
70 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 55 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
71 | 56 |
72 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 57 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
73 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 58 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
74 pixels); | 59 pixels); |
75 | 60 |
76 if (copy_type == TexImage) { | 61 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
77 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 62 GL_UNSIGNED_BYTE); |
78 GL_UNSIGNED_BYTE); | |
79 } else { | |
80 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
81 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
82 nullptr); | |
83 | |
84 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
85 } | |
86 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 63 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
87 | 64 |
88 // Check the FB is still bound. | 65 // Check the FB is still bound. |
89 GLint value = 0; | 66 GLint value = 0; |
90 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 67 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
91 GLuint fb_id = value; | 68 GLuint fb_id = value; |
92 EXPECT_EQ(framebuffer_id_, fb_id); | 69 EXPECT_EQ(framebuffer_id_, fb_id); |
93 | 70 |
94 // Check that FB is complete. | 71 // Check that FB is complete. |
95 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 72 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
96 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 73 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
97 | 74 |
98 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | 75 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); |
99 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 76 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
100 } | 77 } |
101 | 78 |
102 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { | 79 TEST_F(GLCopyTextureCHROMIUMTest, InternalFormat) { |
103 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { | |
104 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test..."; | |
105 return; | |
106 } | |
107 CopyType copy_type = GetParam(); | |
108 | |
109 uint8 pixels[1 * 4] = {255u, 0u, 0u, 255u}; | |
110 | |
111 glBindTexture(GL_TEXTURE_2D, textures_[0]); | |
112 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | |
113 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | |
114 pixels); | |
115 | |
116 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
117 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | |
118 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | |
119 textures_[1], 0); | |
120 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
121 | |
122 if (copy_type == TexImage) { | |
123 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | |
124 GL_UNSIGNED_BYTE); | |
125 EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); | |
126 } else { | |
127 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
128 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
129 | |
130 // Check the FB is still bound. | |
131 GLint value = 0; | |
132 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | |
133 GLuint fb_id = value; | |
134 EXPECT_EQ(framebuffer_id_, fb_id); | |
135 | |
136 // Check that FB is complete. | |
137 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | |
138 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | |
139 | |
140 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels); | |
141 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
142 } | |
143 } | |
144 | |
145 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { | |
146 CopyType copy_type = GetParam(); | |
147 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, | 80 GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, |
148 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; | 81 GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; |
149 GLint dest_formats[] = {GL_RGB, GL_RGBA}; | 82 GLint dest_formats[] = {GL_RGB, GL_RGBA}; |
150 | 83 |
151 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++) { |
152 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); | 85 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); |
153 dest_index++) { | 86 dest_index++) { |
154 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 87 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
155 glTexImage2D(GL_TEXTURE_2D, 0, src_formats[src_index], 1, 1, 0, | 88 glTexImage2D(GL_TEXTURE_2D, |
156 src_formats[src_index], GL_UNSIGNED_BYTE, nullptr); | 89 0, |
| 90 src_formats[src_index], |
| 91 1, |
| 92 1, |
| 93 0, |
| 94 src_formats[src_index], |
| 95 GL_UNSIGNED_BYTE, |
| 96 NULL); |
157 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 97 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
158 | 98 |
159 if (copy_type == TexImage) { | 99 glCopyTextureCHROMIUM(GL_TEXTURE_2D, |
160 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], | 100 textures_[0], |
161 dest_formats[dest_index], GL_UNSIGNED_BYTE); | 101 textures_[1], |
162 } else { | 102 0, |
163 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 103 dest_formats[dest_index], |
164 glTexImage2D(GL_TEXTURE_2D, 0, dest_formats[dest_index], 1, 1, 0, | 104 GL_UNSIGNED_BYTE); |
165 dest_formats[dest_index], GL_UNSIGNED_BYTE, nullptr); | |
166 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
167 | |
168 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, | |
169 0); | |
170 } | |
171 | |
172 EXPECT_TRUE(GL_NO_ERROR == glGetError()) << "src_index:" << src_index | 105 EXPECT_TRUE(GL_NO_ERROR == glGetError()) << "src_index:" << src_index |
173 << " dest_index:" << dest_index; | 106 << " dest_index:" << dest_index; |
174 } | 107 } |
175 } | 108 } |
176 } | 109 } |
177 | 110 |
178 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { | 111 TEST_F(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { |
179 CopyType copy_type = GetParam(); | |
180 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 112 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
181 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 113 glTexImage2D( |
182 nullptr); | 114 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
183 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 115 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
184 | 116 |
185 // Check unsupported format reports error. | 117 // Check unsupported format reports error. |
186 GLint unsupported_dest_formats[] = {GL_ALPHA, GL_LUMINANCE, | 118 GLint unsupported_dest_formats[] = {GL_ALPHA, GL_LUMINANCE, |
187 GL_LUMINANCE_ALPHA}; | 119 GL_LUMINANCE_ALPHA}; |
188 for (size_t dest_index = 0; dest_index < arraysize(unsupported_dest_formats); | 120 for (size_t dest_index = 0; dest_index < arraysize(unsupported_dest_formats); |
189 dest_index++) { | 121 dest_index++) { |
190 if (copy_type == TexImage) { | 122 glCopyTextureCHROMIUM(GL_TEXTURE_2D, |
191 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], | 123 textures_[0], |
192 unsupported_dest_formats[dest_index], | 124 textures_[1], |
193 GL_UNSIGNED_BYTE); | 125 0, |
194 } else { | 126 unsupported_dest_formats[dest_index], |
195 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 127 GL_UNSIGNED_BYTE); |
196 glTexImage2D(GL_TEXTURE_2D, 0, unsupported_dest_formats[dest_index], 1, 1, | |
197 0, unsupported_dest_formats[dest_index], GL_UNSIGNED_BYTE, | |
198 nullptr); | |
199 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
200 } | |
201 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()) | 128 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()) |
202 << "dest_index:" << dest_index; | 129 << "dest_index:" << dest_index; |
203 } | 130 } |
204 } | 131 } |
205 | 132 |
206 // Test to ensure that the destination texture is redefined if the properties | 133 // Test to ensure that the destination texture is redefined if the properties |
207 // are different. | 134 // are different. |
208 TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { | 135 TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { |
209 uint8 pixels[4 * 4] = {255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u, | 136 uint8 pixels[4 * 4] = {255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u, |
210 255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u}; | 137 255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u}; |
(...skipping 18 matching lines...) Expand all Loading... |
229 glTexSubImage2D( | 156 glTexSubImage2D( |
230 GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 157 GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
231 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); | 158 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); |
232 // GL_INVALID_VALUE due to bad dimensions. | 159 // GL_INVALID_VALUE due to bad dimensions. |
233 glTexSubImage2D( | 160 glTexSubImage2D( |
234 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels); | 161 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels); |
235 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 162 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
236 | 163 |
237 // If the dest texture has different properties, glCopyTextureCHROMIUM() | 164 // If the dest texture has different properties, glCopyTextureCHROMIUM() |
238 // redefines them. | 165 // redefines them. |
239 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 166 glCopyTextureCHROMIUM( |
240 GL_UNSIGNED_BYTE); | 167 GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, GL_UNSIGNED_BYTE); |
241 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 168 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
242 | 169 |
243 // glTexSubImage2D() succeeds because textures_[1] is redefined into 2x2 | 170 // glTexSubImage2D() succeeds because textures_[1] is redefined into 2x2 |
244 // dimension and GL_RGBA format. | 171 // dimension and GL_RGBA format. |
245 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 172 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
246 glTexSubImage2D( | 173 glTexSubImage2D( |
247 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 174 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
248 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 175 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
249 | 176 |
250 // Check the FB is still bound. | 177 // Check the FB is still bound. |
251 GLint value = 0; | 178 GLint value = 0; |
252 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 179 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
253 GLuint fb_id = value; | 180 GLuint fb_id = value; |
254 EXPECT_EQ(framebuffer_id_, fb_id); | 181 EXPECT_EQ(framebuffer_id_, fb_id); |
255 | 182 |
256 // Check that FB is complete. | 183 // Check that FB is complete. |
257 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 184 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
258 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 185 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
259 | 186 |
260 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12]); | 187 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12]); |
261 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 188 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
262 } | 189 } |
263 | 190 |
264 // Test that the extension respects the flip-y pixel storage setting. | 191 // Test that the extension respects the flip-y pixel storage setting. |
265 TEST_P(GLCopyTextureCHROMIUMTest, FlipY) { | 192 TEST_F(GLCopyTextureCHROMIUMTest, FlipY) { |
266 CopyType copy_type = GetParam(); | |
267 uint8 pixels[2][2][4]; | 193 uint8 pixels[2][2][4]; |
268 for (int x = 0; x < 2; ++x) { | 194 for (int x = 0; x < 2; ++x) { |
269 for (int y = 0; y < 2; ++y) { | 195 for (int y = 0; y < 2; ++y) { |
270 pixels[y][x][0] = x + y; | 196 pixels[y][x][0] = x + y; |
271 pixels[y][x][1] = x + y; | 197 pixels[y][x][1] = x + y; |
272 pixels[y][x][2] = x + y; | 198 pixels[y][x][2] = x + y; |
273 pixels[y][x][3] = 255u; | 199 pixels[y][x][3] = 255u; |
274 } | 200 } |
275 } | 201 } |
276 | 202 |
277 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 203 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
278 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 204 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
279 pixels); | 205 pixels); |
280 | 206 |
281 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 207 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
282 | 208 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
283 if (copy_type == TexImage) { | 209 GL_UNSIGNED_BYTE); |
284 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | |
285 GL_UNSIGNED_BYTE); | |
286 } else { | |
287 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
288 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
289 nullptr); | |
290 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
291 } | |
292 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 210 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
293 | 211 |
294 uint8 copied_pixels[2][2][4] = {{{0}}}; | 212 uint8 copied_pixels[2][2][4] = {{{0}}}; |
295 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 213 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
296 for (int x = 0; x < 2; ++x) { | 214 for (int x = 0; x < 2; ++x) { |
297 for (int y = 0; y < 2; ++y) { | 215 for (int y = 0; y < 2; ++y) { |
298 EXPECT_EQ(pixels[1-y][x][0], copied_pixels[y][x][0]); | 216 EXPECT_EQ(pixels[1-y][x][0], copied_pixels[y][x][0]); |
299 EXPECT_EQ(pixels[1-y][x][1], copied_pixels[y][x][1]); | 217 EXPECT_EQ(pixels[1-y][x][1], copied_pixels[y][x][1]); |
300 EXPECT_EQ(pixels[1-y][x][2], copied_pixels[y][x][2]); | 218 EXPECT_EQ(pixels[1-y][x][2], copied_pixels[y][x][2]); |
301 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); | 219 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); |
302 } | 220 } |
303 } | 221 } |
304 | 222 |
305 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 223 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
306 } | 224 } |
307 | 225 |
308 // Test that the extension respects the GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM | 226 // Test that the extension respects the GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM |
309 // storage setting. | 227 // storage setting. |
310 TEST_P(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) { | 228 TEST_F(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) { |
311 CopyType copy_type = GetParam(); | |
312 uint8 pixels[1 * 4] = { 2, 2, 2, 128 }; | 229 uint8 pixels[1 * 4] = { 2, 2, 2, 128 }; |
313 | 230 |
314 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 231 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
315 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 232 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
316 pixels); | 233 pixels); |
317 | 234 |
318 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 235 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
319 if (copy_type == TexImage) { | 236 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
320 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 237 GL_UNSIGNED_BYTE); |
321 GL_UNSIGNED_BYTE); | |
322 } else { | |
323 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
324 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
325 nullptr); | |
326 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
327 } | |
328 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 238 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
329 | 239 |
330 uint8 copied_pixels[1 * 4] = {0}; | 240 uint8 copied_pixels[1 * 4] = {0}; |
331 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 241 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
332 EXPECT_EQ(1u, copied_pixels[0]); | 242 EXPECT_EQ(1u, copied_pixels[0]); |
333 EXPECT_EQ(1u, copied_pixels[1]); | 243 EXPECT_EQ(1u, copied_pixels[1]); |
334 EXPECT_EQ(1u, copied_pixels[2]); | 244 EXPECT_EQ(1u, copied_pixels[2]); |
335 EXPECT_EQ(128u, copied_pixels[3]); | 245 EXPECT_EQ(128u, copied_pixels[3]); |
336 | 246 |
337 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 247 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
338 } | 248 } |
339 | 249 |
340 // Test that the extension respects the GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM | 250 // Test that the extension respects the GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM |
341 // storage setting. | 251 // storage setting. |
342 TEST_P(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) { | 252 TEST_F(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) { |
343 CopyType copy_type = GetParam(); | |
344 uint8 pixels[1 * 4] = { 16, 16, 16, 128 }; | 253 uint8 pixels[1 * 4] = { 16, 16, 16, 128 }; |
345 | 254 |
346 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 255 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
347 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 256 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
348 pixels); | 257 pixels); |
349 | 258 |
350 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 259 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
351 if (copy_type == TexImage) { | 260 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
352 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 261 GL_UNSIGNED_BYTE); |
353 GL_UNSIGNED_BYTE); | |
354 } else { | |
355 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
356 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
357 nullptr); | |
358 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
359 } | |
360 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 262 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
361 | 263 |
362 uint8 copied_pixels[1 * 4] = {0}; | 264 uint8 copied_pixels[1 * 4] = {0}; |
363 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 265 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
364 EXPECT_EQ(32u, copied_pixels[0]); | 266 EXPECT_EQ(32u, copied_pixels[0]); |
365 EXPECT_EQ(32u, copied_pixels[1]); | 267 EXPECT_EQ(32u, copied_pixels[1]); |
366 EXPECT_EQ(32u, copied_pixels[2]); | 268 EXPECT_EQ(32u, copied_pixels[2]); |
367 EXPECT_EQ(128u, copied_pixels[3]); | 269 EXPECT_EQ(128u, copied_pixels[3]); |
368 | 270 |
369 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 271 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
370 } | 272 } |
371 | 273 |
372 TEST_P(GLCopyTextureCHROMIUMTest, FlipYAndPremultiplyAlpha) { | 274 TEST_F(GLCopyTextureCHROMIUMTest, FlipYAndPremultiplyAlpha) { |
373 CopyType copy_type = GetParam(); | |
374 uint8 pixels[2][2][4]; | 275 uint8 pixels[2][2][4]; |
375 for (int x = 0; x < 2; ++x) { | 276 for (int x = 0; x < 2; ++x) { |
376 for (int y = 0; y < 2; ++y) { | 277 for (int y = 0; y < 2; ++y) { |
377 uint8 color = 16 * x + 16 * y; | 278 uint8 color = 16 * x + 16 * y; |
378 pixels[y][x][0] = color; | 279 pixels[y][x][0] = color; |
379 pixels[y][x][1] = color; | 280 pixels[y][x][1] = color; |
380 pixels[y][x][2] = color; | 281 pixels[y][x][2] = color; |
381 pixels[y][x][3] = 128u; | 282 pixels[y][x][3] = 128u; |
382 } | 283 } |
383 } | 284 } |
384 | 285 |
385 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 286 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
386 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 287 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
387 pixels); | 288 pixels); |
388 | 289 |
389 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 290 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
390 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 291 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
391 if (copy_type == TexImage) { | 292 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
392 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 293 GL_UNSIGNED_BYTE); |
393 GL_UNSIGNED_BYTE); | |
394 } else { | |
395 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
396 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
397 nullptr); | |
398 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
399 } | |
400 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 294 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
401 | 295 |
402 uint8 copied_pixels[2][2][4] = {{{0}}}; | 296 uint8 copied_pixels[2][2][4] = {{{0}}}; |
403 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 297 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
404 for (int x = 0; x < 2; ++x) { | 298 for (int x = 0; x < 2; ++x) { |
405 for (int y = 0; y < 2; ++y) { | 299 for (int y = 0; y < 2; ++y) { |
406 EXPECT_EQ(pixels[1-y][x][0] / 2, copied_pixels[y][x][0]); | 300 EXPECT_EQ(pixels[1-y][x][0] / 2, copied_pixels[y][x][0]); |
407 EXPECT_EQ(pixels[1-y][x][1] / 2, copied_pixels[y][x][1]); | 301 EXPECT_EQ(pixels[1-y][x][1] / 2, copied_pixels[y][x][1]); |
408 EXPECT_EQ(pixels[1-y][x][2] / 2, copied_pixels[y][x][2]); | 302 EXPECT_EQ(pixels[1-y][x][2] / 2, copied_pixels[y][x][2]); |
409 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); | 303 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); |
410 } | 304 } |
411 } | 305 } |
412 | 306 |
413 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 307 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
414 } | 308 } |
415 | 309 |
416 TEST_P(GLCopyTextureCHROMIUMTest, FlipYAndUnpremultiplyAlpha) { | 310 TEST_F(GLCopyTextureCHROMIUMTest, FlipYAndUnpremultiplyAlpha) { |
417 CopyType copy_type = GetParam(); | |
418 uint8 pixels[2][2][4]; | 311 uint8 pixels[2][2][4]; |
419 for (int x = 0; x < 2; ++x) { | 312 for (int x = 0; x < 2; ++x) { |
420 for (int y = 0; y < 2; ++y) { | 313 for (int y = 0; y < 2; ++y) { |
421 uint8 color = 16 * x + 16 * y; | 314 uint8 color = 16 * x + 16 * y; |
422 pixels[y][x][0] = color; | 315 pixels[y][x][0] = color; |
423 pixels[y][x][1] = color; | 316 pixels[y][x][1] = color; |
424 pixels[y][x][2] = color; | 317 pixels[y][x][2] = color; |
425 pixels[y][x][3] = 128u; | 318 pixels[y][x][3] = 128u; |
426 } | 319 } |
427 } | 320 } |
428 | 321 |
429 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 322 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
430 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 323 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
431 pixels); | 324 pixels); |
432 | 325 |
433 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 326 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
434 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 327 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
435 if (copy_type == TexImage) { | 328 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
436 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 329 GL_UNSIGNED_BYTE); |
437 GL_UNSIGNED_BYTE); | |
438 } else { | |
439 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
440 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
441 nullptr); | |
442 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
443 } | |
444 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 330 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
445 | 331 |
446 uint8 copied_pixels[2][2][4] = {{{0}}}; | 332 uint8 copied_pixels[2][2][4] = {{{0}}}; |
447 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 333 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
448 for (int x = 0; x < 2; ++x) { | 334 for (int x = 0; x < 2; ++x) { |
449 for (int y = 0; y < 2; ++y) { | 335 for (int y = 0; y < 2; ++y) { |
450 EXPECT_EQ(pixels[1-y][x][0] * 2, copied_pixels[y][x][0]); | 336 EXPECT_EQ(pixels[1-y][x][0] * 2, copied_pixels[y][x][0]); |
451 EXPECT_EQ(pixels[1-y][x][1] * 2, copied_pixels[y][x][1]); | 337 EXPECT_EQ(pixels[1-y][x][1] * 2, copied_pixels[y][x][1]); |
452 EXPECT_EQ(pixels[1-y][x][2] * 2, copied_pixels[y][x][2]); | 338 EXPECT_EQ(pixels[1-y][x][2] * 2, copied_pixels[y][x][2]); |
453 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); | 339 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); |
454 } | 340 } |
455 } | 341 } |
456 | 342 |
457 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 343 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
458 } | 344 } |
459 | 345 |
460 namespace { | 346 namespace { |
461 | 347 |
462 void glEnableDisable(GLint param, GLboolean value) { | 348 void glEnableDisable(GLint param, GLboolean value) { |
463 if (value) | 349 if (value) |
464 glEnable(param); | 350 glEnable(param); |
465 else | 351 else |
466 glDisable(param); | 352 glDisable(param); |
467 } | 353 } |
468 | 354 |
469 } // unnamed namespace | 355 } // unnamed namespace |
470 | 356 |
471 // Validate that some basic GL state is not touched upon execution of | 357 // Validate that some basic GL state is not touched upon execution of |
472 // the extension. | 358 // the extension. |
473 TEST_P(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { | 359 TEST_F(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { |
474 CopyType copy_type = GetParam(); | |
475 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 360 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
476 | 361 |
477 glBindFramebuffer(GL_FRAMEBUFFER, 0); | 362 glBindFramebuffer(GL_FRAMEBUFFER, 0); |
478 | 363 |
479 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 364 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
480 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 365 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
481 pixels); | 366 pixels); |
482 | 367 |
483 if (copy_type == TexSubImage) { | |
484 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
485 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
486 nullptr); | |
487 } | |
488 | |
489 GLboolean reference_settings[2] = { GL_TRUE, GL_FALSE }; | 368 GLboolean reference_settings[2] = { GL_TRUE, GL_FALSE }; |
490 for (int x = 0; x < 2; ++x) { | 369 for (int x = 0; x < 2; ++x) { |
491 GLboolean setting = reference_settings[x]; | 370 GLboolean setting = reference_settings[x]; |
492 glEnableDisable(GL_DEPTH_TEST, setting); | 371 glEnableDisable(GL_DEPTH_TEST, setting); |
493 glEnableDisable(GL_SCISSOR_TEST, setting); | 372 glEnableDisable(GL_SCISSOR_TEST, setting); |
494 glEnableDisable(GL_STENCIL_TEST, setting); | 373 glEnableDisable(GL_STENCIL_TEST, setting); |
495 glEnableDisable(GL_CULL_FACE, setting); | 374 glEnableDisable(GL_CULL_FACE, setting); |
496 glEnableDisable(GL_BLEND, setting); | 375 glEnableDisable(GL_BLEND, setting); |
497 glColorMask(setting, setting, setting, setting); | 376 glColorMask(setting, setting, setting, setting); |
498 glDepthMask(setting); | 377 glDepthMask(setting); |
499 | 378 |
500 glActiveTexture(GL_TEXTURE1 + x); | 379 glActiveTexture(GL_TEXTURE1 + x); |
501 | 380 |
502 if (copy_type == TexImage) { | 381 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, |
503 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 382 GL_RGBA, GL_UNSIGNED_BYTE); |
504 GL_UNSIGNED_BYTE); | |
505 } else { | |
506 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
507 } | |
508 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 383 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
509 | 384 |
510 EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); | 385 EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); |
511 EXPECT_EQ(setting, glIsEnabled(GL_SCISSOR_TEST)); | 386 EXPECT_EQ(setting, glIsEnabled(GL_SCISSOR_TEST)); |
512 EXPECT_EQ(setting, glIsEnabled(GL_STENCIL_TEST)); | 387 EXPECT_EQ(setting, glIsEnabled(GL_STENCIL_TEST)); |
513 EXPECT_EQ(setting, glIsEnabled(GL_CULL_FACE)); | 388 EXPECT_EQ(setting, glIsEnabled(GL_CULL_FACE)); |
514 EXPECT_EQ(setting, glIsEnabled(GL_BLEND)); | 389 EXPECT_EQ(setting, glIsEnabled(GL_BLEND)); |
515 | 390 |
516 GLboolean bool_array[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; | 391 GLboolean bool_array[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; |
517 glGetBooleanv(GL_DEPTH_WRITEMASK, bool_array); | 392 glGetBooleanv(GL_DEPTH_WRITEMASK, bool_array); |
518 EXPECT_EQ(setting, bool_array[0]); | 393 EXPECT_EQ(setting, bool_array[0]); |
519 | 394 |
520 bool_array[0] = GL_FALSE; | 395 bool_array[0] = GL_FALSE; |
521 glGetBooleanv(GL_COLOR_WRITEMASK, bool_array); | 396 glGetBooleanv(GL_COLOR_WRITEMASK, bool_array); |
522 EXPECT_EQ(setting, bool_array[0]); | 397 EXPECT_EQ(setting, bool_array[0]); |
523 EXPECT_EQ(setting, bool_array[1]); | 398 EXPECT_EQ(setting, bool_array[1]); |
524 EXPECT_EQ(setting, bool_array[2]); | 399 EXPECT_EQ(setting, bool_array[2]); |
525 EXPECT_EQ(setting, bool_array[3]); | 400 EXPECT_EQ(setting, bool_array[3]); |
526 | 401 |
527 GLint active_texture = 0; | 402 GLint active_texture = 0; |
528 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); | 403 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); |
529 EXPECT_EQ(GL_TEXTURE1 + x, active_texture); | 404 EXPECT_EQ(GL_TEXTURE1 + x, active_texture); |
530 } | 405 } |
531 | 406 |
532 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 407 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
533 }; | 408 }; |
534 | 409 |
535 // Verify that invocation of the extension does not modify the bound | 410 // Verify that invocation of the extension does not modify the bound |
536 // texture state. | 411 // texture state. |
537 TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { | 412 TEST_F(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { |
538 CopyType copy_type = GetParam(); | |
539 // Setup the texture used for the extension invocation. | 413 // Setup the texture used for the extension invocation. |
540 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 414 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
541 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 415 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
542 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 416 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
543 pixels); | 417 pixels); |
544 | 418 |
545 if (copy_type == TexSubImage) { | |
546 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
547 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
548 nullptr); | |
549 } | |
550 | |
551 GLuint texture_ids[2]; | 419 GLuint texture_ids[2]; |
552 glGenTextures(2, texture_ids); | 420 glGenTextures(2, texture_ids); |
553 | 421 |
554 glActiveTexture(GL_TEXTURE0); | 422 glActiveTexture(GL_TEXTURE0); |
555 glBindTexture(GL_TEXTURE_2D, texture_ids[0]); | 423 glBindTexture(GL_TEXTURE_2D, texture_ids[0]); |
556 | 424 |
557 glActiveTexture(GL_TEXTURE1); | 425 glActiveTexture(GL_TEXTURE1); |
558 glBindTexture(GL_TEXTURE_2D, texture_ids[1]); | 426 glBindTexture(GL_TEXTURE_2D, texture_ids[1]); |
559 | 427 |
560 if (copy_type == TexImage) { | 428 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, |
561 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 429 GL_RGBA, GL_UNSIGNED_BYTE); |
562 GL_UNSIGNED_BYTE); | |
563 } else { | |
564 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
565 } | |
566 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 430 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
567 | 431 |
568 GLint active_texture = 0; | 432 GLint active_texture = 0; |
569 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); | 433 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); |
570 EXPECT_EQ(GL_TEXTURE1, active_texture); | 434 EXPECT_EQ(GL_TEXTURE1, active_texture); |
571 | 435 |
572 GLint bound_texture = 0; | 436 GLint bound_texture = 0; |
573 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); | 437 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); |
574 EXPECT_EQ(texture_ids[1], static_cast<GLuint>(bound_texture)); | 438 EXPECT_EQ(texture_ids[1], static_cast<GLuint>(bound_texture)); |
575 glBindTexture(GL_TEXTURE_2D, 0); | 439 glBindTexture(GL_TEXTURE_2D, 0); |
576 | 440 |
577 bound_texture = 0; | 441 bound_texture = 0; |
578 glActiveTexture(GL_TEXTURE0); | 442 glActiveTexture(GL_TEXTURE0); |
579 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); | 443 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); |
580 EXPECT_EQ(texture_ids[0], static_cast<GLuint>(bound_texture)); | 444 EXPECT_EQ(texture_ids[0], static_cast<GLuint>(bound_texture)); |
581 glBindTexture(GL_TEXTURE_2D, 0); | 445 glBindTexture(GL_TEXTURE_2D, 0); |
582 | 446 |
583 glDeleteTextures(2, texture_ids); | 447 glDeleteTextures(2, texture_ids); |
584 | 448 |
585 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 449 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
586 } | 450 } |
587 | 451 |
588 // Verify that invocation of the extension does not perturb the currently | 452 // Verify that invocation of the extension does not perturb the currently |
589 // bound FBO state. | 453 // bound FBO state. |
590 TEST_P(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { | 454 TEST_F(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { |
591 CopyType copy_type = GetParam(); | |
592 // Setup the texture used for the extension invocation. | 455 // Setup the texture used for the extension invocation. |
593 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 456 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
594 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 457 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
595 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 458 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
596 pixels); | 459 pixels); |
597 | 460 |
598 if (copy_type == TexSubImage) { | |
599 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
600 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
601 nullptr); | |
602 } | |
603 | |
604 GLuint texture_id; | 461 GLuint texture_id; |
605 glGenTextures(1, &texture_id); | 462 glGenTextures(1, &texture_id); |
606 glBindTexture(GL_TEXTURE_2D, texture_id); | 463 glBindTexture(GL_TEXTURE_2D, texture_id); |
607 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 464 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
608 0); | 465 0); |
609 | 466 |
610 GLuint renderbuffer_id; | 467 GLuint renderbuffer_id; |
611 glGenRenderbuffers(1, &renderbuffer_id); | 468 glGenRenderbuffers(1, &renderbuffer_id); |
612 glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer_id); | 469 glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer_id); |
613 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 1, 1); | 470 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 1, 1); |
614 | 471 |
615 GLuint framebuffer_id; | 472 GLuint framebuffer_id; |
616 glGenFramebuffers(1, &framebuffer_id); | 473 glGenFramebuffers(1, &framebuffer_id); |
617 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id); | 474 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id); |
618 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 475 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
619 texture_id, 0); | 476 texture_id, 0); |
620 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, | 477 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, |
621 GL_RENDERBUFFER, renderbuffer_id); | 478 GL_RENDERBUFFER, renderbuffer_id); |
622 EXPECT_TRUE( | 479 EXPECT_TRUE( |
623 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 480 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
624 | 481 |
625 // Test that we can write to the bound framebuffer | 482 // Test that we can write to the bound framebuffer |
626 uint8 expected_color[4] = { 255u, 255u, 0, 255u }; | 483 uint8 expected_color[4] = { 255u, 255u, 0, 255u }; |
627 glClearColor(1.0, 1.0, 0, 1.0); | 484 glClearColor(1.0, 1.0, 0, 1.0); |
628 glClear(GL_COLOR_BUFFER_BIT); | 485 glClear(GL_COLOR_BUFFER_BIT); |
629 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 486 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); |
630 | 487 |
631 if (copy_type == TexImage) { | 488 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, |
632 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 489 GL_RGBA, GL_UNSIGNED_BYTE); |
633 GL_UNSIGNED_BYTE); | |
634 } else { | |
635 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
636 } | |
637 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 490 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
638 | 491 |
639 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); | 492 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); |
640 | 493 |
641 // Ensure that reading from the framebuffer produces correct pixels. | 494 // Ensure that reading from the framebuffer produces correct pixels. |
642 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 495 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); |
643 | 496 |
644 uint8 expected_color2[4] = { 255u, 0, 255u, 255u }; | 497 uint8 expected_color2[4] = { 255u, 0, 255u, 255u }; |
645 glClearColor(1.0, 0, 1.0, 1.0); | 498 glClearColor(1.0, 0, 1.0, 1.0); |
646 glClear(GL_COLOR_BUFFER_BIT); | 499 glClear(GL_COLOR_BUFFER_BIT); |
(...skipping 27 matching lines...) Expand all Loading... |
674 &fbo_params); | 527 &fbo_params); |
675 EXPECT_EQ(renderbuffer_id, static_cast<GLuint>(fbo_params)); | 528 EXPECT_EQ(renderbuffer_id, static_cast<GLuint>(fbo_params)); |
676 | 529 |
677 glDeleteRenderbuffers(1, &renderbuffer_id); | 530 glDeleteRenderbuffers(1, &renderbuffer_id); |
678 glDeleteTextures(1, &texture_id); | 531 glDeleteTextures(1, &texture_id); |
679 glDeleteFramebuffers(1, &framebuffer_id); | 532 glDeleteFramebuffers(1, &framebuffer_id); |
680 | 533 |
681 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 534 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
682 } | 535 } |
683 | 536 |
684 TEST_P(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) { | 537 TEST_F(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) { |
685 CopyType copy_type = GetParam(); | |
686 // unbind the one created in setup. | 538 // unbind the one created in setup. |
687 glBindFramebuffer(GL_FRAMEBUFFER, 0); | 539 glBindFramebuffer(GL_FRAMEBUFFER, 0); |
688 glBindTexture(GL_TEXTURE_2D, 0); | 540 glBindTexture(GL_TEXTURE_2D, 0); |
689 | 541 |
690 GLManager gl2; | 542 GLManager gl2; |
691 GLManager::Options options; | 543 GLManager::Options options; |
692 options.size = gfx::Size(16, 16); | 544 options.size = gfx::Size(16, 16); |
693 options.share_group_manager = &gl_; | 545 options.share_group_manager = &gl_; |
694 gl2.Initialize(options); | 546 gl2.Initialize(options); |
695 gl_.MakeCurrent(); | 547 gl_.MakeCurrent(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 glClear(GL_COLOR_BUFFER_BIT); | 581 glClear(GL_COLOR_BUFFER_BIT); |
730 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 582 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); |
731 glDrawArrays(GL_TRIANGLES, 0, 6); | 583 glDrawArrays(GL_TRIANGLES, 0, 6); |
732 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 584 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
733 | 585 |
734 // Call copyTextureCHROMIUM | 586 // Call copyTextureCHROMIUM |
735 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 587 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
736 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 588 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
737 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 589 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
738 pixels); | 590 pixels); |
739 if (copy_type == TexImage) { | 591 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
740 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 592 GL_UNSIGNED_BYTE); |
741 GL_UNSIGNED_BYTE); | |
742 } else { | |
743 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
744 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
745 nullptr); | |
746 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
747 } | |
748 | 593 |
749 // test using program after | 594 // test using program after |
750 glClear(GL_COLOR_BUFFER_BIT); | 595 glClear(GL_COLOR_BUFFER_BIT); |
751 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 596 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); |
752 glDrawArrays(GL_TRIANGLES, 0, 6); | 597 glDrawArrays(GL_TRIANGLES, 0, 6); |
753 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 598 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
754 | 599 |
755 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 600 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
756 | 601 |
757 gl2.MakeCurrent(); | 602 gl2.MakeCurrent(); |
758 gl2.Destroy(); | 603 gl2.Destroy(); |
759 gl_.MakeCurrent(); | 604 gl_.MakeCurrent(); |
760 } | 605 } |
761 | 606 |
762 // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. | 607 // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. |
763 TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { | 608 TEST_F(GLCopyTextureCHROMIUMTest, UninitializedSource) { |
764 CopyType copy_type = GetParam(); | |
765 const GLsizei kWidth = 64, kHeight = 64; | 609 const GLsizei kWidth = 64, kHeight = 64; |
766 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 610 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
767 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, | 611 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, |
768 GL_UNSIGNED_BYTE, nullptr); | 612 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
769 | 613 |
770 if (copy_type == TexImage) { | 614 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
771 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 615 GL_UNSIGNED_BYTE); |
772 GL_UNSIGNED_BYTE); | |
773 } else { | |
774 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
775 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, | |
776 GL_UNSIGNED_BYTE, nullptr); | |
777 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0); | |
778 } | |
779 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 616 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
780 | 617 |
781 uint8 pixels[kHeight][kWidth][4] = {{{1}}}; | 618 uint8 pixels[kHeight][kWidth][4] = {{{1}}}; |
782 glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 619 glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
783 for (int x = 0; x < kWidth; ++x) { | 620 for (int x = 0; x < kWidth; ++x) { |
784 for (int y = 0; y < kHeight; ++y) { | 621 for (int y = 0; y < kHeight; ++y) { |
785 EXPECT_EQ(0, pixels[y][x][0]); | 622 EXPECT_EQ(0, pixels[y][x][0]); |
786 EXPECT_EQ(0, pixels[y][x][1]); | 623 EXPECT_EQ(0, pixels[y][x][1]); |
787 EXPECT_EQ(0, pixels[y][x][2]); | 624 EXPECT_EQ(0, pixels[y][x][2]); |
788 EXPECT_EQ(0, pixels[y][x][3]); | 625 EXPECT_EQ(0, pixels[y][x][3]); |
789 } | 626 } |
790 } | 627 } |
791 | 628 |
792 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 629 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
793 } | 630 } |
794 | 631 |
795 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureDimension) { | |
796 glBindTexture(GL_TEXTURE_2D, textures_[0]); | |
797 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
798 nullptr); | |
799 | |
800 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
801 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
802 nullptr); | |
803 | |
804 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1); | |
805 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
806 | |
807 // xoffset < 0 | |
808 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], -1, 1); | |
809 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); | |
810 | |
811 // xoffset + source_width > dest_width | |
812 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 2, 2); | |
813 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); | |
814 } | |
815 | |
816 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { | |
817 uint8 red[1 * 4] = {255u, 0u, 0u, 255u}; | |
818 glBindTexture(GL_TEXTURE_2D, textures_[0]); | |
819 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
820 red); | |
821 | |
822 uint8 transparent_pixel[4 * 4] = { | |
823 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}; | |
824 glBindTexture(GL_TEXTURE_2D, textures_[1]); | |
825 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | |
826 transparent_pixel); | |
827 | |
828 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1); | |
829 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | |
830 | |
831 // Check the FB is still bound. | |
832 GLint value = 0; | |
833 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | |
834 GLuint fb_id = value; | |
835 EXPECT_EQ(framebuffer_id_, fb_id); | |
836 | |
837 // Check that FB is complete. | |
838 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | |
839 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | |
840 | |
841 uint8 transparent[1 * 4] = {0u, 0u, 0u, 0u}; | |
842 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent); | |
843 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red); | |
844 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | |
845 } | |
846 | |
847 } // namespace gpu | 632 } // namespace gpu |
OLD | NEW |