[Piglit] [PATCH] Fix etc2 test for format=COMPRESSED_R11_EAC

Anuj Phogat anuj.phogat at gmail.com
Fri Mar 8 15:07:21 PST 2013


waffles-decompressed-etc2-r11-64x32-miptree.ktx contains per pixel RGBA data
generated by ericsson's etcpack tool. While generating decompressed image
for COMPRESSED_R11_EAC format, RED color data for each pixel is copied to
GREEN and BLUE channels as well. Using this image for texturing in OpenGL ES
3.0 (internalFormat=GL_R8) causes GL_INVALID_OPERATION. This is because
glTexImage2D() in GL ES 3.0 doesn't allow internalFormat = GL_R8 with
format= GL_RGBA. To workaround this issue use internalFormat = GL_RGBA and
mask all color channels except Red.

Other option is to edit the waffles-decompressed-etc2-r11-64x32-miptree.ktx
file and set all GREN, BLUE components to zero. Considering the hassle involved
in editing image file, I won't prefer that.

This fixes the piglit failure on gles3 with COMPRESSED_R11_EAC format.

Note: This patch depends on: [PATCH V2] Enable etc2 tests on gl contexts that
support GL_ARB_ES3_compatibility extension

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 .../gles-3.0/oes_compressed_etc2_texture-miptree.c  |   7 +++++++
 .../waffles-decompressed-etc2-r11-64x32-miptree.ktx | Bin 11016 -> 11016 bytes
 2 files changed, 7 insertions(+)

diff --git a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
index 0e29fd1..bfed1a5 100644
--- a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
+++ b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
@@ -199,6 +199,13 @@ piglit_init(int argc, char **argv)
 		decompressed_filename =
 			"waffles-decompressed-etc2-srgb8-alpha8-64x32-miptree.ktx";
 	} else if (strcmp(argv[1], "r11") == 0){
+		/* waffles-decompressed-etc2-r11-64x32-miptree.ktx contains
+		 * per pixel RGBA data. But, glTexImage2D() in OpenGL ES 3.0
+		 * doesn't allow internalFormat = GL_R8 with format= GL_RGBA.
+		 * To workaround this issue use internalFormat = GL_RGBA and
+		 * mask all the color channels except Red.
+		 */
+		glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
 		compressed_filename =
 			"waffles-compressed-etc2-r11-64x32-miptree.ktx";
 		decompressed_filename =
diff --git a/tests/spec/gles-3.0/waffles-decompressed-etc2-r11-64x32-miptree.ktx b/tests/spec/gles-3.0/waffles-decompressed-etc2-r11-64x32-miptree.ktx
index 26315752fcabbdaf5c582f8fcf58b3dc35f3ddeb..f74e42b96f4dd68d644f3ec16952851c2724a778 100644
GIT binary patch
delta 12
TcmeAO>j;}5!^p8w_O%uO9RUPY

delta 12
TcmeAO>j;}5!^pf*_O%uO9Owj4

-- 
1.7.11.7



More information about the Piglit mailing list