From: Brian Date: Tue, 26 Jun 2007 23:35:24 +0000 (-0600) Subject: consolidate point/line state into pipe_setup_state X-Git-Tag: 062012170305~17580^2~390^2~4759 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1be17dc446aa6b0770d76a3eccf79d0faf6608c0;p=profile%2Fivi%2Fmesa.git consolidate point/line state into pipe_setup_state --- diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index d9546a2..93dbbe6 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -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 * ); diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 3e3da7c..e0fa4d5 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -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 */ diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 0d00c7e..7a0aad0 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -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; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 7c816db..c38102e 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -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]; diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index a559b31..3f4602f 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -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]; diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index 735d039..4086c16 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -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 * ); diff --git a/src/mesa/sources b/src/mesa/sources index 3887e9f..c0c4b35 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -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 \ diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 5fcd9d7..88c6c77 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -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, diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 8c1219f..7ea3301 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -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; diff --git a/src/mesa/state_tracker/st_atom_setup.c b/src/mesa/state_tracker/st_atom_setup.c index fcda2b3..23adf0b 100644 --- a/src/mesa/state_tracker/st_atom_setup.c +++ b/src/mesa/state_tracker/st_atom_setup.c @@ -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 diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 582d586..48ea7f1 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -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;