Module: Mesa Branch: gallium-clip-state Commit: c28584ce0d8c62bd92c8f140729d344f88a0b3cd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c28584ce0d8c62bd92c8f140729d344f88a0b3cd
Author: Christoph Bumiller <[email protected]> Date: Fri Jan 6 12:48:09 2012 +0100 gallium: extend user_clip_plane_enable to apply to clip distances --- src/gallium/auxiliary/draw/draw_cliptest_tmp.h | 2 +- src/gallium/auxiliary/draw/draw_context.c | 2 +- src/gallium/auxiliary/draw/draw_llvm.c | 2 +- src/gallium/auxiliary/util/u_dump_state.c | 2 +- src/gallium/drivers/nv50/nv50_state_validate.c | 2 +- src/gallium/drivers/nvc0/nvc0_state_validate.c | 2 +- src/gallium/drivers/nvfx/nvfx_state_emit.c | 6 +++--- src/gallium/drivers/r300/r300_state.c | 2 +- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_state.c | 2 +- src/gallium/drivers/svga/svga_state_rss.c | 2 +- src/gallium/drivers/trace/tr_dump_state.c | 2 +- src/gallium/include/pipe/p_state.h | 8 ++++++-- src/mesa/state_tracker/st_atom_rasterizer.c | 2 +- 14 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h index 53cd7e8..9e6827c 100644 --- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h +++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h @@ -36,7 +36,7 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs, /* const */ float (*plane)[4] = pvs->draw->plane; const unsigned pos = draw_current_shader_position_output(pvs->draw); const unsigned ef = pvs->draw->vs.edgeflag_output; - const unsigned ucp_enable = pvs->draw->rasterizer->user_clip_plane_enable; + const unsigned ucp_enable = pvs->draw->rasterizer->clip_plane_enable; const unsigned flags = (FLAGS); unsigned need_pipeline = 0; unsigned j; diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index e205933..e6cb010 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -224,7 +224,7 @@ static void update_clip_flags( struct draw_context *draw ) draw->clip_z = (!draw->driver.bypass_clip_z && draw->rasterizer && draw->rasterizer->depth_clip); draw->clip_user = draw->rasterizer && - draw->rasterizer->user_clip_plane_enable != 0; + draw->rasterizer->clip_plane_enable != 0; } /** diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index cc28fbb..cf97e82 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1449,7 +1449,7 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store) key->bypass_viewport = llvm->draw->identity_viewport; key->clip_halfz = !llvm->draw->rasterizer->gl_rasterization_rules; key->need_edgeflags = (llvm->draw->vs.edgeflag_output ? TRUE : FALSE); - key->ucp_enable = llvm->draw->rasterizer->user_clip_plane_enable; + key->ucp_enable = llvm->draw->rasterizer->clip_plane_enable; key->pad = 0; /* All variants of this shader will have the same value for diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index ec5142f..8ee6244 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -330,7 +330,7 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta util_dump_member(stream, bool, state, gl_rasterization_rules); util_dump_member(stream, bool, state, rasterizer_discard); util_dump_member(stream, bool, state, depth_clip); - util_dump_member(stream, uint, state, user_clip_plane_enable); + util_dump_member(stream, uint, state, clip_plane_enable); util_dump_member(stream, float, state, line_width); util_dump_member(stream, float, state, point_size); diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 65ef4fc..edf648e 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -249,7 +249,7 @@ nv50_validate_clip(struct nv50_context *nv50) if (likely(!vp)) vp = nv50->vertprog; - clip_enable = nv50->rast->pipe.user_clip_plane_enable; + clip_enable = nv50->rast->pipe.clip_plane_enable; BEGIN_RING(chan, RING_3D(VP_CLIP_DISTANCE_ENABLE), 1); OUT_RING (chan, clip_enable); diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index ed27453..472ddee 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -315,7 +315,7 @@ nvc0_validate_clip(struct nvc0_context *nvc0) clip_enable = vp->vp.clip_enable; if (!clip_enable) { - clip_enable = nvc0->rast->pipe.user_clip_plane_enable; + clip_enable = nvc0->rast->pipe.clip_plane_enable; if (unlikely(clip_enable)) nvc0_check_program_ucps(nvc0, vp, clip_enable); } diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index 5f1cfe3..25da80e 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -126,7 +126,7 @@ nvfx_ucp_validate(struct nvfx_context* nvfx) unsigned i, enable = 0, nr = 0; for (i = 0; i < 6; i++) { - if (nvfx->rasterizer->pipe.user_clip_plane_enable & (1 << i)) { + if (nvfx->rasterizer->pipe.clip_plane_enable & (1 << i)) { enable |= enables[i]; nr = i+1; } @@ -153,7 +153,7 @@ nvfx_vertprog_ucp_validate(struct nvfx_context* nvfx) struct nouveau_grobj *eng3d = nvfx->screen->eng3d; unsigned i; struct nvfx_vertex_program* vp = nvfx->hw_vertprog; - unsigned enable = nvfx->rasterizer->pipe.user_clip_plane_enable; + unsigned enable = nvfx->rasterizer->pipe.clip_plane_enable; unsigned nr = util_bitcount(enable); if(nr != vp->clip_nr) @@ -295,7 +295,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx) if(nvfx->is_nv4x) { unsigned vp_output = nvfx->hw_vertprog->or | nvfx->hw_fragprog->or; - vp_output |= ((1 << (nvfx->rasterizer->pipe.user_clip_plane_enable & 63)) - 1) << 6; + vp_output |= ((1 << (nvfx->rasterizer->pipe.clip_plane_enable & 63)) - 1) << 6; if(vp_output != nvfx->hw_vp_output) { diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index b0810f3..e3eed9c 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1161,7 +1161,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe, } if (r300_screen(pipe->screen)->caps.has_tcl) { - vap_clip_cntl = (state->user_clip_plane_enable & 63) | + vap_clip_cntl = (state->clip_plane_enable & 63) | R300_PS_UCP_MODE_CLIP_AS_TRIFAN; } else { vap_clip_cntl = R300_CLIP_DISABLE; diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3c1ef0e..873f84c 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -985,7 +985,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp), 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, - S_028810_PS_UCP_MODE(3) | (state->user_clip_plane_enable & 63) | + S_028810_PS_UCP_MODE(3) | (state->clip_plane_enable & 63) | S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip), 0xFFFFFFFF, NULL, 0); return rstate; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 1848c5d..69416df 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1028,7 +1028,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp), 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, - S_028810_PS_UCP_MODE(3) | (state->user_clip_plane_enable & 63) | + S_028810_PS_UCP_MODE(3) | (state->clip_plane_enable & 63) | S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip), 0xFFFFFFFF, NULL, 0); diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c index f9ac174..d94ac35 100644 --- a/src/gallium/drivers/svga/svga_state_rss.c +++ b/src/gallium/drivers/svga/svga_state_rss.c @@ -246,7 +246,7 @@ static int emit_rss( struct svga_context *svga, if (dirty & SVGA_NEW_CLIP) { /* the number of clip planes is how many planes to enable */ - unsigned enabled = svga->curr.rast->templ.user_clip_plane_enable; + unsigned enabled = svga->curr.rast->templ.clip_plane_enable; EMIT_RS( svga, enabled, CLIPPLANEENABLE, fail ); } diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index 87eb724..67b1b0b 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -148,7 +148,7 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) trace_dump_member(bool, state, gl_rasterization_rules); trace_dump_member(bool, state, rasterizer_discard); trace_dump_member(bool, state, depth_clip); - trace_dump_member(uint, state, user_clip_plane_enable); + trace_dump_member(uint, state, clip_plane_enable); trace_dump_member(float, state, line_width); trace_dump_member(float, state, point_size); diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 3aedada..024d544 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -135,9 +135,13 @@ struct pipe_rasterizer_state unsigned depth_clip:1; /** - * Enable bits for user clip planes. + * Enable bits for clipping half-spaces. + * This applies to both user clip planes and shader clip distances. + * Note that if the bound shader exports any clip distances, these + * replace all user clip planes, and clip half-spaces enabled here + * but not written by the shader count as disabled. */ - unsigned user_clip_plane_enable:PIPE_MAX_CLIP_PLANES; + unsigned clip_plane_enable:PIPE_MAX_CLIP_PLANES; unsigned line_stipple_factor:8; /**< [1..256] actually */ unsigned line_stipple_pattern:16; diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 9afe5f8..f3d28e6 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -263,7 +263,7 @@ static void update_raster_state( struct st_context *st ) /* _NEW_TRANSFORM */ raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE; - raster->user_clip_plane_enable = ctx->Transform.ClipPlanesEnabled; + raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; cso_set_rasterizer(st->cso_context, raster); } _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
