mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 04:00:10 +01:00
gallium: split draw_wide_prim stage into separate point/line stages.
This fixes a validation/code-path problem. Enabling the stage for the sake of wide points also inadvertantly caused wide lines to be converted to tris when we actually want them passed through, such as for the AA line stage. This is just cleaner now. Also, replace draw_convert_wide_lines() with draw_wide_line_threshold() as was done for points. Allows for 1-pixel lines to be converted too if needed.
This commit is contained in:
parent
70126588cf
commit
a1a1395488
6 changed files with 30 additions and 22 deletions
|
|
@ -29,7 +29,9 @@ C_SOURCES = \
|
|||
draw_vf.c \
|
||||
draw_vf_generic.c \
|
||||
draw_vf_sse.c \
|
||||
draw_wide_prims.c
|
||||
draw_wide_line.c \
|
||||
draw_wide_point.c
|
||||
|
||||
|
||||
include ../../Makefile.template
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ draw = env.ConvenienceLibrary(
|
|||
'draw_vf.c',
|
||||
'draw_vf_generic.c',
|
||||
'draw_vf_sse.c',
|
||||
'draw_wide_prims.c',
|
||||
'draw_wide_point.c',
|
||||
'draw_wide_line.c'
|
||||
])
|
||||
|
||||
auxiliaries.insert(0, draw)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ struct draw_context *draw_create( void )
|
|||
#endif
|
||||
|
||||
/* create pipeline stages */
|
||||
draw->pipeline.wide = draw_wide_stage( draw );
|
||||
draw->pipeline.wide_line = draw_wide_line_stage( draw );
|
||||
draw->pipeline.wide_point = draw_wide_point_stage( draw );
|
||||
draw->pipeline.stipple = draw_stipple_stage( draw );
|
||||
draw->pipeline.unfilled = draw_unfilled_stage( draw );
|
||||
draw->pipeline.twoside = draw_twoside_stage( draw );
|
||||
|
|
@ -80,8 +81,9 @@ struct draw_context *draw_create( void )
|
|||
|
||||
draw->shader_queue_flush = draw_vertex_shader_queue_flush;
|
||||
|
||||
/* these defaults are oriented toward the needs of softpipe */
|
||||
draw->wide_point_threshold = 1000000.0; /* infinity */
|
||||
draw->convert_wide_lines = TRUE;
|
||||
draw->wide_line_threshold = 1.0;
|
||||
|
||||
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
|
||||
|
||||
|
|
@ -94,7 +96,8 @@ struct draw_context *draw_create( void )
|
|||
|
||||
void draw_destroy( struct draw_context *draw )
|
||||
{
|
||||
draw->pipeline.wide->destroy( draw->pipeline.wide );
|
||||
draw->pipeline.wide_line->destroy( draw->pipeline.wide_line );
|
||||
draw->pipeline.wide_point->destroy( draw->pipeline.wide_point );
|
||||
draw->pipeline.stipple->destroy( draw->pipeline.stipple );
|
||||
draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
|
||||
draw->pipeline.twoside->destroy( draw->pipeline.twoside );
|
||||
|
|
@ -232,14 +235,14 @@ draw_wide_point_threshold(struct draw_context *draw, float threshold)
|
|||
|
||||
|
||||
/**
|
||||
* Tells the draw module whether to convert wide lines (width != 1)
|
||||
* into triangles.
|
||||
* Tells the draw module to draw lines with triangles if their width
|
||||
* is greater than this threshold.
|
||||
*/
|
||||
void
|
||||
draw_convert_wide_lines(struct draw_context *draw, boolean enable)
|
||||
draw_wide_line_threshold(struct draw_context *draw, float threshold)
|
||||
{
|
||||
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
|
||||
draw->convert_wide_lines = enable;
|
||||
draw->wide_line_threshold = threshold;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,7 @@ void draw_set_rasterize_stage( struct draw_context *draw,
|
|||
|
||||
void draw_wide_point_threshold(struct draw_context *draw, float threshold);
|
||||
|
||||
void draw_convert_wide_points(struct draw_context *draw, boolean enable);
|
||||
|
||||
void draw_convert_wide_lines(struct draw_context *draw, boolean enable);
|
||||
void draw_wide_line_threshold(struct draw_context *draw, float threshold);
|
||||
|
||||
boolean draw_use_sse(struct draw_context *draw);
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,8 @@ struct draw_context
|
|||
struct draw_stage *aapoint;
|
||||
struct draw_stage *aaline;
|
||||
struct draw_stage *pstipple;
|
||||
struct draw_stage *wide;
|
||||
struct draw_stage *wide_line;
|
||||
struct draw_stage *wide_point;
|
||||
struct draw_stage *rasterize;
|
||||
} pipeline;
|
||||
|
||||
|
|
@ -219,7 +220,7 @@ struct draw_context
|
|||
unsigned nr_planes;
|
||||
|
||||
float wide_point_threshold; /**< convert pnts to tris if larger than this */
|
||||
boolean convert_wide_lines; /**< convert wide lines to tris? */
|
||||
float wide_line_threshold; /**< convert lines to tris if wider than this */
|
||||
boolean use_sse;
|
||||
|
||||
/* If a prim stage introduces new vertex attributes, they'll be stored here
|
||||
|
|
@ -304,7 +305,8 @@ extern struct draw_stage *draw_clip_stage( struct draw_context *context );
|
|||
extern struct draw_stage *draw_flatshade_stage( struct draw_context *context );
|
||||
extern struct draw_stage *draw_cull_stage( struct draw_context *context );
|
||||
extern struct draw_stage *draw_stipple_stage( struct draw_context *context );
|
||||
extern struct draw_stage *draw_wide_stage( struct draw_context *context );
|
||||
extern struct draw_stage *draw_wide_line_stage( struct draw_context *context );
|
||||
extern struct draw_stage *draw_wide_point_stage( struct draw_context *context );
|
||||
extern struct draw_stage *draw_validate_stage( struct draw_context *context );
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
|
|||
stage->next = next;
|
||||
|
||||
/* drawing wide lines? */
|
||||
wide_lines = (draw->rasterizer->line_width != 1.0
|
||||
&& draw->convert_wide_lines
|
||||
wide_lines = (draw->rasterizer->line_width > draw->wide_line_threshold
|
||||
&& !draw->rasterizer->line_smooth);
|
||||
|
||||
/* drawing large points? */
|
||||
|
|
@ -82,11 +81,14 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
|
|||
next = draw->pipeline.aapoint;
|
||||
}
|
||||
|
||||
if (wide_lines ||
|
||||
wide_points ||
|
||||
draw->rasterizer->point_sprite) {
|
||||
draw->pipeline.wide->next = next;
|
||||
next = draw->pipeline.wide;
|
||||
if (wide_lines) {
|
||||
draw->pipeline.wide_line->next = next;
|
||||
next = draw->pipeline.wide_line;
|
||||
}
|
||||
|
||||
if (wide_points || draw->rasterizer->point_sprite) {
|
||||
draw->pipeline.wide_point->next = next;
|
||||
next = draw->pipeline.wide_point;
|
||||
}
|
||||
|
||||
if (draw->rasterizer->line_stipple_enable) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue