diff mbox

arb_texture_multisample: add error check for samples == 0

Message ID 1439809533-3385-1-git-send-email-t_arceri@yahoo.com.au
State New
Headers show

Commit Message

'Timothy Arceri' via Patchwork Forward Aug. 17, 2015, 11:05 a.m. UTC
Test results:
Nvidia GeForce 840M - NVIDIA 346.47: pass

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

Comments

'Timothy Arceri' via Patchwork Forward Aug. 17, 2015, 12:06 p.m. UTC | #1
On Mon, 2015-08-17 at 14:14 +0300, Tapani Pälli wrote:
> Please add comment to commit message that this currently fails with Mesa 
> (otherwise QA may file a bug about it).

Thanks. In that case I'll just hold onto it until the mesa patch lands.

> 
> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
On 08/17/2015 02:05 PM, Timothy Arceri wrote:
> > Test results:
> > Nvidia GeForce 840M - NVIDIA 346.47: pass
> > 
> > Cc: Tapani Pälli <tapani.palli@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);
> >   }
> >
diff mbox

Patch

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);
 }