On 25 August 2012 01:12, Chris Forbes <chr...@ijw.co.nz> wrote: > Converts most of the custom reshape funcs to set the projection > in either piglit_init or piglit_display, depending on whether > it depends on the size. > > Signed-off-by: Chris Forbes <chr...@ijw.co.nz> > --- > tests/bugs/tri-tex-crash.c | 21 ++------------------- > tests/general/linestipple.c | 13 +------------ > tests/general/occlusion_query.c | 15 +-------------- > tests/general/point-line-no-cull.c | 15 ++------------- > tests/general/sync_api.c | 14 +------------- > tests/general/texgen.c | 17 +---------------- > tests/general/varray-disabled.c | 16 ++-------------- > tests/shaders/fp-fog.c | 21 ++------------------- > tests/shaders/fp-incomplete-tex.c | 18 +----------------- > tests/shaders/fp-kil.c | 20 ++------------------ > tests/shaders/fp-lit-mask.c | 17 +---------------- > tests/shaders/fp-lit-src-equals-dst.c | 17 +---------------- > tests/shaders/vpfp-generic.cpp | 17 +---------------- > tests/texturing/crossbar.c | 21 +-------------------- > tests/texturing/getteximage-formats.c | 24 +++--------------------- > tests/texturing/getteximage-simple.c | 23 ++++------------------- > tests/texturing/tex3d-maxsize.c | 12 ++---------- > tests/texturing/tex3d-npot.c | 13 ++----------- > tests/texturing/tex3d.c | 13 ++----------- > tests/texturing/texdepth.c | 25 ++++++------------------- > tests/texturing/texrect-many.c | 17 +---------------- > tests/texturing/texredefine.c | 13 ++----------- > 22 files changed, 41 insertions(+), 341 deletions(-) >
(snip) > > diff --git a/tests/shaders/fp-fog.c b/tests/shaders/fp-fog.c > index 2351544..e977a74 100644 > --- a/tests/shaders/fp-fog.c > +++ b/tests/shaders/fp-fog.c > @@ -60,6 +60,8 @@ piglit_display(void) > int pass = 1; > unsigned i; > > + piglit_ortho_projection(2.0, 2.0, GL_FALSE); > + > This will set up a projection with near=-1 and far=1, but the code you're deleting below uses near=-2 and far=6. I assume you've verified that this change is inconsequential? If so, it would be nice to have a short explanation in the commit message as to why it's inconsequential. A similar comment applies to fp-incomplete-tex.c, fp-kil.c, and getteximage-simple.c. > glClear(GL_COLOR_BUFFER_BIT); > > pglFogCoordf(0.3); > @@ -112,28 +114,11 @@ piglit_display(void) > return pass ? PIGLIT_PASS : PIGLIT_FAIL; > } > > - > -static void Reshape(int width, int height) > -{ > - piglit_width = width; > - piglit_height = height; > - > - glViewport(0, 0, width, height); > - glMatrixMode(GL_PROJECTION); > - glLoadIdentity(); > - glOrtho(0.0, 2.0, 0.0, 2.0, -2.0, 6.0); > - glScalef(1.0, 1.0, -1.0); // flip z-axis > - glMatrixMode(GL_MODELVIEW); > - glLoadIdentity(); > -} > - > void > piglit_init(int argc, char **argv) > { > printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); > > - glutReshapeFunc(Reshape); > - > glClearColor(0.3, 0.3, 0.3, 0.3); > > if (piglit_get_gl_version() >= 14) { > @@ -151,6 +136,4 @@ piglit_init(int argc, char **argv) > glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); > > glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); > - > - Reshape(piglit_width, piglit_height); > } > (snip) > > diff --git a/tests/texturing/getteximage-formats.c > b/tests/texturing/getteximage-formats.c > index 1fe74dc..e48439e 100644 > --- a/tests/texturing/getteximage-formats.c > +++ b/tests/texturing/getteximage-formats.c > @@ -495,12 +495,14 @@ test_all_formats(void) > return pass; > } > > - > + > Considering how much is going on in this patch already, let's move whitespace cleanups (here and in getteximage-simple.c) to a separate patch. > enum piglit_result > piglit_display(void) > { > GLboolean pass; > > + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); > + > if (piglit_automatic) { > pass = test_all_formats(); > } > @@ -520,21 +522,6 @@ piglit_display(void) > return pass ? PIGLIT_PASS : PIGLIT_FAIL; > } > > - > -static void > -reshape(int width, int height) > -{ > - piglit_width = width; > - piglit_height = height; > - glViewport(0, 0, width, height); > - glMatrixMode(GL_PROJECTION); > - glLoadIdentity(); > - glOrtho(0, piglit_width, 0, piglit_height, -1.0, 1.0); > - glMatrixMode(GL_MODELVIEW); > - glLoadIdentity(); > -} > - > - > void > piglit_init(int argc, char **argv) > { > @@ -548,11 +535,6 @@ piglit_init(int argc, char **argv) > fbo_formats_init(argc, argv, 0); > (void) fbo_formats_display; > > - glutReshapeFunc(reshape); > - /*glutKeyboardFunc(key);*/ > - > - reshape(piglit_width, piglit_height); > - > glGenTextures(1, &t); > glBindTexture(GL_TEXTURE_2D, t); > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); > (snip) > diff --git a/tests/texturing/texrect-many.c > b/tests/texturing/texrect-many.c > index 11e75d0..aaff6fb 100644 > --- a/tests/texturing/texrect-many.c > +++ b/tests/texturing/texrect-many.c > @@ -98,19 +98,6 @@ piglit_display(void) > return pass ? PIGLIT_PASS : PIGLIT_FAIL; > } > > -static void Reshape(int width, int height) > -{ > - piglit_width = width; > - piglit_height = height; > - glViewport(0, 0, width, height); > - glMatrixMode(GL_PROJECTION); > - glLoadIdentity(); > - glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); > - glScalef(1.0, 1.0, -1.0); // flip z-axis > It looks like the call to glScalef() was dropped. Again, it would be nice to have a short explanation in the commit message as to why this is ok. > - glMatrixMode(GL_MODELVIEW); > - glLoadIdentity(); > -} > - > void piglit_init(int argc, char **argv) > { > int i; > @@ -121,8 +108,6 @@ void piglit_init(int argc, char **argv) > piglit_report_result(PIGLIT_SKIP); > } > > - glutReshapeFunc(Reshape); > - > piglit_require_extension("GL_ARB_texture_rectangle"); > > glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxtextures); > @@ -160,5 +145,5 @@ void piglit_init(int argc, char **argv) > glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, > GL_TEXTURE_MAG_FILTER, GL_NEAREST); > } > > - Reshape(piglit_width, piglit_height); > + piglit_ortho_projection(1.0, 1.0, GL_FALSE); > } > diff --git a/tests/texturing/texredefine.c b/tests/texturing/texredefine.c > index 9c69b27..5f470b3 100644 > --- a/tests/texturing/texredefine.c > +++ b/tests/texturing/texredefine.c > @@ -184,6 +184,8 @@ piglit_display(void) > > testnr = 0; > > + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); > + > glClearColor(0.5, 0.5, 0.5, 1.0); > glClear(GL_COLOR_BUFFER_BIT); > > @@ -201,17 +203,6 @@ piglit_display(void) > return pass ? PIGLIT_PASS : PIGLIT_FAIL; > } > > - > -static void Reshape(int width, int height) > -{ > - glViewport(0, 0, width, height); > - piglit_ortho_projection(width, height, GL_FALSE); > -} > - > - > void piglit_init(int argc, char **argv) > { > - glutReshapeFunc(Reshape); > - > - Reshape(piglit_width, piglit_height); > } > -- > 1.7.12 > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit