[Piglit] [PATCH] ext_packed_float: fix getteximage-invalid-format-for-packed-type test

Brian Paul brianp at vmware.com
Mon Jul 13 10:55:07 PDT 2015


The GL spec doesn't explicitly say that glGetTexImage should generate
GL_INVALID_OPERATION when attempting to retrieve a non-existant texture
image, but that's what NVIDIA's driver does.

The purpose of this test is to check the format/type parameters, so let's
define a packed float texture to avoid the undefined texture situation.

Test now passes with NVIDIA.
---
 .../getteximage-invalid-format-for-packed-type.c          | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/spec/ext_packed_float/getteximage-invalid-format-for-packed-type.c b/tests/spec/ext_packed_float/getteximage-invalid-format-for-packed-type.c
index c030c1c..7756fb3 100644
--- a/tests/spec/ext_packed_float/getteximage-invalid-format-for-packed-type.c
+++ b/tests/spec/ext_packed_float/getteximage-invalid-format-for-packed-type.c
@@ -80,6 +80,9 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+#define TEXSIZE 4
+
+
 /* For simplicity, we are only testing the following types: */
 static const GLenum testedTypes[] = {
 	GL_UNSIGNED_BYTE_3_3_2,
@@ -110,7 +113,7 @@ piglit_init(int argc, char **argv)
 enum piglit_result
 subtest(GLenum format, GLenum type)
 {
-	GLfloat pxBuffer[4];
+	GLfloat pxBuffer[TEXSIZE * TEXSIZE * sizeof(float)];
 	enum piglit_result result;
 
 	glGetTexImage(GL_TEXTURE_2D, 0, format, type, pxBuffer);
@@ -140,6 +143,16 @@ piglit_display(void)
 	int i, j;
 	enum piglit_result result = PIGLIT_PASS;
 	enum piglit_result subtest_result;
+	GLuint tex;
+	GLfloat texData[TEXSIZE][TEXSIZE][3];
+
+	memset(texData, 0, sizeof(texData));
+
+	/* Setup a packed float texture (contents not significant) */
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_2D, tex);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_R11F_G11F_B10F_EXT,
+		     TEXSIZE, TEXSIZE, 0, GL_RGB, GL_FLOAT, texData);
 
 	for (j = 0; j < ARRAY_SIZE(testedTypes); j++) {
 		for (i = 0; i < ARRAY_SIZE(formatTypes); i++) {
-- 
1.9.1



More information about the Piglit mailing list