[Piglit] [PATCH 03/17] polygon-offset: Remove a lot of redundant state setup

Ian Romanick idr at freedesktop.org
Tue Sep 22 08:36:28 PDT 2015


From: Ian Romanick <ian.d.romanick at intel.com>

Move some of the rest to piglit_init.

Table 6.10 (page 275) in the OpenGL 2.1 spec says that GL_DEPTH_RANGE
(set by glDepthRange) is initially 0,1.

Table 6.10 (page 275) in the OpenGL 2.1 spec says that GL_NORMALIZE is
initially disabled.

Table 6.11 (page 276) in the OpenGL 2.1 spec says that GL_FOG is
initially disabled.

Table 6.12 (page 277) in the OpenGL 2.1 spec says that GL_COLOR_MATERIAL
is initially disabled.

Table 6.12 (page 277) in the OpenGL 2.1 spec says that GL_LIGHTING is
initially disabled.

Table 6.14 (page 279) in the OpenGL 2.1 spec says that
GL_POLYGON_STIPPLE is initially disabled.

Table 6.14 (page 279) in the OpenGL 2.1 spec says that GL_POLYGON_MODE
(set by glPolygonMode) is initially GL_FILL.

Table 6.14 (page 279) in the OpenGL 2.1 spec says that GL_FRONT_FACE
(set by glFrontFace) is initially GL_CCW.

Table 6.14 (page 279) in the OpenGL 2.1 spec says that GL_CULL_FACE_MODE
(set by glCullFace) is initially GL_BACK.

Table 6.16 (page 281) in the OpenGL 2.1 spec says that GL_TEXTURE_*D is
initially disabled.

Table 6.20 (page 285) in the OpenGL 2.1 spec says that GL_ALPHA_TEST is
initially disabled.

Table 6.20 (page 285) in the OpenGL 2.1 spec says that GL_SCISSOR_TEST
is initially disabled.

Table 6.20 (page 285) in the OpenGL 2.1 spec says that GL_STENCIL_TEST
is initially disabled.

Table 6.21 (page 286) in the OpenGL 2.1 spec says that GL_BLEND is
initially disabled.

Table 6.21 (page 286) in the OpenGL 2.1 spec says that GL_COLOR_LOGIC_OP
is initially disabled.

Table 6.22 (page 287) in the OpenGL 2.1 spec says that GL_COLOR_CLEAR_VALUE
(set by glClearColor) is initially 0,0,0,0.

Section 4.2.2 (Fine Control of Buffer Updates) of the OpenGL 2.1 spec
says (about glColorMask):

    "In the initial state, all bits (in color index mode) and all color
    values (in RGBA mode) are enabled for writing."

and (about glDepthMask):

    "In the initial state, the depth buffer is enabled for writing."

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/spec/gl-1.4/polygon-offset.c | 35 ++++-------------------------------
 1 file changed, 4 insertions(+), 31 deletions(-)

diff --git a/tests/spec/gl-1.4/polygon-offset.c b/tests/spec/gl-1.4/polygon-offset.c
index ec44d54..fecb02c 100644
--- a/tests/spec/gl-1.4/polygon-offset.c
+++ b/tests/spec/gl-1.4/polygon-offset.c
@@ -125,7 +125,10 @@ red_quad_was_drawn(void)
 void
 piglit_init(int argc, char **argv)
 {
-
+	glEnable(GL_DEPTH_TEST);
+	glDisable(GL_DITHER);
+	glEnable(GL_CULL_FACE);
+	glShadeModel(GL_FLAT);
 }
 
 static void
@@ -562,45 +565,15 @@ piglit_display(void)
 	};
 	
 	glViewport(0, 0, piglit_width, piglit_height);
-	glDepthRange(0.0, 1.0);
 
 	glMatrixMode(GL_PROJECTION);
 	glLoadMatrixf(near_1_far_infinity);
 
-	glDisable(GL_LIGHTING);
-
-	glFrontFace(GL_CCW);
-	glDisable(GL_NORMALIZE);
-	glDisable(GL_COLOR_MATERIAL);
-
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
 
-	glDisable(GL_TEXTURE_2D);
-
-	glDisable(GL_FOG);
-
-	glDisable(GL_SCISSOR_TEST);
-	glDisable(GL_ALPHA_TEST);
-	glDisable(GL_STENCIL_TEST);
 	glDepthFunc(GL_LESS);
-	glEnable(GL_DEPTH_TEST);
-	glDisable(GL_BLEND);
-	glDisable(GL_DITHER);
-	glDisable(GL_COLOR_LOGIC_OP);
-
-	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-	glDepthMask(GL_TRUE);
-
-	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-	glCullFace(GL_BACK);
-	glEnable(GL_CULL_FACE);
-	glDisable(GL_POLYGON_STIPPLE);
 	glDisable(GL_POLYGON_OFFSET_FILL);
-
-	glShadeModel(GL_FLAT);
-
-	glClearColor(0.0, 0.0, 0.0, 0.0);
 	glClearDepth(1.0);
 	
 	find_ideal_mrd(&ideal_mrd_near, &ideal_mrd_far, 
-- 
2.1.0



More information about the Piglit mailing list