On 25 August 2012 01:12, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Converts most of the custom reshape funcs to set the projection<br>
in either piglit_init or piglit_display, depending on whether<br>
it depends on the size.<br>
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
tests/bugs/tri-tex-crash.c | 21 ++-------------------<br>
tests/general/linestipple.c | 13 +------------<br>
tests/general/occlusion_query.c | 15 +--------------<br>
tests/general/point-line-no-cull.c | 15 ++-------------<br>
tests/general/sync_api.c | 14 +-------------<br>
tests/general/texgen.c | 17 +----------------<br>
tests/general/varray-disabled.c | 16 ++--------------<br>
tests/shaders/fp-fog.c | 21 ++-------------------<br>
tests/shaders/fp-incomplete-tex.c | 18 +-----------------<br>
tests/shaders/fp-kil.c | 20 ++------------------<br>
tests/shaders/fp-lit-mask.c | 17 +----------------<br>
tests/shaders/fp-lit-src-equals-dst.c | 17 +----------------<br>
tests/shaders/vpfp-generic.cpp | 17 +----------------<br>
tests/texturing/crossbar.c | 21 +--------------------<br>
tests/texturing/getteximage-formats.c | 24 +++---------------------<br>
tests/texturing/getteximage-simple.c | 23 ++++-------------------<br>
tests/texturing/tex3d-maxsize.c | 12 ++----------<br>
tests/texturing/tex3d-npot.c | 13 ++-----------<br>
tests/texturing/tex3d.c | 13 ++-----------<br>
tests/texturing/texdepth.c | 25 ++++++-------------------<br>
tests/texturing/texrect-many.c | 17 +----------------<br>
tests/texturing/texredefine.c | 13 ++-----------<br>
22 files changed, 41 insertions(+), 341 deletions(-)<br></blockquote><div><br>(snip)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/tests/shaders/fp-fog.c b/tests/shaders/fp-fog.c<br>
index 2351544..e977a74 100644<br>
--- a/tests/shaders/fp-fog.c<br>
+++ b/tests/shaders/fp-fog.c<br>
@@ -60,6 +60,8 @@ piglit_display(void)<br>
int pass = 1;<br>
unsigned i;<br>
<br>
+ piglit_ortho_projection(2.0, 2.0, GL_FALSE);<br>
+<br></blockquote><div><br>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.<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
glClear(GL_COLOR_BUFFER_BIT);<br>
<br>
pglFogCoordf(0.3);<br>
@@ -112,28 +114,11 @@ piglit_display(void)<br>
return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
}<br>
<br>
-<br>
-static void Reshape(int width, int height)<br>
-{<br>
- piglit_width = width;<br>
- piglit_height = height;<br>
-<br>
- glViewport(0, 0, width, height);<br>
- glMatrixMode(GL_PROJECTION);<br>
- glLoadIdentity();<br>
- glOrtho(0.0, 2.0, 0.0, 2.0, -2.0, 6.0);<br>
- glScalef(1.0, 1.0, -1.0); // flip z-axis<br>
- glMatrixMode(GL_MODELVIEW);<br>
- glLoadIdentity();<br>
-}<br>
-<br>
void<br>
piglit_init(int argc, char **argv)<br>
{<br>
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));<br>
<br>
- glutReshapeFunc(Reshape);<br>
-<br>
glClearColor(0.3, 0.3, 0.3, 0.3);<br>
<br>
if (piglit_get_gl_version() >= 14) {<br>
@@ -151,6 +136,4 @@ piglit_init(int argc, char **argv)<br>
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog);<br>
<br>
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);<br>
-<br>
- Reshape(piglit_width, piglit_height);<br>
}<br></blockquote><div><br>(snip)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/tests/texturing/getteximage-formats.c b/tests/texturing/getteximage-formats.c<br>
index 1fe74dc..e48439e 100644<br>
--- a/tests/texturing/getteximage-formats.c<br>
+++ b/tests/texturing/getteximage-formats.c<br>
@@ -495,12 +495,14 @@ test_all_formats(void)<br>
return pass;<br>
}<br>
<br>
-<br>
+<br></blockquote><div><br>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.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
enum piglit_result<br>
piglit_display(void)<br>
{<br>
GLboolean pass;<br>
<br>
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);<br>
+<br>
if (piglit_automatic) {<br>
pass = test_all_formats();<br>
}<br>
@@ -520,21 +522,6 @@ piglit_display(void)<br>
return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
}<br>
<br>
-<br>
-static void<br>
-reshape(int width, int height)<br>
-{<br>
- piglit_width = width;<br>
- piglit_height = height;<br>
- glViewport(0, 0, width, height);<br>
- glMatrixMode(GL_PROJECTION);<br>
- glLoadIdentity();<br>
- glOrtho(0, piglit_width, 0, piglit_height, -1.0, 1.0);<br>
- glMatrixMode(GL_MODELVIEW);<br>
- glLoadIdentity();<br>
-}<br>
-<br>
-<br>
void<br>
piglit_init(int argc, char **argv)<br>
{<br>
@@ -548,11 +535,6 @@ piglit_init(int argc, char **argv)<br>
fbo_formats_init(argc, argv, 0);<br>
(void) fbo_formats_display;<br>
<br>
- glutReshapeFunc(reshape);<br>
- /*glutKeyboardFunc(key);*/<br>
-<br>
- reshape(piglit_width, piglit_height);<br>
-<br>
glGenTextures(1, &t);<br>
glBindTexture(GL_TEXTURE_2D, t);<br>
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br>
</blockquote><div><br>(snip)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">diff --git a/tests/texturing/texrect-many.c b/tests/texturing/texrect-many.c<br>
index 11e75d0..aaff6fb 100644<br>
--- a/tests/texturing/texrect-many.c<br>
+++ b/tests/texturing/texrect-many.c<br>
@@ -98,19 +98,6 @@ piglit_display(void)<br>
return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
}<br>
<br>
-static void Reshape(int width, int height)<br>
-{<br>
- piglit_width = width;<br>
- piglit_height = height;<br>
- glViewport(0, 0, width, height);<br>
- glMatrixMode(GL_PROJECTION);<br>
- glLoadIdentity();<br>
- glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);<br>
- glScalef(1.0, 1.0, -1.0); // flip z-axis<br></blockquote><div><br>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.<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- glMatrixMode(GL_MODELVIEW);<br>
- glLoadIdentity();<br>
-}<br>
-<br>
void piglit_init(int argc, char **argv)<br>
{<br>
int i;<br>
@@ -121,8 +108,6 @@ void piglit_init(int argc, char **argv)<br>
piglit_report_result(PIGLIT_SKIP);<br>
}<br>
<br>
- glutReshapeFunc(Reshape);<br>
-<br>
piglit_require_extension("GL_ARB_texture_rectangle");<br>
<br>
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxtextures);<br>
@@ -160,5 +145,5 @@ void piglit_init(int argc, char **argv)<br>
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br>
}<br>
<br>
- Reshape(piglit_width, piglit_height);<br>
+ piglit_ortho_projection(1.0, 1.0, GL_FALSE);<br>
}<br>
diff --git a/tests/texturing/texredefine.c b/tests/texturing/texredefine.c<br>
index 9c69b27..5f470b3 100644<br>
--- a/tests/texturing/texredefine.c<br>
+++ b/tests/texturing/texredefine.c<br>
@@ -184,6 +184,8 @@ piglit_display(void)<br>
<br>
testnr = 0;<br>
<br>
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);<br>
+<br>
glClearColor(0.5, 0.5, 0.5, 1.0);<br>
glClear(GL_COLOR_BUFFER_BIT);<br>
<br>
@@ -201,17 +203,6 @@ piglit_display(void)<br>
return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
}<br>
<br>
-<br>
-static void Reshape(int width, int height)<br>
-{<br>
- glViewport(0, 0, width, height);<br>
- piglit_ortho_projection(width, height, GL_FALSE);<br>
-}<br>
-<br>
-<br>
void piglit_init(int argc, char **argv)<br>
{<br>
- glutReshapeFunc(Reshape);<br>
-<br>
- Reshape(piglit_width, piglit_height);<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.12<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>