[Mesa-dev] RFC: gallium front/back vs cw/ccw rasterizer state

Keith Whitwell keithw at vmware.com
Fri May 14 05:10:14 PDT 2010


I'm considering modifying the gallium rasterizer state to remove most of
the cw/ccw flags and replace them with front/back or other concepts
closer to what GL is using.

This is primarily motivated by the fact that noone other than GL uses a
lot of this state, and where they do, they tend to use the same
abstraction level as GL.  This includes many hardware interfaces.

Right now, the cw/ccw abstraction doesn't benefit many drivers (except
maybe softpipe), and introduces some unnecessary possibilities which GL
never exposes (eg front and back with the same fill mode but different
offset modes).

I've started a branch for this, but also here are the relevant interface
changes for review.

Thoughts?

Keith

------------------
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 0a4bd58..f258aba 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -119,11 +119,11 @@ enum pipe_error {
 #define PIPE_POLYGON_MODE_LINE  1
 #define PIPE_POLYGON_MODE_POINT 2
 
-/** Polygon front/back window, also for culling */
-#define PIPE_WINDING_NONE 0
-#define PIPE_WINDING_CW   1
-#define PIPE_WINDING_CCW  2
-#define PIPE_WINDING_BOTH (PIPE_WINDING_CW | PIPE_WINDING_CCW)
+/** Polygon face specification, eg for culling */
+#define PIPE_FACE_NONE           0
+#define PIPE_FACE_FRONT          1
+#define PIPE_FACE_BACK           2
+#define PIPE_FACE_FRONT_AND_BACK (PIPE_FACE_FRONT | PIPE_FACE_BACK)
 
 /** Stencil ops */
 #define PIPE_STENCIL_OP_KEEP       0
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 24cb266..fcbc24e 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -79,12 +79,13 @@ struct pipe_rasterizer_state
 {
    unsigned flatshade:1;
    unsigned light_twoside:1;
-   unsigned front_winding:2;  /**< PIPE_WINDING_x */
-   unsigned cull_mode:2;      /**< PIPE_WINDING_x */
-   unsigned fill_cw:2;        /**< PIPE_POLYGON_MODE_x */
-   unsigned fill_ccw:2;       /**< PIPE_POLYGON_MODE_x */
-   unsigned offset_cw:1;
-   unsigned offset_ccw:1;
+   unsigned front_ccw:1;
+   unsigned cull_face:2;      /**< PIPE_FACE_x */
+   unsigned fill_front:2;     /**< PIPE_POLYGON_MODE_x */
+   unsigned fill_back:2;      /**< PIPE_POLYGON_MODE_x */
+   unsigned offset_point:1;
+   unsigned offset_line:1;
+   unsigned offset_tri:1;
    unsigned scissor:1;
    unsigned poly_smooth:1;
    unsigned poly_stipple_enable:1;




More information about the mesa-dev mailing list