Vulkan: Expose extension for ETC1 usage with subimage updates
This CL implements the GL_EXT_compressed_ETC1_RGB8_sub_texture
extension, which was added to relax restrictions on using
ETC1_RGB8_OES for subimage updates.
Test: Temple Run on Android
Bug: b:152512564
Change-Id: I78cfd7dfd54fab36dee59a93b3ec3bfce17e73e4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2123232
Commit-Queue: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index e4501ad..32993d6 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -1448,6 +1448,24 @@
GLuint mPBO;
};
+class ETC1CompressedTextureTest : public Texture2DTest
+{
+ protected:
+ ETC1CompressedTextureTest() : Texture2DTest() {}
+
+ void testSetUp() override
+ {
+ TexCoordDrawTest::testSetUp();
+ glGenTextures(1, &mTexture2D);
+ glBindTexture(GL_TEXTURE_2D, mTexture2D);
+ EXPECT_GL_NO_ERROR();
+
+ setUpProgram();
+ }
+
+ void testTearDown() override { Texture2DTest::testTearDown(); }
+};
+
TEST_P(Texture2DTest, NegativeAPISubImage)
{
glBindTexture(GL_TEXTURE_2D, mTexture2D);
@@ -6083,6 +6101,50 @@
ASSERT_GL_NO_ERROR();
}
+// Test using ETC1_RGB8 with subimage updates
+TEST_P(ETC1CompressedTextureTest, ETC1CompressedSubImage)
+{
+ // ETC texture formats are not supported on Mac OpenGL. http://anglebug.com/3853
+ ANGLE_SKIP_TEST_IF(IsOSX() && IsDesktopOpenGL());
+
+ ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3 &&
+ !IsGLExtensionEnabled("GL_EXT_texture_storage"));
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_compressed_ETC1_RGB8_sub_texture"));
+
+ const GLuint width = 4u;
+ const GLuint height = 4u;
+
+ setWindowWidth(width);
+ setWindowHeight(height);
+
+ // Setup primary Texture
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ if (getClientMajorVersion() < 3)
+ {
+ glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_ETC1_RGB8_OES, width, height);
+ }
+ else
+ {
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_ETC1_RGB8_OES, width, height);
+ }
+ ASSERT_GL_NO_ERROR();
+
+ // Populate a subimage of the texture
+ glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_ETC1_RGB8_OES,
+ width * height / 2u, kCompressedImageETC2);
+ ASSERT_GL_NO_ERROR();
+
+ // Render and ensure we get red
+ glUseProgram(mProgram);
+ drawQuad(mProgram, "position", 0.5f);
+ ASSERT_GL_NO_ERROR();
+
+ EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 2, getWindowHeight() / 2, GLColor::red);
+ ASSERT_GL_NO_ERROR();
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST_ES2(Texture2DTest);
@@ -6122,5 +6184,6 @@
ANGLE_INSTANTIATE_TEST_ES3(Texture3DIntegerTestES3);
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(Texture2DDepthTest);
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(PBOCompressedTextureTest);
+ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ETC1CompressedTextureTest);
} // anonymous namespace