| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } else { | 303 } else { |
| 304 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 304 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 305 kUncompressedPixels); | 305 kUncompressedPixels); |
| 306 | 306 |
| 307 glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], | 307 glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], |
| 308 textures_[1], 0, 0, 0, 0, 1, 1); | 308 textures_[1], 0, 0, 0, 0, 1, 1); |
| 309 } | 309 } |
| 310 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); | 310 EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); |
| 311 } | 311 } |
| 312 | 312 |
| 313 TEST_P(GLCompressedCopyTextureCHROMIUMTest, InvalidTextureIds) { |
| 314 if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { |
| 315 LOG(INFO) |
| 316 << "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; |
| 317 return; |
| 318 } |
| 319 |
| 320 CopyType copy_type = GetParam(); |
| 321 |
| 322 glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| 323 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 324 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 325 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 326 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 327 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, |
| 328 4, 0, sizeof(kCompressedImageDXT1), |
| 329 kCompressedImageDXT1); |
| 330 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 331 |
| 332 glBindTexture(GL_TEXTURE_2D, textures_[1]); |
| 333 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 334 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 335 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 336 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 337 if (copy_type == TexImage) { |
| 338 glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993); |
| 339 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 340 |
| 341 glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1]); |
| 342 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 343 |
| 344 glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996); |
| 345 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 346 |
| 347 glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); |
| 348 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 349 } else { |
| 350 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, |
| 351 4, 0, sizeof(kInvalidCompressedImage), |
| 352 kInvalidCompressedImage); |
| 353 |
| 354 glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993, 0, 0, |
| 355 0, 0, 4, 4); |
| 356 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 357 |
| 358 glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1], 0, 0, |
| 359 0, 0, 4, 4); |
| 360 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 361 |
| 362 glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996, 0, 0, 0, 0, |
| 363 4, 4); |
| 364 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); |
| 365 |
| 366 glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], |
| 367 textures_[1], 0, 0, 0, 0, 4, 4); |
| 368 EXPECT_TRUE(glGetError() == GL_NO_ERROR); |
| 369 } |
| 370 } |
| 371 |
| 313 // Validate that some basic GL state is not touched upon execution of | 372 // Validate that some basic GL state is not touched upon execution of |
| 314 // the extension. | 373 // the extension. |
| 315 TEST_P(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { | 374 TEST_P(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { |
| 316 if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { | 375 if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { |
| 317 LOG(INFO) << | 376 LOG(INFO) << |
| 318 "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; | 377 "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; |
| 319 return; | 378 return; |
| 320 } | 379 } |
| 321 | 380 |
| 322 CopyType copy_type = GetParam(); | 381 CopyType copy_type = GetParam(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 | 764 |
| 706 // Note that while destination texture is 8 x 8 pixels the viewport is only | 765 // Note that while destination texture is 8 x 8 pixels the viewport is only |
| 707 // 4 x 4. | 766 // 4 x 4. |
| 708 GLTestHelper::CheckPixels(0, 0, 4, 2, 0, kRed); | 767 GLTestHelper::CheckPixels(0, 0, 4, 2, 0, kRed); |
| 709 GLTestHelper::CheckPixels(0, 2, 2, 2, 0, kBlue); | 768 GLTestHelper::CheckPixels(0, 2, 2, 2, 0, kBlue); |
| 710 GLTestHelper::CheckPixels(2, 2, 2, 2, 0, kBlack); | 769 GLTestHelper::CheckPixels(2, 2, 2, 2, 0, kBlack); |
| 711 EXPECT_TRUE(GL_NO_ERROR == glGetError()); | 770 EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| 712 } | 771 } |
| 713 | 772 |
| 714 } // namespace gpu | 773 } // namespace gpu |
| OLD | NEW |