[v2,6/6] s3tc-errors: port to gles20

Submitted by Erik Faye-Lund on Oct. 26, 2018, 1:03 p.m.

Details

Message ID 20181026130308.12519-7-erik.faye-lund@collabora.com
State Accepted
Commit 6b540eca7a61116288e557a82ca72fa6b2fe68fd
Headers show
Series "port s3tc tests to gles2" ( rev: 1 ) in Piglit

Browsing this patch as part of:
"port s3tc tests to gles2" rev 1 in Piglit
<< prev patch [6/6] next patch >>

Commit Message

Erik Faye-Lund Oct. 26, 2018, 1:03 p.m.
The glGetTexLevelParameteriv-function wasn't added to gles before
gles31, so let's just skip those tests on earlier versions. This
allows us to also run this test on gles20.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
---
 tests/texturing/s3tc-errors.c | 51 ++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 24 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index 4401dd23c..7e9bfa8b5 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -39,7 +39,7 @@  PIGLIT_GL_TEST_CONFIG_BEGIN
 #ifdef PIGLIT_USE_OPENGL
     config.supports_gl_compat_version = 11;
 #else // PIGLIT_USE_OPENGL_ES2
-    config.supports_gl_es_version = 31;
+    config.supports_gl_es_version = 20;
 #endif
 
     config.window_width = 200;
@@ -196,34 +196,37 @@  test_format(int width, int height, GLfloat *image, GLenum requested_format)
 	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 	pass = check_rendering(width, height) && pass;
 
-	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED,
-				 &is_compressed);
-	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT,
-				 &format);
-	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
-				 GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
-				 &compressed_size);
+	if (!piglit_is_gles() || piglit_get_gl_version() >= 31) {
 
-	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+		glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED,
+					 &is_compressed);
+		glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
+					 GL_TEXTURE_INTERNAL_FORMAT, &format);
+		glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
+					 GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
+					 &compressed_size);
 
-	if (!is_compressed) {
-		printf("Image was not compressed\n");
-		pass = false;
-	}
+		pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 
-	if (format != requested_format) {
-		printf("Internal Format mismatch. Found: 0x%04x Expected: 0x%04x\n",
-		       format, requested_format);
-		pass = false;
-	}
+		if (!is_compressed) {
+			printf("Image was not compressed\n");
+			pass = false;
+		}
+
+		if (format != requested_format) {
+			printf("Internal Format mismatch. Found: 0x%04x Expected: 0x%04x\n",
+			       format, requested_format);
+			pass = false;
+		}
 
-	expected_size = piglit_compressed_image_size(requested_format, width,
-			height);
+		expected_size = piglit_compressed_image_size(requested_format,
+				width, height);
 
-	if (compressed_size != expected_size) {
-		printf("Compressed image size mismatch. Found: %u Expected: %u\n",
-		       compressed_size, expected_size);
-		pass = false;
+		if (compressed_size != expected_size) {
+			printf("Compressed image size mismatch. Found: %u Expected: %u\n",
+			       compressed_size, expected_size);
+			pass = false;
+		}
 	}
 
 #ifdef PIGLIT_USE_OPENGL