Implement CHROMIUM_copy_texture for OpenGL.
This also makes BlitGL work correctly on OpenGL ES (provided vertex
arrays are available)
BUG=angleproject:1356
Change-Id: Icb7cef35bebfe6672220aa0b312ab89187dbf585
Reviewed-on: https://chromium-review.googlesource.com/412452
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/CopyTextureTest.cpp b/src/tests/gl_tests/CopyTextureTest.cpp
index 553861e..93f3ca0 100644
--- a/src/tests/gl_tests/CopyTextureTest.cpp
+++ b/src/tests/gl_tests/CopyTextureTest.cpp
@@ -532,7 +532,7 @@
}
// Test that unmultipying and premultiplying the alpha is the same as doing neither
-TEST_P(CopyTextureTest, UnmultiplyAndPremultplyAlpha)
+TEST_P(CopyTextureTest, UnmultiplyAndPremultiplyAlpha)
{
if (!checkExtensions())
{
@@ -559,6 +559,74 @@
EXPECT_GL_NO_ERROR();
}
+// Test to ensure that CopyTexture works with LUMINANCE_ALPHA texture
+TEST_P(CopyTextureTest, LuminanceAlpha)
+{
+ if (!checkExtensions())
+ {
+ return;
+ }
+
+ uint8_t originalPixels[] = {163u, 67u};
+ GLColor expectedPixels(163u, 163u, 163u, 67u);
+
+ glBindTexture(GL_TEXTURE_2D, mTextures[0]);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 1, 1, 0, GL_LUMINANCE_ALPHA,
+ GL_UNSIGNED_BYTE, &originalPixels);
+
+ glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
+ false);
+
+ EXPECT_GL_NO_ERROR();
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, expectedPixels);
+}
+
+// Test to ensure that CopyTexture works with LUMINANCE texture
+TEST_P(CopyTextureTest, Luminance)
+{
+ if (!checkExtensions())
+ {
+ return;
+ }
+
+ uint8_t originalPixels[] = {57u};
+ GLColor expectedPixels(57u, 57u, 57u, 255u);
+
+ glBindTexture(GL_TEXTURE_2D, mTextures[0]);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
+ &originalPixels);
+
+ glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
+ false);
+
+ EXPECT_GL_NO_ERROR();
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, expectedPixels);
+}
+
+// Test to ensure that CopyTexture works with ALPHA texture
+TEST_P(CopyTextureTest, Alpha)
+{
+ if (!checkExtensions())
+ {
+ return;
+ }
+
+ uint8_t originalPixels[] = {77u};
+ GLColor expectedPixels(0u, 0u, 0u, 77u);
+
+ glBindTexture(GL_TEXTURE_2D, mTextures[0]);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 1, 1, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &originalPixels);
+
+ glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
+ false);
+
+ EXPECT_GL_NO_ERROR();
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, expectedPixels);
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(CopyTextureTest, ES2_D3D9(), ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES());