[Piglit] [PATCH 01/24] tex3d: assorted clean-ups
Jose Fonseca
jfonseca at vmware.com
Wed Apr 30 07:25:58 PDT 2014
----- Original Message -----
> On 04/29/2014 12:05 PM, Jose Fonseca wrote:
> >
> >
> > ----- Original Message -----
> >> Don't call piglit_report_result() - return result from piglit_display().
> >> Use default window size and fix "row wrapping" to avoid drawing off the
> >> edge of the window.
> >> Use bool instead of int.
> >> Use piglit_get_gl_enum_name().
> >> Use GLubyte instead of unsigned char.
> >> Set texture env mode to replace.
> >> ---
> >> tests/texturing/tex3d.c | 69
> >> +++++++++++++++++++++++------------------------
> >> 1 file changed, 33 insertions(+), 36 deletions(-)
> >>
> >> diff --git a/tests/texturing/tex3d.c b/tests/texturing/tex3d.c
> >> index 05c29a6..0dd72fc 100644
> >> --- a/tests/texturing/tex3d.c
> >> +++ b/tests/texturing/tex3d.c
> >> @@ -32,9 +32,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> >>
> >> config.supports_gl_compat_version = 10;
> >>
> >> - config.window_width = 128;
> >> - config.window_height = 128;
> >> - config.window_visual = PIGLIT_GL_VISUAL_RGBA;
> >> + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> >>
> >> PIGLIT_GL_TEST_CONFIG_END
> >>
> >> @@ -50,17 +48,8 @@ static int nrcomponents(GLenum format)
> >> }
> >> }
> >>
> >> -static const char* formatname(GLenum format)
> >> -{
> >> - switch(format) {
> >> - case GL_RGBA: return "GL_RGBA";
> >> - case GL_RGB: return "GL_RGB";
> >> - case GL_ALPHA: return "GL_ALPHA";
> >> - default: abort();
> >> - }
> >> -}
> >> -
> >> -static void expected_rgba(GLenum format, const unsigned char* texdata,
> >> unsigned char* expected)
> >> +static void
> >> +expected_rgba(GLenum format, const GLubyte *texdata, GLubyte *expected)
> >> {
> >> switch(format) {
> >> case GL_RGBA:
> >> @@ -84,13 +73,15 @@ static void expected_rgba(GLenum format, const
> >> unsigned
> >> char* texdata, unsigned
> >> }
> >> }
> >>
> >> -static int render_and_check(int w, int h, int d, GLenum format, float q,
> >> unsigned char* data, const char* test)
> >> +static bool
> >> +render_and_check(int w, int h, int d, GLenum format, float q,
> >> + const GLubyte *data, const char* test)
> >> {
> >> int x, y, z;
> >> int layer;
> >> - unsigned char* readback;
> >> - unsigned char* texp;
> >> - unsigned char* readp;
> >> + GLubyte *readback;
> >> + const GLubyte *texp;
> >> + GLubyte *readp;
> >> int ncomp = 0;
> >>
> >> glClearColor(0.0, 0.0, 0.0, 0.0);
> >> @@ -111,18 +102,18 @@ static int render_and_check(int w, int h, int d,
> >> GLenum
> >> format, float q, unsigne
> >> glVertex2f(x, y+h);
> >> glEnd();
> >> x += w;
> >> - if (x >= piglit_width) {
> >> + if (x + w >= piglit_width) {
> >
> > Won't this change the behavior? At a glance it doesn't look like it will
> > do the same thing.
>
> The test draws a series of quads from left to right. This conditional
> checks if we're about to draw off the right edge of the window, and if
> so, starts the next row. The same change was made below for the probing
> code.
>
> Between the original window size and the texture size being tested, I
> don't think the condition was ever actually hit. The corrected code was
> already present in the tex3d-npot.c test, btw.
I see. Looks good AFAICT then.
Jose
More information about the Piglit
mailing list