Work around deprecated LUMA formats in the core profile.
Use R and RG textures with swizzle states to emulate them. A manual blit is
required when calling CopyTex[Sub]Image from a RGB[A] framebuffer to an
emulated L[A] texture so that the alpha channel ends up in the correct channel
of the destination texture.
Fixes the following tests when using the core profile:
* conformance/extensions/oes-texture-float.html
* conformance/extensions/oes-texture-half-float.html
* conformance/textures/misc/tex-sub-image-2d.html
* conformance/textures/misc/texture-formats-test.html
* conformance/textures/misc/texture-npot.html
BUG=angleproject:1113
Change-Id: If5540e66d9017596bd83d95ec3ede043cbcfe0d2
Reviewed-on: https://chromium-review.googlesource.com/293905
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/SwizzleTest.cpp b/src/tests/gl_tests/SwizzleTest.cpp
index 92cafd9..d816488 100644
--- a/src/tests/gl_tests/SwizzleTest.cpp
+++ b/src/tests/gl_tests/SwizzleTest.cpp
@@ -108,8 +108,7 @@
{
glGenTextures(1, &mTexture);
glBindTexture(GL_TEXTURE_2D, mTexture);
- glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, dataFormat, dataType, data);
+ glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, 1, 1, 0, dataFormat, dataType, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -268,6 +267,52 @@
runTest2D();
}
+TEST_P(SwizzleTest, L8_2D)
+{
+ GLubyte data[] = {0x77};
+ init2DTexture(GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
+ runTest2D();
+}
+
+TEST_P(SwizzleTest, A8_2D)
+{
+ GLubyte data[] = {0x55};
+ init2DTexture(GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, data);
+ runTest2D();
+}
+
+TEST_P(SwizzleTest, LA8_2D)
+{
+ GLubyte data[] = {0x77, 0x66};
+ init2DTexture(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data);
+ runTest2D();
+}
+
+TEST_P(SwizzleTest, L32F_2D)
+{
+ GLfloat data[] = {0.7f};
+ init2DTexture(GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT, data);
+ runTest2D();
+}
+
+TEST_P(SwizzleTest, A32F_2D)
+{
+ GLfloat data[] = {
+ 0.4f,
+ };
+ init2DTexture(GL_ALPHA, GL_ALPHA, GL_FLOAT, data);
+ runTest2D();
+}
+
+TEST_P(SwizzleTest, LA32F_2D)
+{
+ GLfloat data[] = {
+ 0.5f, 0.6f,
+ };
+ init2DTexture(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT, data);
+ runTest2D();
+}
+
#include "media/pixel.inl"
TEST_P(SwizzleTest, CompressedDXT_2D)
@@ -283,6 +328,6 @@
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(SwizzleTest, ES3_D3D11(), ES3_OPENGL());
+ANGLE_INSTANTIATE_TEST(SwizzleTest, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGL(3, 3));
} // namespace