diff options
author | Brian Paul <brianp@vmware.com> | 2010-04-19 08:35:53 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-04-19 08:35:53 -0600 |
commit | e3a34cc7f6c9f959cdc2af4486e84587fab4d0d7 (patch) | |
tree | 437667e2b7da27f03c190bee6b67bff260af0733 /src/gallium/drivers | |
parent | db3b34219ef1dbf9ebf5e524d3e459f9ad9571b5 (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/drivers')
-rw-r--r-- | src/gallium/drivers/i915/i915_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_state.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_rasterizer.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_rasterizer.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_draw.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_state.c | 3 |
12 files changed, 25 insertions, 14 deletions
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index 3d45a22b7e..2f1ab7592d 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -210,7 +210,7 @@ i915_create_context(struct pipe_screen *screen, void *priv) /* * Create drawing context and plug our rendering stage into it. */ - i915->draw = draw_create(); + i915->draw = draw_create(&i915->base); assert(i915->draw); if (!debug_get_bool_option("I915_NO_VBUF", FALSE)) { draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915)); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 62169918e2..7a19cec39d 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -714,7 +714,8 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe, /* pass-through to draw module */ draw_set_rasterizer_state(i915->draw, - (i915->rasterizer ? i915->rasterizer->templ : NULL)); + (i915->rasterizer ? i915->rasterizer->templ : NULL), + raster); i915->dirty |= I915_NEW_RASTERIZER; } diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index e31ae6a3fc..6962a7921b 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -174,7 +174,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) /* * Create drawing context and plug our rendering stage into it. */ - llvmpipe->draw = draw_create(); + llvmpipe->draw = draw_create(&llvmpipe->pipe); if (!llvmpipe->draw) goto fail; diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index feb012816c..8592da0d9d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -38,19 +38,26 @@ void * llvmpipe_create_rasterizer_state(struct pipe_context *pipe, const struct pipe_rasterizer_state *rast) { + /* We do nothing special with rasterizer state. + * The CSO handle is just a pointer to a pipe_rasterizer_state object. + */ return mem_dup(rast, sizeof(*rast)); } -void llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, - void *rasterizer) + + +void +llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + const struct pipe_rasterizer_state *rasterizer = + (const struct pipe_rasterizer_state *) handle; if (llvmpipe->rasterizer == rasterizer) return; /* pass-through to draw module */ - draw_set_rasterizer_state(llvmpipe->draw, rasterizer); + draw_set_rasterizer_state(llvmpipe->draw, rasterizer, handle); llvmpipe->rasterizer = rasterizer; @@ -68,6 +75,7 @@ void llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, llvmpipe->dirty |= LP_NEW_RASTERIZER; } + void llvmpipe_delete_rasterizer_state(struct pipe_context *pipe, void *rasterizer) { diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 7be12fcdef..031cc12814 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -129,7 +129,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv) nv50_init_state_functions(nv50); nv50_init_query_functions(nv50); - nv50->draw = draw_create(); + nv50->draw = draw_create(&nv50->pipe); assert(nv50->draw); draw_set_rasterize_stage(nv50->draw, nv50_draw_render_stage(nv50)); diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 86b98a4ba5..0d5ebdf589 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -181,7 +181,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.draw_range_elements = r300_swtcl_draw_range_elements; /* Create a Draw. This is used for SW TCL. */ - r300->draw = draw_create(); + r300->draw = draw_create(&r300->context); /* Enable our renderer. */ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); /* Enable Draw's clipping. */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 1f6f99d3e5..9c5eba4206 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -810,7 +810,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) if (r300->draw) { draw_flush(r300->draw); - draw_set_rasterizer_state(r300->draw, &rs->rs); + draw_set_rasterizer_state(r300->draw, &rs->rs, state); } if (rs) { diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index ddc35bcd62..7c7abc9eb2 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -298,7 +298,7 @@ softpipe_create_context( struct pipe_screen *screen, /* * Create drawing context and plug our rendering stage into it. */ - softpipe->draw = draw_create(); + softpipe->draw = draw_create(&softpipe->pipe); if (!softpipe->draw) goto fail; diff --git a/src/gallium/drivers/softpipe/sp_state_rasterizer.c b/src/gallium/drivers/softpipe/sp_state_rasterizer.c index a5b00336d4..c9ede09f26 100644 --- a/src/gallium/drivers/softpipe/sp_state_rasterizer.c +++ b/src/gallium/drivers/softpipe/sp_state_rasterizer.c @@ -49,7 +49,7 @@ void softpipe_bind_rasterizer_state(struct pipe_context *pipe, return; /* pass-through to draw module */ - draw_set_rasterizer_state(softpipe->draw, rasterizer); + draw_set_rasterizer_state(softpipe->draw, rasterizer, rasterizer); softpipe->rasterizer = rasterizer; diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index 3571778867..5253c45cb2 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -222,7 +222,8 @@ static void svga_bind_rasterizer_state( struct pipe_context *pipe, svga->curr.rast = raster; - draw_set_rasterizer_state(svga->swtnl.draw, raster ? &raster->templ : NULL); + draw_set_rasterizer_state(svga->swtnl.draw, raster ? &raster->templ : NULL, + state); svga->dirty |= SVGA_NEW_RAST; } diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index da15be155c..0758f3ff72 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -134,7 +134,7 @@ boolean svga_init_swtnl( struct svga_context *svga ) /* * Create drawing context and plug our rendering stage into it. */ - svga->swtnl.draw = draw_create(); + svga->swtnl.draw = draw_create(&svga->pipe); if (svga->swtnl.draw == NULL) goto fail; diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index 35f36a828f..6dfdb5e89b 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -113,7 +113,8 @@ static int update_swtnl_draw( struct svga_context *svga, if (dirty & SVGA_NEW_RAST) draw_set_rasterizer_state(svga->swtnl.draw, - &svga->curr.rast->templ); + &svga->curr.rast->templ, + (void *) svga->curr.rast); if (dirty & SVGA_NEW_FRAME_BUFFER) draw_set_mrd(svga->swtnl.draw, |