consolidate point/line state into pipe_setup_state
authorBrian <brian.paul@tungstengraphics.com>
Tue, 26 Jun 2007 23:35:24 +0000 (17:35 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 26 Jun 2007 23:35:24 +0000 (17:35 -0600)
src/mesa/pipe/p_context.h
src/mesa/pipe/p_state.h
src/mesa/pipe/softpipe/sp_context.c
src/mesa/pipe/softpipe/sp_context.h
src/mesa/pipe/softpipe/sp_prim_setup.c
src/mesa/pipe/softpipe/sp_state.h
src/mesa/sources
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom.h
src/mesa/state_tracker/st_atom_setup.c
src/mesa/state_tracker/st_context.h

index d9546a24d2fec47cdbc18b2026a9f405cbed9cbf..93dbbe6ab77586c15e9612d583283b8ce7c0c1d9 100644 (file)
@@ -75,9 +75,6 @@ struct pipe_context {
    void (*set_depth_state)( struct pipe_context *,
                               const struct pipe_depth_state * );
 
-   void (*set_point_state)( struct pipe_context *,
-                            const struct pipe_point_state * );
-
    void (*set_framebuffer_state)( struct pipe_context *,
                                   const struct pipe_framebuffer_state * );
 
index 3e3da7cce6f3818497e24f6f4b19eb8beb67618d..e0fa4d54c3c0581a25c0bdccfd85c260ad9de6a6 100644 (file)
@@ -70,9 +70,19 @@ struct pipe_setup_state
    GLuint offset_ccw:1;
 
    GLuint scissor:1;
-   GLuint poly_stipple:1;
+
    GLuint poly_smooth:1;
+   GLuint poly_stipple_enable:1;
+
+   GLuint line_smooth:1;
+   GLuint line_stipple_enable:1;
+
+   GLuint point_smooth:1;
 
+   GLubyte line_stipple_factor;  /**< [1..255] only */
+   GLushort line_stipple_pattern;
+   GLfloat line_width;
+   GLfloat point_size;           /**< used when no per-vertex size */
    GLfloat offset_units;
    GLfloat offset_scale;
 };
@@ -147,25 +157,6 @@ struct pipe_clear_color_state
    GLfloat color[4];
 };
 
-/** XXXX probably merge into pipe_setup_state */
-struct pipe_line_state
-{
-   GLuint smooth:1;
-   GLuint stipple:1;
-   GLushort stipple_pattern;
-   GLint stipple_factor;
-   GLfloat width;
-};
-
-/** XXXX probably merge into pipe_setup_state */
-struct pipe_point_state
-{
-   GLuint smooth:1;
-   GLfloat size;
-   GLfloat min_size, max_size;
-   GLfloat attenuation[3];
-};
-
 struct pipe_stencil_state {
    GLuint front_enabled:1;
    GLuint front_func:3;     /**< PIPE_FUNC_x */
index 0d00c7eb6cd97b35afa90bdd021dff8647de2c27..7a0aad0973db1763b8c13f694bfdb6a86d06b54f 100644 (file)
@@ -70,7 +70,6 @@ struct pipe_context *softpipe_create( void )
    softpipe->pipe.set_clip_state = softpipe_set_clip_state;
    softpipe->pipe.set_clear_color_state = softpipe_set_clear_color_state;
    softpipe->pipe.set_depth_state = softpipe_set_depth_test_state;
-   softpipe->pipe.set_point_state = softpipe_set_point_state;
    softpipe->pipe.set_viewport = softpipe_set_viewport;
    softpipe->pipe.set_setup_state = softpipe_set_setup_state;
    softpipe->pipe.set_scissor_rect = softpipe_set_scissor_rect;
index 7c816dbc1a77e01c605e873a725778d3a59917b4..c38102e2fd8ee2b32edffe0d2d93d1d8987668f7 100644 (file)
@@ -83,7 +83,6 @@ struct softpipe_context {
    struct pipe_clip_state   clip;
    struct pipe_clear_color_state   clear_color;
    struct pipe_depth_state depth_test;
-   struct pipe_point_state  point;
    struct pipe_scissor_rect scissor;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];
index a559b31a52c5d3f865b01eef01f81e0df2dc6afc..3f4602feb00dda2483f60a2e9b79a964e560aa0a 100644 (file)
@@ -782,8 +782,8 @@ setup_point(struct prim_stage *stage, struct prim_header *prim)
 {
    struct setup_stage *setup = setup_stage( stage );
    /*XXX this should be a vertex attrib! */
-   GLfloat halfSize = 0.5 * setup->stage.softpipe->point.size;
-   GLboolean round = setup->stage.softpipe->point.smooth;
+   GLfloat halfSize = 0.5 * setup->stage.softpipe->setup.point_size;
+   GLboolean round = setup->stage.softpipe->setup.point_smooth;
    const struct vertex_header *v0 = prim->v[0];
    const GLfloat x = v0->data[FRAG_ATTRIB_WPOS][0];
    const GLfloat y = v0->data[FRAG_ATTRIB_WPOS][1];
index 735d039748a1a2084eac6d105728c2b8da4c99c3..4086c16bcc91852fefdca01c639cbc84b181cc12 100644 (file)
@@ -73,9 +73,6 @@ void softpipe_set_scissor_rect( struct pipe_context *,
 void softpipe_set_fs_state( struct pipe_context *,
                           const struct pipe_fs_state * );
 
-void softpipe_set_point_state( struct pipe_context *,
-                               const struct pipe_point_state * );
-
 void softpipe_set_polygon_stipple( struct pipe_context *,
                                  const struct pipe_poly_stipple * );
 
index 3887e9f3c20c41f460d1d03250228997e15e520c..c0c4b3535583d88b0e8222209f56242491306e46 100644 (file)
@@ -175,9 +175,8 @@ SOFTPIPE_SOURCES = \
        pipe/softpipe/sp_state_clip.c \
        pipe/softpipe/sp_state_derived.c \
        pipe/softpipe/sp_state_fs.c \
-       pipe/softpipe/sp_state_point.c \
-       pipe/softpipe/sp_state_setup.c \
        pipe/softpipe/sp_state_sampler.c \
+       pipe/softpipe/sp_state_setup.c \
        pipe/softpipe/sp_state_surface.c
 
 STATETRACKER_SOURCES = \
@@ -189,11 +188,10 @@ STATETRACKER_SOURCES = \
        state_tracker/st_atom_depth.c \
        state_tracker/st_atom_fs.c \
        state_tracker/st_atom_framebuffer.c \
-       state_tracker/st_atom_point.c \
        state_tracker/st_atom_sampler.c \
        state_tracker/st_atom_scissor.c \
-       state_tracker/st_atom_stencil.c \
        state_tracker/st_atom_setup.c \
+       state_tracker/st_atom_stencil.c \
        state_tracker/st_atom_viewport.c \
        state_tracker/st_cb_program.c \
        state_tracker/st_draw.c \
index 5fcd9d7af59d5aef342f175986882b089892837e..88c6c776a3a01ea455882c9587592f9d0fbdecc7 100644 (file)
@@ -47,7 +47,6 @@ static const struct st_tracked_state *atoms[] =
    &st_update_depth,
    &st_update_clip,
    &st_update_fs,
-   &st_update_point,
    &st_update_setup,
    &st_update_viewport,
    &st_update_scissor,
index 8c1219fefd0c2dc5bd211adcc800f46c86fa9021..7ea3301ea57a6e35ea96e0a28b0bd4c36dcd089a 100644 (file)
@@ -49,7 +49,6 @@ const struct st_tracked_state st_update_clip;
 const struct st_tracked_state st_update_clear_color;
 const struct st_tracked_state st_update_depth;
 const struct st_tracked_state st_update_fs;
-const struct st_tracked_state st_update_point;
 const struct st_tracked_state st_update_setup;
 const struct st_tracked_state st_update_viewport;
 const struct st_tracked_state st_update_constants;
index fcda2b3a41166885ef6c0aeb829bba61021a7169..23adf0b7c86cff464c4fd0a3ee7ff9808bc48499 100644 (file)
@@ -101,12 +101,6 @@ static void update_setup_state( struct st_context *st )
        ctx->Light.Model.TwoSide)
       setup.light_twoside = 1;
 
-   if (ctx->Polygon.SmoothFlag)
-      setup.poly_smooth = 1;
-
-   if (ctx->Polygon.StippleFlag)
-      setup.poly_stipple = 1;
-
    /* _NEW_POLYGON
     */
    if (ctx->Polygon.CullFlag) {
@@ -158,6 +152,12 @@ static void update_setup_state( struct st_context *st )
    if (setup.fill_ccw != PIPE_POLYGON_MODE_FILL)
       setup.offset_ccw = get_offset_flag( setup.fill_ccw, &ctx->Polygon );
 
+   if (ctx->Polygon.SmoothFlag)
+      setup.poly_smooth = 1;
+
+   if (ctx->Polygon.StippleFlag)
+      setup.poly_stipple_enable = 1;
+
 
    /* _NEW_BUFFERS, _NEW_POLYGON
     */
@@ -173,6 +173,19 @@ static void update_setup_state( struct st_context *st )
                            st->polygon_offset_scale);
    }
       
+   /* _NEW_POINT
+    */
+   setup.point_size = ctx->Point.Size;
+   setup.point_smooth = ctx->Point.SmoothFlag;
+
+   /* _NEW_LINE
+    */
+   setup.line_width = ctx->Line.Width;
+   setup.line_smooth = ctx->Line.SmoothFlag;
+   setup.line_stipple_enable = ctx->Line.StippleFlag;
+   setup.line_stipple_pattern = ctx->Line.StipplePattern;
+   setup.line_stipple_factor = ctx->Line.StippleFactor;
+
 
    if (memcmp(&setup, &st->state.setup, sizeof(setup)) != 0) {
       st->state.setup = setup;
@@ -182,7 +195,8 @@ static void update_setup_state( struct st_context *st )
 
 const struct st_tracked_state st_update_setup = {
    .dirty = {
-      .mesa = (_NEW_LIGHT | _NEW_POLYGON | _NEW_BUFFERS),
+      .mesa = (_NEW_LIGHT | _NEW_POLYGON | _NEW_LINE |
+               _NEW_POINT | _NEW_BUFFERS),
       .st  = 0,
    },
    .update = update_setup_state
index 582d586a738ab4203795a094408a477ac7ff81ca..48ea7f12ee09ba4130b968a71e4be5661adce733 100644 (file)
@@ -74,7 +74,6 @@ struct st_context
       struct pipe_clear_color_state clear_color;
       struct pipe_clip_state   clip;
       struct pipe_depth_state  depth;
-      struct pipe_point_state  point;
       struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];
       struct pipe_scissor_rect scissor;
       struct pipe_poly_stipple poly_stipple;