summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-04-19 08:35:53 -0600
committerBrian Paul <brianp@vmware.com>2010-04-19 08:35:53 -0600
commite3a34cc7f6c9f959cdc2af4486e84587fab4d0d7 (patch)
tree437667e2b7da27f03c190bee6b67bff260af0733 /src/gallium/auxiliary/draw/draw_pipe_wide_line.c
parentdb3b34219ef1dbf9ebf5e524d3e459f9ad9571b5 (diff)
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.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_wide_line.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_line.c34
1 files changed, 33 insertions, 1 deletions
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 <keith@tungstengraphics.com>
*/
+#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;