summaryrefslogtreecommitdiff
path: root/tests/spec/ext_packed_float
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2015-07-13 11:46:20 -0600
committerBrian Paul <brianp@vmware.com>2015-07-22 10:53:38 -0600
commit620f8dba6d800b1b9698402363caa70771c29b03 (patch)
tree167bc20e29487828866de462d2d9fde9e28c6e8f /tests/spec/ext_packed_float
parent6bb5478a7b20e3fe07b6c113cdc408d0b61d9a27 (diff)
ext_packed_float: fix getteximage-invalid-format-for-packed-type test
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. v2: s/sizeof(float)/4/, per Jose Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'tests/spec/ext_packed_float')
-rw-r--r--tests/spec/ext_packed_float/getteximage-invalid-format-for-packed-type.c15
1 files changed, 14 insertions, 1 deletions
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 c030c1c92..34f8d2a5c 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 * 4];
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++) {