[Piglit] [PATCH] arb_texture_multisample: add error check for samples == 0

Timothy Arceri t_arceri at yahoo.com.au
Mon Aug 17 04:05:33 PDT 2015


Test results:
Nvidia GeForce 840M - NVIDIA 346.47: pass

Cc: Tapani Pälli <tapani.palli at intel.com>
---
 tests/spec/arb_texture_multisample/errors.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_texture_multisample/errors.c b/tests/spec/arb_texture_multisample/errors.c
index 0c16f4e..ba9f1e6 100644
--- a/tests/spec/arb_texture_multisample/errors.c
+++ b/tests/spec/arb_texture_multisample/errors.c
@@ -41,13 +41,14 @@ piglit_init(int argc, char **argv)
 {
     /* test some new error cases */
 
-    GLuint fbo, tex;
+    GLuint fbo;
+    GLuint tex[2];
     glGenFramebuffers(1, &fbo);
 
     glBindFramebuffer(GL_FRAMEBUFFER, fbo);
 
-    glGenTextures(1, &tex);
-    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex);
+    glGenTextures(2, tex);
+    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex[0]);
     glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
             4, GL_RGBA, 64, 64, 2, GL_TRUE);
 
@@ -57,7 +58,7 @@ piglit_init(int argc, char **argv)
     }
 
     /* binding a negative layer should fail */
-    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, -1);
+    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex[0], 0, -1);
 
     if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
         printf("glFramebufferTextureLayer w/ negative layer must "
@@ -65,5 +66,16 @@ piglit_init(int argc, char **argv)
         piglit_report_result(PIGLIT_FAIL);
     }
 
+    /* An INVALID_VALUE error is generated if samples is zero. */
+    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex[1]);
+    glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+            0, GL_RGBA, 64, 64, 2, GL_TRUE);
+
+    if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
+        printf("glFramebufferTextureLayer w/ sampler == 0 must "
+                "emit GL_INVALID_VALUE but did not\n");
+        piglit_report_result(PIGLIT_FAIL);
+    }
+
     piglit_report_result(PIGLIT_PASS);
 }
-- 
2.4.3



More information about the Piglit mailing list