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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 }; | 51 }; |
52 | 52 |
53 // Test to ensure that the basic functionality of the extension works. | 53 // Test to ensure that the basic functionality of the extension works. |
54 TEST_F(GLCopyTextureCHROMIUMTest, Basic) { | 54 TEST_F(GLCopyTextureCHROMIUMTest, Basic) { |
55 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 55 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
56 | 56 |
57 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 57 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
58 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, |
59 pixels); | 59 pixels); |
60 | 60 |
61 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 61 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 62 GL_UNSIGNED_BYTE); |
62 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 63 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
63 | 64 |
64 // Check the FB is still bound. | 65 // Check the FB is still bound. |
65 GLint value = 0; | 66 GLint value = 0; |
66 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 67 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
67 GLuint fb_id = value; | 68 GLuint fb_id = value; |
68 EXPECT_EQ(framebuffer_id_, fb_id); | 69 EXPECT_EQ(framebuffer_id_, fb_id); |
69 | 70 |
70 // Check that FB is complete. | 71 // Check that FB is complete. |
71 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 72 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
(...skipping 13 matching lines...) Expand all Loading... |
85 pixels[y][x][2] = x + y; | 86 pixels[y][x][2] = x + y; |
86 pixels[y][x][3] = 255u; | 87 pixels[y][x][3] = 255u; |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 91 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
91 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 92 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
92 pixels); | 93 pixels); |
93 | 94 |
94 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 95 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
95 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 96 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 97 GL_UNSIGNED_BYTE); |
96 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 98 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
97 | 99 |
98 uint8 copied_pixels[2][2][4] = {{{0}}}; | 100 uint8 copied_pixels[2][2][4] = {{{0}}}; |
99 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 101 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
100 for (int x = 0; x < 2; ++x) { | 102 for (int x = 0; x < 2; ++x) { |
101 for (int y = 0; y < 2; ++y) | 103 for (int y = 0; y < 2; ++y) |
102 EXPECT_EQ(pixels[1-y][x][0], copied_pixels[y][x][0]); | 104 EXPECT_EQ(pixels[1-y][x][0], copied_pixels[y][x][0]); |
103 } | 105 } |
104 | 106 |
105 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 107 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
106 } | 108 } |
107 | 109 |
108 // Test that the extension respects the GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM | 110 // Test that the extension respects the GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM |
109 // storage setting. | 111 // storage setting. |
110 TEST_F(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) { | 112 TEST_F(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) { |
111 uint8 pixels[1 * 4] = { 2, 2, 2, 128 }; | 113 uint8 pixels[1 * 4] = { 2, 2, 2, 128 }; |
112 | 114 |
113 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 115 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
114 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 116 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
115 pixels); | 117 pixels); |
116 | 118 |
117 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 119 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
118 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 120 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 121 GL_UNSIGNED_BYTE); |
119 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 122 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
120 | 123 |
121 uint8 copied_pixels[1 * 4] = {0}; | 124 uint8 copied_pixels[1 * 4] = {0}; |
122 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 125 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
123 EXPECT_EQ(1u, copied_pixels[0]); | 126 EXPECT_EQ(1u, copied_pixels[0]); |
124 EXPECT_EQ(1u, copied_pixels[1]); | 127 EXPECT_EQ(1u, copied_pixels[1]); |
125 EXPECT_EQ(1u, copied_pixels[2]); | 128 EXPECT_EQ(1u, copied_pixels[2]); |
126 EXPECT_EQ(128u, copied_pixels[3]); | 129 EXPECT_EQ(128u, copied_pixels[3]); |
127 | 130 |
128 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 131 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
129 } | 132 } |
130 | 133 |
131 // Test that the extension respects the GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM | 134 // Test that the extension respects the GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM |
132 // storage setting. | 135 // storage setting. |
133 TEST_F(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) { | 136 TEST_F(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) { |
134 uint8 pixels[1 * 4] = { 16, 16, 16, 128 }; | 137 uint8 pixels[1 * 4] = { 16, 16, 16, 128 }; |
135 | 138 |
136 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 139 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
137 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 140 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
138 pixels); | 141 pixels); |
139 | 142 |
140 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 143 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
141 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 144 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 145 GL_UNSIGNED_BYTE); |
142 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 146 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
143 | 147 |
144 uint8 copied_pixels[1 * 4] = {0}; | 148 uint8 copied_pixels[1 * 4] = {0}; |
145 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 149 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
146 EXPECT_EQ(32u, copied_pixels[0]); | 150 EXPECT_EQ(32u, copied_pixels[0]); |
147 EXPECT_EQ(32u, copied_pixels[1]); | 151 EXPECT_EQ(32u, copied_pixels[1]); |
148 EXPECT_EQ(32u, copied_pixels[2]); | 152 EXPECT_EQ(32u, copied_pixels[2]); |
149 EXPECT_EQ(128u, copied_pixels[3]); | 153 EXPECT_EQ(128u, copied_pixels[3]); |
150 | 154 |
151 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 155 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
(...skipping 10 matching lines...) Expand all Loading... |
162 pixels[y][x][3] = 128u; | 166 pixels[y][x][3] = 128u; |
163 } | 167 } |
164 } | 168 } |
165 | 169 |
166 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 170 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
167 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 171 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
168 pixels); | 172 pixels); |
169 | 173 |
170 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 174 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
171 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 175 glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
172 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 176 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 177 GL_UNSIGNED_BYTE); |
173 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 178 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
174 | 179 |
175 uint8 copied_pixels[2][2][4] = {{{0}}}; | 180 uint8 copied_pixels[2][2][4] = {{{0}}}; |
176 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 181 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
177 for (int x = 0; x < 2; ++x) { | 182 for (int x = 0; x < 2; ++x) { |
178 for (int y = 0; y < 2; ++y) { | 183 for (int y = 0; y < 2; ++y) { |
179 EXPECT_EQ(pixels[1-y][x][0] / 2, copied_pixels[y][x][0]); | 184 EXPECT_EQ(pixels[1-y][x][0] / 2, copied_pixels[y][x][0]); |
180 EXPECT_EQ(pixels[1-y][x][1] / 2, copied_pixels[y][x][1]); | 185 EXPECT_EQ(pixels[1-y][x][1] / 2, copied_pixels[y][x][1]); |
181 EXPECT_EQ(pixels[1-y][x][2] / 2, copied_pixels[y][x][2]); | 186 EXPECT_EQ(pixels[1-y][x][2] / 2, copied_pixels[y][x][2]); |
182 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); | 187 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); |
(...skipping 14 matching lines...) Expand all Loading... |
197 pixels[y][x][3] = 128u; | 202 pixels[y][x][3] = 128u; |
198 } | 203 } |
199 } | 204 } |
200 | 205 |
201 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 206 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
202 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 207 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
203 pixels); | 208 pixels); |
204 | 209 |
205 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 210 glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
206 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); | 211 glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
207 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 212 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 213 GL_UNSIGNED_BYTE); |
208 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 214 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
209 | 215 |
210 uint8 copied_pixels[2][2][4] = {{{0}}}; | 216 uint8 copied_pixels[2][2][4] = {{{0}}}; |
211 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); | 217 glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
212 for (int x = 0; x < 2; ++x) { | 218 for (int x = 0; x < 2; ++x) { |
213 for (int y = 0; y < 2; ++y) { | 219 for (int y = 0; y < 2; ++y) { |
214 EXPECT_EQ(pixels[1-y][x][0] * 2, copied_pixels[y][x][0]); | 220 EXPECT_EQ(pixels[1-y][x][0] * 2, copied_pixels[y][x][0]); |
215 EXPECT_EQ(pixels[1-y][x][1] * 2, copied_pixels[y][x][1]); | 221 EXPECT_EQ(pixels[1-y][x][1] * 2, copied_pixels[y][x][1]); |
216 EXPECT_EQ(pixels[1-y][x][2] * 2, copied_pixels[y][x][2]); | 222 EXPECT_EQ(pixels[1-y][x][2] * 2, copied_pixels[y][x][2]); |
217 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); | 223 EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 glEnableDisable(GL_SCISSOR_TEST, setting); | 256 glEnableDisable(GL_SCISSOR_TEST, setting); |
251 glEnableDisable(GL_STENCIL_TEST, setting); | 257 glEnableDisable(GL_STENCIL_TEST, setting); |
252 glEnableDisable(GL_CULL_FACE, setting); | 258 glEnableDisable(GL_CULL_FACE, setting); |
253 glEnableDisable(GL_BLEND, setting); | 259 glEnableDisable(GL_BLEND, setting); |
254 glColorMask(setting, setting, setting, setting); | 260 glColorMask(setting, setting, setting, setting); |
255 glDepthMask(setting); | 261 glDepthMask(setting); |
256 | 262 |
257 glActiveTexture(GL_TEXTURE1 + x); | 263 glActiveTexture(GL_TEXTURE1 + x); |
258 | 264 |
259 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, | 265 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, |
260 GL_RGBA); | 266 GL_RGBA, GL_UNSIGNED_BYTE); |
261 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 267 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
262 | 268 |
263 EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); | 269 EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); |
264 EXPECT_EQ(setting, glIsEnabled(GL_SCISSOR_TEST)); | 270 EXPECT_EQ(setting, glIsEnabled(GL_SCISSOR_TEST)); |
265 EXPECT_EQ(setting, glIsEnabled(GL_STENCIL_TEST)); | 271 EXPECT_EQ(setting, glIsEnabled(GL_STENCIL_TEST)); |
266 EXPECT_EQ(setting, glIsEnabled(GL_CULL_FACE)); | 272 EXPECT_EQ(setting, glIsEnabled(GL_CULL_FACE)); |
267 EXPECT_EQ(setting, glIsEnabled(GL_BLEND)); | 273 EXPECT_EQ(setting, glIsEnabled(GL_BLEND)); |
268 | 274 |
269 GLboolean bool_array[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; | 275 GLboolean bool_array[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; |
270 glGetBooleanv(GL_DEPTH_WRITEMASK, bool_array); | 276 glGetBooleanv(GL_DEPTH_WRITEMASK, bool_array); |
(...skipping 26 matching lines...) Expand all Loading... |
297 GLuint texture_ids[2]; | 303 GLuint texture_ids[2]; |
298 glGenTextures(2, texture_ids); | 304 glGenTextures(2, texture_ids); |
299 | 305 |
300 glActiveTexture(GL_TEXTURE0); | 306 glActiveTexture(GL_TEXTURE0); |
301 glBindTexture(GL_TEXTURE_2D, texture_ids[0]); | 307 glBindTexture(GL_TEXTURE_2D, texture_ids[0]); |
302 | 308 |
303 glActiveTexture(GL_TEXTURE1); | 309 glActiveTexture(GL_TEXTURE1); |
304 glBindTexture(GL_TEXTURE_2D, texture_ids[1]); | 310 glBindTexture(GL_TEXTURE_2D, texture_ids[1]); |
305 | 311 |
306 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, | 312 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, |
307 GL_RGBA); | 313 GL_RGBA, GL_UNSIGNED_BYTE); |
308 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 314 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
309 | 315 |
310 GLint active_texture = 0; | 316 GLint active_texture = 0; |
311 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); | 317 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); |
312 EXPECT_EQ(GL_TEXTURE1, active_texture); | 318 EXPECT_EQ(GL_TEXTURE1, active_texture); |
313 | 319 |
314 GLint bound_texture = 0; | 320 GLint bound_texture = 0; |
315 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); | 321 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); |
316 EXPECT_EQ(texture_ids[1], static_cast<GLuint>(bound_texture)); | 322 EXPECT_EQ(texture_ids[1], static_cast<GLuint>(bound_texture)); |
317 glBindTexture(GL_TEXTURE_2D, 0); | 323 glBindTexture(GL_TEXTURE_2D, 0); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 EXPECT_TRUE( | 363 EXPECT_TRUE( |
358 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 364 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
359 | 365 |
360 // Test that we can write to the bound framebuffer | 366 // Test that we can write to the bound framebuffer |
361 uint8 expected_color[4] = { 255u, 255u, 0, 255u }; | 367 uint8 expected_color[4] = { 255u, 255u, 0, 255u }; |
362 glClearColor(1.0, 1.0, 0, 1.0); | 368 glClearColor(1.0, 1.0, 0, 1.0); |
363 glClear(GL_COLOR_BUFFER_BIT); | 369 glClear(GL_COLOR_BUFFER_BIT); |
364 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 370 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); |
365 | 371 |
366 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, | 372 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, |
367 GL_RGBA); | 373 GL_RGBA, GL_UNSIGNED_BYTE); |
368 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 374 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
369 | 375 |
370 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); | 376 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); |
371 | 377 |
372 // Ensure that reading from the framebuffer produces correct pixels. | 378 // Ensure that reading from the framebuffer produces correct pixels. |
373 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 379 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); |
374 | 380 |
375 uint8 expected_color2[4] = { 255u, 0, 255u, 255u }; | 381 uint8 expected_color2[4] = { 255u, 0, 255u, 255u }; |
376 glClearColor(1.0, 0, 1.0, 1.0); | 382 glClearColor(1.0, 0, 1.0, 1.0); |
377 glClear(GL_COLOR_BUFFER_BIT); | 383 glClear(GL_COLOR_BUFFER_BIT); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 glClear(GL_COLOR_BUFFER_BIT); | 465 glClear(GL_COLOR_BUFFER_BIT); |
460 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 466 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); |
461 glDrawArrays(GL_TRIANGLES, 0, 6); | 467 glDrawArrays(GL_TRIANGLES, 0, 6); |
462 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 468 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
463 | 469 |
464 // Call copyTextureCHROMIUM | 470 // Call copyTextureCHROMIUM |
465 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; | 471 uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; |
466 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 472 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
467 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 473 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
468 pixels); | 474 pixels); |
469 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); | 475 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA, |
| 476 GL_UNSIGNED_BYTE); |
470 | 477 |
471 // test using program after | 478 // test using program after |
472 glClear(GL_COLOR_BUFFER_BIT); | 479 glClear(GL_COLOR_BUFFER_BIT); |
473 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 480 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); |
474 glDrawArrays(GL_TRIANGLES, 0, 6); | 481 glDrawArrays(GL_TRIANGLES, 0, 6); |
475 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 482 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
476 | 483 |
477 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 484 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
478 | 485 |
479 gl2.MakeCurrent(); | 486 gl2.MakeCurrent(); |
480 gl2.Destroy(); | 487 gl2.Destroy(); |
481 gl_.MakeCurrent(); | 488 gl_.MakeCurrent(); |
482 } | 489 } |
483 | 490 |
484 } // namespace gpu | 491 } // namespace gpu |
OLD | NEW |