On Mon, May 18, 2015 at 01:49:58PM -0700, Ian Romanick wrote: > From: Ian Romanick <[email protected]> > > This test is based on a very, very old piglit test. It's so old that it > predates these utility functions. > > Signed-off-by: Ian Romanick <[email protected]>
Patches 3-5 are clear improvements in my eyes: Reviewed-by: Topi Pohjolainen <[email protected]> > --- > .../arb_direct_state_access/copytexturesubimage.c | 45 > ++++------------------ > 1 file changed, 7 insertions(+), 38 deletions(-) > > diff --git a/tests/spec/arb_direct_state_access/copytexturesubimage.c > b/tests/spec/arb_direct_state_access/copytexturesubimage.c > index 3c83245..d8a8b0d 100644 > --- a/tests/spec/arb_direct_state_access/copytexturesubimage.c > +++ b/tests/spec/arb_direct_state_access/copytexturesubimage.c > @@ -39,15 +39,6 @@ int have_rect = 0; > /** Should non-power-of-two textures be tested? */ > int have_NPOT = 0; > > -static void rect(int x1, int y1, int x2, int y2) > -{ > - glBegin(GL_POLYGON); > - glVertex2f(x1, y1); > - glVertex2f(x1, y2); > - glVertex2f(x2, y2); > - glVertex2f(x2, y1); > - glEnd(); > -} > static bool inrect(int x, int y, int x1, int y1, int x2, int y2) > { > if (x >= x1 && x < x2 && y >= y1 && y < y2) > @@ -128,11 +119,11 @@ do_row(int srcy, int srcw, int srch, GLenum target) > > /* Draw the object we're going to copy */ > glColor3f(1.0, 0.0, 0.0); > - rect(srcx, srcy, srcx + srcw, srcy + srch); > + piglit_draw_rect(srcx, srcy, srcw, srch); > glColor3f(0.0, 1.0, 0.0); > - rect(srcx + 5, srcy + 5, srcx + srcw - 5, srcy + srch/2); > + piglit_draw_rect(srcx + 5, srcy + 5, srcw - 10, srch/2 - 5); > glColor3f(0.0, 0.0, 1.0); > - rect(srcx + 5, srcy + srch/2, srcx + srcw - 5, srcy + srch - 5); > + piglit_draw_rect(srcx + 5, srcy + srch/2, srcw - 10, srch - 5 - srch/2); > > /* Create a texture image and copy it in */ > glGenTextures(1, &texname); > @@ -157,19 +148,8 @@ do_row(int srcy, int srcw, int srch, GLenum target) > srcw, srch); > > /* Draw the texture image out */ > - glBegin(GL_POLYGON); > - glTexCoord2f(0.0, 0.0); > - glVertex2f(dstx, dsty); > - > - glTexCoord2f(0.0, tex_t_max); > - glVertex2f(dstx, dsty + srch); > - > - glTexCoord2f(tex_s_max, tex_t_max); > - glVertex2f(dstx + srcw, dsty + srch); > - > - glTexCoord2f(tex_s_max, 0.0); > - glVertex2f(dstx + srcw, dsty); > - glEnd(); > + piglit_draw_rect_tex(dstx, dsty, srcw, srch, > + 0.0, 0.0, tex_s_max, tex_t_max); > > glTexImage2D(target, 0, GL_RGBA8, srcw, srch, 0, > GL_RGBA, GL_UNSIGNED_BYTE, NULL); > @@ -194,19 +174,8 @@ do_row(int srcy, int srcw, int srch, GLenum target) > remain_width, remain_height); > > /* Draw the texture image out */ > - glBegin(GL_POLYGON); > - glTexCoord2f(0.0, 0.0); > - glVertex2f(dstx2, dsty2); > - > - glTexCoord2f(0.0, tex_t_max); > - glVertex2f(dstx2, dsty2 + srch); > - > - glTexCoord2f(tex_s_max, tex_t_max); > - glVertex2f(dstx2 + srcw, dsty2 + srch); > - > - glTexCoord2f(tex_s_max, 0.0); > - glVertex2f(dstx2 + srcw, dsty2); > - glEnd(); > + piglit_draw_rect_tex(dstx2, dsty2, srcw, srch, > + 0.0, 0.0, tex_s_max, tex_t_max); > > glDisable(target); > glDeleteTextures(1, &texname); > -- > 2.1.0 > > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
