| 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 // Test to ensure that the basic functionality of the extension works. | 69 // Test to ensure that the basic functionality of the extension works. |
| 70 TEST_P(GLCopyTextureCHROMIUMTest, Basic) { | 70 TEST_P(GLCopyTextureCHROMIUMTest, Basic) { |
| 71 CopyType copy_type = GetParam(); | 71 CopyType copy_type = GetParam(); |
| 72 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; | 72 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; |
| 73 | 73 |
| 74 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 74 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 75 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 75 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 76 pixels); | 76 pixels); |
| 77 | 77 |
| 78 if (copy_type == TexImage) { | 78 if (copy_type == TexImage) { |
| 79 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 79 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 80 GL_UNSIGNED_BYTE, false, false, false); | 80 GL_UNSIGNED_BYTE, false, false, false); |
| 81 } else { | 81 } else { |
| 82 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 82 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 83 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 83 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 84 nullptr); | 84 nullptr); |
| 85 | 85 |
| 86 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, | 86 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 87 0, 1, 1, false, false, false); | 87 0, 1, 1, false, false, false); |
| 88 } | 88 } |
| 89 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 89 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 90 | 90 |
| 91 // Check the FB is still bound. | 91 // Check the FB is still bound. |
| 92 GLint value = 0; | 92 GLint value = 0; |
| 93 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 93 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
| 94 GLuint fb_id = value; | 94 GLuint fb_id = value; |
| 95 EXPECT_EQ(framebuffer_id_, fb_id); | 95 EXPECT_EQ(framebuffer_id_, fb_id); |
| 96 | 96 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 116 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | 116 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 117 pixels); | 117 pixels); |
| 118 | 118 |
| 119 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 119 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 120 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); | 120 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); |
| 121 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 121 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| 122 textures_[1], 0); | 122 textures_[1], 0); |
| 123 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 123 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 124 | 124 |
| 125 if (copy_type == TexImage) { | 125 if (copy_type == TexImage) { |
| 126 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 126 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 127 GL_UNSIGNED_BYTE, false, false, false); | 127 GL_UNSIGNED_BYTE, false, false, false); |
| 128 EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); | 128 EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); |
| 129 } else { | 129 } else { |
| 130 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, | 130 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 131 0, 1, 1, false, false, false); | 131 0, 1, 1, false, false, false); |
| 132 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 132 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 133 | 133 |
| 134 // Check the FB is still bound. | 134 // Check the FB is still bound. |
| 135 GLint value = 0; | 135 GLint value = 0; |
| 136 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 136 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
| 137 GLuint fb_id = value; | 137 GLuint fb_id = value; |
| 138 EXPECT_EQ(framebuffer_id_, fb_id); | 138 EXPECT_EQ(framebuffer_id_, fb_id); |
| 139 | 139 |
| 140 // Check that FB is complete. | 140 // Check that FB is complete. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 154 | 154 |
| 155 for (size_t src_index = 0; src_index < arraysize(src_formats); src_index++) { | 155 for (size_t src_index = 0; src_index < arraysize(src_formats); src_index++) { |
| 156 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); | 156 for (size_t dest_index = 0; dest_index < arraysize(dest_formats); |
| 157 dest_index++) { | 157 dest_index++) { |
| 158 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 158 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 159 glTexImage2D(GL_TEXTURE_2D, 0, src_formats[src_index], 1, 1, 0, | 159 glTexImage2D(GL_TEXTURE_2D, 0, src_formats[src_index], 1, 1, 0, |
| 160 src_formats[src_index], GL_UNSIGNED_BYTE, nullptr); | 160 src_formats[src_index], GL_UNSIGNED_BYTE, nullptr); |
| 161 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 161 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 162 | 162 |
| 163 if (copy_type == TexImage) { | 163 if (copy_type == TexImage) { |
| 164 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], | 164 glCopyTextureCHROMIUM(textures_[0], textures_[1], |
| 165 dest_formats[dest_index], GL_UNSIGNED_BYTE, | 165 dest_formats[dest_index], GL_UNSIGNED_BYTE, |
| 166 false, false, false); | 166 false, false, false); |
| 167 } else { | 167 } else { |
| 168 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 168 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 169 glTexImage2D(GL_TEXTURE_2D, 0, dest_formats[dest_index], 1, 1, 0, | 169 glTexImage2D(GL_TEXTURE_2D, 0, dest_formats[dest_index], 1, 1, 0, |
| 170 dest_formats[dest_index], GL_UNSIGNED_BYTE, nullptr); | 170 dest_formats[dest_index], GL_UNSIGNED_BYTE, nullptr); |
| 171 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 171 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 172 | 172 |
| 173 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, | 173 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, |
| 174 0, 0, 0, 1, 1, false, false, false); | 174 0, 0, 0, 1, 1, false, false, false); |
| 175 } | 175 } |
| 176 | 176 |
| 177 EXPECT_TRUE(GL_NO_ERROR == glGetError()) << "src_index:" << src_index | 177 EXPECT_TRUE(GL_NO_ERROR == glGetError()) << "src_index:" << src_index |
| 178 << " dest_index:" << dest_index; | 178 << " dest_index:" << dest_index; |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { | 183 TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { |
| 184 CopyType copy_type = GetParam(); | 184 CopyType copy_type = GetParam(); |
| 185 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 185 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 186 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 186 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 187 nullptr); | 187 nullptr); |
| 188 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 188 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 189 | 189 |
| 190 // Check unsupported format reports error. | 190 // Check unsupported format reports error. |
| 191 GLint unsupported_dest_formats[] = {GL_ALPHA, GL_LUMINANCE, | 191 GLint unsupported_dest_formats[] = {GL_ALPHA, GL_LUMINANCE, |
| 192 GL_LUMINANCE_ALPHA}; | 192 GL_LUMINANCE_ALPHA}; |
| 193 for (size_t dest_index = 0; dest_index < arraysize(unsupported_dest_formats); | 193 for (size_t dest_index = 0; dest_index < arraysize(unsupported_dest_formats); |
| 194 dest_index++) { | 194 dest_index++) { |
| 195 if (copy_type == TexImage) { | 195 if (copy_type == TexImage) { |
| 196 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], | 196 glCopyTextureCHROMIUM(textures_[0], textures_[1], |
| 197 unsupported_dest_formats[dest_index], | 197 unsupported_dest_formats[dest_index], |
| 198 GL_UNSIGNED_BYTE, false, false, false); | 198 GL_UNSIGNED_BYTE, false, false, false); |
| 199 } else { | 199 } else { |
| 200 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 200 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 201 glTexImage2D(GL_TEXTURE_2D, 0, unsupported_dest_formats[dest_index], 1, 1, | 201 glTexImage2D(GL_TEXTURE_2D, 0, unsupported_dest_formats[dest_index], 1, 1, |
| 202 0, unsupported_dest_formats[dest_index], GL_UNSIGNED_BYTE, | 202 0, unsupported_dest_formats[dest_index], GL_UNSIGNED_BYTE, |
| 203 nullptr); | 203 nullptr); |
| 204 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, | 204 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, |
| 205 0, 0, 1, 1, false, false, false); | 205 0, 0, 1, 1, false, false, false); |
| 206 } | 206 } |
| 207 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()) | 207 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()) |
| 208 << "dest_index:" << dest_index; | 208 << "dest_index:" << dest_index; |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Test to ensure that the destination texture is redefined if the properties | 212 // Test to ensure that the destination texture is redefined if the properties |
| 213 // are different. | 213 // are different. |
| 214 TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { | 214 TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 235 glTexSubImage2D( | 235 glTexSubImage2D( |
| 236 GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 236 GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
| 237 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); | 237 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); |
| 238 // GL_INVALID_VALUE due to bad dimensions. | 238 // GL_INVALID_VALUE due to bad dimensions. |
| 239 glTexSubImage2D( | 239 glTexSubImage2D( |
| 240 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels); | 240 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels); |
| 241 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 241 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 242 | 242 |
| 243 // If the dest texture has different properties, glCopyTextureCHROMIUM() | 243 // If the dest texture has different properties, glCopyTextureCHROMIUM() |
| 244 // redefines them. | 244 // redefines them. |
| 245 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 245 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 246 GL_UNSIGNED_BYTE, false, false, false); | 246 GL_UNSIGNED_BYTE, false, false, false); |
| 247 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 247 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 248 | 248 |
| 249 // glTexSubImage2D() succeeds because textures_[1] is redefined into 2x2 | 249 // glTexSubImage2D() succeeds because textures_[1] is redefined into 2x2 |
| 250 // dimension and GL_RGBA format. | 250 // dimension and GL_RGBA format. |
| 251 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 251 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 252 glTexSubImage2D( | 252 glTexSubImage2D( |
| 253 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 253 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
| 254 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 254 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 255 | 255 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 glEnableDisable(GL_SCISSOR_TEST, setting); | 303 glEnableDisable(GL_SCISSOR_TEST, setting); |
| 304 glEnableDisable(GL_STENCIL_TEST, setting); | 304 glEnableDisable(GL_STENCIL_TEST, setting); |
| 305 glEnableDisable(GL_CULL_FACE, setting); | 305 glEnableDisable(GL_CULL_FACE, setting); |
| 306 glEnableDisable(GL_BLEND, setting); | 306 glEnableDisable(GL_BLEND, setting); |
| 307 glColorMask(setting, setting, setting, setting); | 307 glColorMask(setting, setting, setting, setting); |
| 308 glDepthMask(setting); | 308 glDepthMask(setting); |
| 309 | 309 |
| 310 glActiveTexture(GL_TEXTURE1 + x); | 310 glActiveTexture(GL_TEXTURE1 + x); |
| 311 | 311 |
| 312 if (copy_type == TexImage) { | 312 if (copy_type == TexImage) { |
| 313 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 313 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 314 GL_UNSIGNED_BYTE, false, false, false); | 314 GL_UNSIGNED_BYTE, false, false, false); |
| 315 } else { | 315 } else { |
| 316 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, | 316 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, |
| 317 0, 0, 1, 1, false, false, false); | 317 0, 0, 1, 1, false, false, false); |
| 318 } | 318 } |
| 319 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 319 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 320 | 320 |
| 321 EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); | 321 EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); |
| 322 EXPECT_EQ(setting, glIsEnabled(GL_SCISSOR_TEST)); | 322 EXPECT_EQ(setting, glIsEnabled(GL_SCISSOR_TEST)); |
| 323 EXPECT_EQ(setting, glIsEnabled(GL_STENCIL_TEST)); | 323 EXPECT_EQ(setting, glIsEnabled(GL_STENCIL_TEST)); |
| 324 EXPECT_EQ(setting, glIsEnabled(GL_CULL_FACE)); | 324 EXPECT_EQ(setting, glIsEnabled(GL_CULL_FACE)); |
| 325 EXPECT_EQ(setting, glIsEnabled(GL_BLEND)); | 325 EXPECT_EQ(setting, glIsEnabled(GL_BLEND)); |
| 326 | 326 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 GLuint texture_ids[2]; | 362 GLuint texture_ids[2]; |
| 363 glGenTextures(2, texture_ids); | 363 glGenTextures(2, texture_ids); |
| 364 | 364 |
| 365 glActiveTexture(GL_TEXTURE0); | 365 glActiveTexture(GL_TEXTURE0); |
| 366 glBindTexture(GL_TEXTURE_2D, texture_ids[0]); | 366 glBindTexture(GL_TEXTURE_2D, texture_ids[0]); |
| 367 | 367 |
| 368 glActiveTexture(GL_TEXTURE1); | 368 glActiveTexture(GL_TEXTURE1); |
| 369 glBindTexture(GL_TEXTURE_2D, texture_ids[1]); | 369 glBindTexture(GL_TEXTURE_2D, texture_ids[1]); |
| 370 | 370 |
| 371 if (copy_type == TexImage) { | 371 if (copy_type == TexImage) { |
| 372 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 372 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 373 GL_UNSIGNED_BYTE, false, false, false); | 373 GL_UNSIGNED_BYTE, false, false, false); |
| 374 } else { | 374 } else { |
| 375 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, | 375 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 376 0, 1, 1, false, false, false); | 376 0, 1, 1, false, false, false); |
| 377 } | 377 } |
| 378 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 378 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 379 | 379 |
| 380 GLint active_texture = 0; | 380 GLint active_texture = 0; |
| 381 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); | 381 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); |
| 382 EXPECT_EQ(GL_TEXTURE1, active_texture); | 382 EXPECT_EQ(GL_TEXTURE1, active_texture); |
| 383 | 383 |
| 384 GLint bound_texture = 0; | 384 GLint bound_texture = 0; |
| 385 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); | 385 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 EXPECT_TRUE( | 434 EXPECT_TRUE( |
| 435 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 435 GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 436 | 436 |
| 437 // Test that we can write to the bound framebuffer | 437 // Test that we can write to the bound framebuffer |
| 438 uint8_t expected_color[4] = {255u, 255u, 0, 255u}; | 438 uint8_t expected_color[4] = {255u, 255u, 0, 255u}; |
| 439 glClearColor(1.0, 1.0, 0, 1.0); | 439 glClearColor(1.0, 1.0, 0, 1.0); |
| 440 glClear(GL_COLOR_BUFFER_BIT); | 440 glClear(GL_COLOR_BUFFER_BIT); |
| 441 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 441 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); |
| 442 | 442 |
| 443 if (copy_type == TexImage) { | 443 if (copy_type == TexImage) { |
| 444 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 444 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 445 GL_UNSIGNED_BYTE, false, false, false); | 445 GL_UNSIGNED_BYTE, false, false, false); |
| 446 } else { | 446 } else { |
| 447 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, | 447 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 448 0, 1, 1, false, false, false); | 448 0, 1, 1, false, false, false); |
| 449 } | 449 } |
| 450 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 450 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 451 | 451 |
| 452 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); | 452 EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); |
| 453 | 453 |
| 454 // Ensure that reading from the framebuffer produces correct pixels. | 454 // Ensure that reading from the framebuffer produces correct pixels. |
| 455 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); | 455 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); |
| 456 | 456 |
| 457 uint8_t expected_color2[4] = {255u, 0, 255u, 255u}; | 457 uint8_t expected_color2[4] = {255u, 0, 255u, 255u}; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 547 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); |
| 548 glDrawArrays(GL_TRIANGLES, 0, 6); | 548 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 549 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 549 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
| 550 | 550 |
| 551 // Call copyTextureCHROMIUM | 551 // Call copyTextureCHROMIUM |
| 552 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; | 552 uint8_t pixels[1 * 4] = {255u, 0u, 0u, 255u}; |
| 553 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 553 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 554 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 554 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 555 pixels); | 555 pixels); |
| 556 if (copy_type == TexImage) { | 556 if (copy_type == TexImage) { |
| 557 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 557 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 558 GL_UNSIGNED_BYTE, false, false, false); | 558 GL_UNSIGNED_BYTE, false, false, false); |
| 559 } else { | 559 } else { |
| 560 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 560 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 561 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 561 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 562 nullptr); | 562 nullptr); |
| 563 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, | 563 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 564 0, 1, 1, false, false, false); | 564 0, 1, 1, false, false, false); |
| 565 } | 565 } |
| 566 | 566 |
| 567 // test using program after | 567 // test using program after |
| 568 glClear(GL_COLOR_BUFFER_BIT); | 568 glClear(GL_COLOR_BUFFER_BIT); |
| 569 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); | 569 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); |
| 570 glDrawArrays(GL_TRIANGLES, 0, 6); | 570 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 571 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 571 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
| 572 | 572 |
| 573 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 573 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 574 | 574 |
| 575 gl2.MakeCurrent(); | 575 gl2.MakeCurrent(); |
| 576 gl2.Destroy(); | 576 gl2.Destroy(); |
| 577 gl_.MakeCurrent(); | 577 gl_.MakeCurrent(); |
| 578 } | 578 } |
| 579 | 579 |
| 580 // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. | 580 // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. |
| 581 TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { | 581 TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { |
| 582 CopyType copy_type = GetParam(); | 582 CopyType copy_type = GetParam(); |
| 583 const GLsizei kWidth = 64, kHeight = 64; | 583 const GLsizei kWidth = 64, kHeight = 64; |
| 584 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 584 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 585 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, | 585 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, |
| 586 GL_UNSIGNED_BYTE, nullptr); | 586 GL_UNSIGNED_BYTE, nullptr); |
| 587 | 587 |
| 588 if (copy_type == TexImage) { | 588 if (copy_type == TexImage) { |
| 589 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 589 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 590 GL_UNSIGNED_BYTE, false, false, false); | 590 GL_UNSIGNED_BYTE, false, false, false); |
| 591 } else { | 591 } else { |
| 592 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 592 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 593 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, | 593 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, |
| 594 GL_UNSIGNED_BYTE, nullptr); | 594 GL_UNSIGNED_BYTE, nullptr); |
| 595 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, | 595 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 0, |
| 596 0, kWidth, kHeight, false, false, false); | 596 0, kWidth, kHeight, false, false, false); |
| 597 } | 597 } |
| 598 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 598 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 599 | 599 |
| 600 uint8_t pixels[kHeight][kWidth][4] = {{{1}}}; | 600 uint8_t pixels[kHeight][kWidth][4] = {{{1}}}; |
| 601 glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 601 glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
| 602 for (int x = 0; x < kWidth; ++x) { | 602 for (int x = 0; x < kWidth; ++x) { |
| 603 for (int y = 0; y < kHeight; ++y) { | 603 for (int y = 0; y < kHeight; ++y) { |
| 604 EXPECT_EQ(0, pixels[y][x][0]); | 604 EXPECT_EQ(0, pixels[y][x][0]); |
| 605 EXPECT_EQ(0, pixels[y][x][1]); | 605 EXPECT_EQ(0, pixels[y][x][1]); |
| 606 EXPECT_EQ(0, pixels[y][x][2]); | 606 EXPECT_EQ(0, pixels[y][x][2]); |
| 607 EXPECT_EQ(0, pixels[y][x][3]); | 607 EXPECT_EQ(0, pixels[y][x][3]); |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 | 610 |
| 611 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 611 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 612 } | 612 } |
| 613 | 613 |
| 614 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureDimension) { | 614 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureDimension) { |
| 615 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 615 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 616 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 616 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 617 nullptr); | 617 nullptr); |
| 618 | 618 |
| 619 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 619 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 620 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 620 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 621 nullptr); | 621 nullptr); |
| 622 | 622 |
| 623 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, | 623 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 1, 1, 0, |
| 624 0, 1, 1, false, false, false); | 624 0, 1, 1, false, false, false); |
| 625 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 625 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 626 | 626 |
| 627 // xoffset < 0 | 627 // xoffset < 0 |
| 628 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], -1, 1, 0, | 628 glCopySubTextureCHROMIUM(textures_[0], textures_[1], -1, 1, 0, |
| 629 0, 1, 1, false, false, false); | 629 0, 1, 1, false, false, false); |
| 630 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); | 630 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 631 | 631 |
| 632 // x < 0 | 632 // x < 0 |
| 633 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, -1, | 633 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 1, 1, -1, |
| 634 0, 1, 1, false, false, false); | 634 0, 1, 1, false, false, false); |
| 635 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); | 635 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 636 | 636 |
| 637 // xoffset + width > dest_width | 637 // xoffset + width > dest_width |
| 638 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 2, 2, 0, | 638 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 2, 2, 0, |
| 639 0, 2, 2, false, false, false); | 639 0, 2, 2, false, false, false); |
| 640 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); | 640 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 641 | 641 |
| 642 // x + width > source_width | 642 // x + width > source_width |
| 643 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 1, | 643 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 0, 1, |
| 644 1, 2, 2, false, false, false); | 644 1, 2, 2, false, false, false); |
| 645 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); | 645 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 646 } | 646 } |
| 647 | 647 |
| 648 TEST_F(GLCopyTextureCHROMIUMTest, CopyTextureInvalidTextureIds) { | 648 TEST_F(GLCopyTextureCHROMIUMTest, CopyTextureInvalidTextureIds) { |
| 649 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 649 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 650 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 650 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 651 nullptr); | 651 nullptr); |
| 652 | 652 |
| 653 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 653 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 654 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 654 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 655 nullptr); | 655 nullptr); |
| 656 | 656 |
| 657 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993, GL_RGBA, | 657 glCopyTextureCHROMIUM(textures_[0], 99993, GL_RGBA, |
| 658 GL_UNSIGNED_BYTE, false, false, false); | 658 GL_UNSIGNED_BYTE, false, false, false); |
| 659 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 659 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 660 | 660 |
| 661 glCopyTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1], GL_RGBA, | 661 glCopyTextureCHROMIUM(99994, textures_[1], GL_RGBA, |
| 662 GL_UNSIGNED_BYTE, false, false, false); | 662 GL_UNSIGNED_BYTE, false, false, false); |
| 663 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 663 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 664 | 664 |
| 665 glCopyTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996, GL_RGBA, GL_UNSIGNED_BYTE, | 665 glCopyTextureCHROMIUM(99995, 99996, GL_RGBA, GL_UNSIGNED_BYTE, |
| 666 false, false, false); | 666 false, false, false); |
| 667 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 667 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 668 | 668 |
| 669 glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, | 669 glCopyTextureCHROMIUM(textures_[0], textures_[1], GL_RGBA, |
| 670 GL_UNSIGNED_BYTE, false, false, false); | 670 GL_UNSIGNED_BYTE, false, false, false); |
| 671 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 671 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 672 } | 672 } |
| 673 | 673 |
| 674 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureInvalidTextureIds) { | 674 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureInvalidTextureIds) { |
| 675 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 675 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 676 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 676 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 677 nullptr); | 677 nullptr); |
| 678 | 678 |
| 679 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 679 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 680 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 680 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 681 nullptr); | 681 nullptr); |
| 682 | 682 |
| 683 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993, 1, 1, 0, 0, 1, 1, | 683 glCopySubTextureCHROMIUM(textures_[0], 99993, 1, 1, 0, 0, 1, 1, |
| 684 false, false, false); | 684 false, false, false); |
| 685 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 685 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 686 | 686 |
| 687 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1], 1, 1, 0, 0, 1, 1, | 687 glCopySubTextureCHROMIUM(99994, textures_[1], 1, 1, 0, 0, 1, 1, |
| 688 false, false, false); | 688 false, false, false); |
| 689 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 689 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 690 | 690 |
| 691 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996, 1, 1, 0, 0, 1, 1, false, | 691 glCopySubTextureCHROMIUM(99995, 99996, 1, 1, 0, 0, 1, 1, false, |
| 692 false, false); | 692 false, false); |
| 693 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); | 693 EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); |
| 694 | 694 |
| 695 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, | 695 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 1, 1, 0, |
| 696 0, 1, 1, false, false, false); | 696 0, 1, 1, false, false, false); |
| 697 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 697 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 698 } | 698 } |
| 699 | 699 |
| 700 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { | 700 TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { |
| 701 uint8_t rgba_pixels[4 * 4] = {255u, 0u, 0u, 255u, 0u, 255u, 0u, 255u, | 701 uint8_t rgba_pixels[4 * 4] = {255u, 0u, 0u, 255u, 0u, 255u, 0u, 255u, |
| 702 0u, 0u, 255u, 255u, 0u, 0u, 0u, 255u}; | 702 0u, 0u, 255u, 255u, 0u, 0u, 0u, 255u}; |
| 703 glBindTexture(GL_TEXTURE_2D, textures_[0]); | 703 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 704 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 704 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 705 rgba_pixels); | 705 rgba_pixels); |
| 706 | 706 |
| 707 uint8_t transparent_pixels[4 * 4] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, | 707 uint8_t transparent_pixels[4 * 4] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, |
| 708 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}; | 708 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}; |
| 709 glBindTexture(GL_TEXTURE_2D, textures_[1]); | 709 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 710 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 710 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 711 transparent_pixels); | 711 transparent_pixels); |
| 712 | 712 |
| 713 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, | 713 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 1, 1, 0, |
| 714 0, 1, 1, false, false, false); | 714 0, 1, 1, false, false, false); |
| 715 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 715 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 716 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 0, 1, | 716 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 1, 0, 1, |
| 717 0, 1, 1, false, false, false); | 717 0, 1, 1, false, false, false); |
| 718 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 718 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 719 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 1, 0, | 719 glCopySubTextureCHROMIUM(textures_[0], textures_[1], 0, 1, 0, |
| 720 1, 1, 1, false, false, false); | 720 1, 1, 1, false, false, false); |
| 721 EXPECT_TRUE(glGetError() == GL_NO_ERROR); | 721 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 722 | 722 |
| 723 // Check the FB is still bound. | 723 // Check the FB is still bound. |
| 724 GLint value = 0; | 724 GLint value = 0; |
| 725 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); | 725 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); |
| 726 GLuint fb_id = value; | 726 GLuint fb_id = value; |
| 727 EXPECT_EQ(framebuffer_id_, fb_id); | 727 EXPECT_EQ(framebuffer_id_, fb_id); |
| 728 | 728 |
| 729 // Check that FB is complete. | 729 // Check that FB is complete. |
| 730 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 730 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 731 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 731 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 732 | 732 |
| 733 uint8_t transparent[1 * 4] = {0u, 0u, 0u, 0u}; | 733 uint8_t transparent[1 * 4] = {0u, 0u, 0u, 0u}; |
| 734 uint8_t red[1 * 4] = {255u, 0u, 0u, 255u}; | 734 uint8_t red[1 * 4] = {255u, 0u, 0u, 255u}; |
| 735 uint8_t green[1 * 4] = {0u, 255u, 0u, 255u}; | 735 uint8_t green[1 * 4] = {0u, 255u, 0u, 255u}; |
| 736 uint8_t blue[1 * 4] = {0u, 0u, 255u, 255u}; | 736 uint8_t blue[1 * 4] = {0u, 0u, 255u, 255u}; |
| 737 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent); | 737 GLTestHelper::CheckPixels(0, 0, 1, 1, 0, transparent); |
| 738 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red); | 738 GLTestHelper::CheckPixels(1, 1, 1, 1, 0, red); |
| 739 GLTestHelper::CheckPixels(1, 0, 1, 1, 0, green); | 739 GLTestHelper::CheckPixels(1, 0, 1, 1, 0, green); |
| 740 GLTestHelper::CheckPixels(0, 1, 1, 1, 0, blue); | 740 GLTestHelper::CheckPixels(0, 1, 1, 1, 0, blue); |
| 741 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 741 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 742 } | 742 } |
| 743 | 743 |
| 744 } // namespace gpu | 744 } // namespace gpu |
| OLD | NEW |