From e3a34cc7f6c9f959cdc2af4486e84587fab4d0d7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 19 Apr 2010 08:35:53 -0600 Subject: gallium/draw: use correct rasterization state for wide/AA points/lines When points or lines are decomposed into triangles, we need to be sure to disable polygon culling, stippling, "un-filled" modes, etc. This patch sets the rasterization state to disable those things prior to drawing points/lines with triangles, then restores the previous state afterward. The new piglit point-no-line-cull test checks this problem & solution. --- src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 34 +++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/gallium/auxiliary/draw/draw_pipe_wide_line.c') diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c index 3073c87082..265a420d01 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c @@ -28,6 +28,7 @@ /* Authors: Keith Whitwell */ +#include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" #include "util/u_math.h" @@ -142,9 +143,40 @@ static void wideline_line( struct draw_stage *stage, } +static void wideline_first_line( struct draw_stage *stage, + struct prim_header *header ) +{ + struct draw_context *draw = stage->draw; + struct pipe_context *pipe = draw->pipe; + const struct pipe_rasterizer_state *rast = draw->rasterizer; + void *r; + + /* Disable triangle culling, stippling, unfilled mode etc. */ + r = draw_get_rasterizer_no_cull(draw, rast->scissor, rast->flatshade); + draw->suspend_flushing = TRUE; + pipe->bind_rasterizer_state(pipe, r); + draw->suspend_flushing = FALSE; + + stage->line = wideline_line; + + wideline_line(stage, header); +} + + static void wideline_flush( struct draw_stage *stage, unsigned flags ) { + struct draw_context *draw = stage->draw; + struct pipe_context *pipe = draw->pipe; + + stage->line = wideline_first_line; stage->next->flush( stage->next, flags ); + + /* restore original rasterizer state */ + if (draw->rast_handle) { + draw->suspend_flushing = TRUE; + pipe->bind_rasterizer_state(pipe, draw->rast_handle); + draw->suspend_flushing = FALSE; + } } @@ -171,7 +203,7 @@ struct draw_stage *draw_wide_line_stage( struct draw_context *draw ) wide->stage.name = "wide-line"; wide->stage.next = NULL; wide->stage.point = draw_pipe_passthrough_point; - wide->stage.line = wideline_line; + wide->stage.line = wideline_first_line; wide->stage.tri = draw_pipe_passthrough_tri; wide->stage.flush = wideline_flush; wide->stage.reset_stipple_counter = wideline_reset_stipple_counter; -- cgit v1.2.3