On Tue, May 12, 2015 at 2:36 PM, Anuj Phogat <[email protected]> wrote: > Testing with PBO currently fails on Mesa i965 driver. > > Signed-off-by: Anuj Phogat <[email protected]> > --- > tests/texturing/getteximage-luminance.c | 66 > ++++++++++++++++++++++++++++++--- > 1 file changed, 60 insertions(+), 6 deletions(-) > > diff --git a/tests/texturing/getteximage-luminance.c > b/tests/texturing/getteximage-luminance.c > index 8869095..a5f7a41 100644 > --- a/tests/texturing/getteximage-luminance.c > +++ b/tests/texturing/getteximage-luminance.c > @@ -67,7 +67,9 @@ test_luminance(void) > { > static const GLfloat lumImage[2*2] = { 0.25, 0.25, 0.25, 0.25 }; > static const GLfloat rgbaImage[4] = { 0.25, 0.0, 0.0, 1.0 }; > - GLuint tex; > + GLuint tex, pbo; > + GLfloat *test_pbo = NULL; > + bool pass = true; > GLfloat test[2*2*4]; > > /* create 2x2 GL_LUMINANCE texture */ > @@ -93,10 +95,36 @@ test_luminance(void) > printf(" Expected %g, %g, %g, %g Found %g, %g, %g, %g\n", > rgbaImage[0], rgbaImage[1], rgbaImage[2], rgbaImage[3], > test[0], test[1], test[2], test[3]); > - return false; > + pass = false; > } > > - return true; > + /* Test reading in to a PBO. */ > + if (!piglit_is_extension_supported("GL_ARB_pixel_buffer_object")) > + return pass; > + > + glGenBuffersARB(1, &pbo); > + glBindBufferARB(GL_PIXEL_PACK_BUFFER, pbo); > + glBufferDataARB(GL_PIXEL_PACK_BUFFER, 2*2*4*4, NULL, > GL_STREAM_DRAW_ARB); > + glPixelStorei(GL_PACK_ALIGNMENT, 1); > + > + /* Get in to a PBO and check rgba image */ > + glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, NULL); > + > + test_pbo = glMapBufferARB(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY_ARB); > + > + if (test_pbo && !rgba_equal(rgbaImage, test_pbo)) { > + printf("%s: glGetTexImage(GL_LUMINANCE as GL_RGBA) in pbo > failed\n", > + TestName); > + printf(" Expected %g, %g, %g, %g Found %g, %g, %g, %g\n", > + rgbaImage[0], rgbaImage[1], rgbaImage[2], rgbaImage[3], > + test_pbo[0], test_pbo[1], test_pbo[2], test_pbo[3]); > + pass = false; > + } > + > + glUnmapBufferARB(GL_PIXEL_PACK_BUFFER); > + glBindBufferARB(GL_PIXEL_PACK_BUFFER, 0); > + glDeleteBuffersARB(1, &pbo); > + return pass; > } > > > @@ -108,7 +136,9 @@ test_rgba(void) > { > static const GLfloat rgbaImage[4] = { 0.5, 0.25, 0.125, 1.0 }; > static const GLfloat lumImage[1] = { 0.5 }; > - GLuint tex; > + GLuint tex, pbo; > + GLfloat *test_pbo = NULL; > + bool pass = true; > GLfloat test[2*2*4]; > > /* create 1x1 GL_RGBA texture */ > @@ -123,10 +153,34 @@ test_rgba(void) > printf("%s: glGetTexImage(GL_RGBA as GL_LUMINANCE) failed\n", > TestName); > printf(" Expected %g Found %g\n", lumImage[0], test[0]); > - return false; > + pass = false; > } > > - return true; > + /* Test reading in to a PBO. */ > + if (!piglit_is_extension_supported("GL_ARB_pixel_buffer_object")) > + return pass; > + > + glGenBuffersARB(1, &pbo); > + glBindBufferARB(GL_PIXEL_PACK_BUFFER, pbo); > + glBufferDataARB(GL_PIXEL_PACK_BUFFER, 2*2*4*4, NULL, > GL_STREAM_DRAW_ARB); > + glPixelStorei(GL_PACK_ALIGNMENT, 1); > + > + /* Get in to a PBO and check luminance image */ > + glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, NULL); > + > + test_pbo = glMapBufferARB(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY_ARB); > + > + if (test_pbo && !rgba_equal(rgbaImage, test_pbo)) { > + printf("%s: glGetTexImage(GL_RGBA as GL_LUMINANCE) in pbo > failed\n", > + TestName); > + printf(" Expected %g Found %g\n", lumImage[0], test_pbo[0]); > + pass = false; > + } > + > + glUnmapBufferARB(GL_PIXEL_PACK_BUFFER); > + glBindBufferARB(GL_PIXEL_PACK_BUFFER, 0); > + glDeleteBuffersARB(1, &pbo); > + return pass; > } > > > -- > 1.9.3 >
If I don't hear any objections I'll push both these patches upstream at end of the day. _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
