diff options
author | Paul Berry <[email protected]> | 2011-09-27 12:57:08 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2011-10-06 19:29:14 -0700 |
commit | 018ea68d8780ab5baeef0b8122b8410e5e55ae6d (patch) | |
tree | fac8a7a1bcc65420a1d29edf418124753348d124 /src/mesa/drivers/dri/i965/brw_vs.c | |
parent | f4f686e825ad2d64e50fb9e2491ef60507d59c38 (diff) |
i965 Gen6+: De-compact clip planes.
Previously, if the user enabled a non-consecutive set of clip planes
(e.g. 0, 1, and 3), the driver would compact them down to a
consecutive set starting at 0. This optimization was of dubious
value, and complicated the implementation of gl_ClipDistance.
This patch changes the driver so that with Gen6 and later chipsets, we
no longer compact the clip planes. However, we still discard any clip
planes beyond the highest number that is in use, so performance should
not be affected for applications that use clip planes consecutively
from 0.
With chipsets previous to Gen6, we still compact the clip planes,
since the pre-Gen6 clipper thread relies on this behavior.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vs.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 14e91d87b2d..f671223b8c2 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -276,7 +276,8 @@ do_vs_prog(struct brw_context *brw, static void brw_upload_vs_prog(struct brw_context *brw) { - struct gl_context *ctx = &brw->intel.ctx; + struct intel_context *intel = &brw->intel; + struct gl_context *ctx = &intel->ctx; struct brw_vs_prog_key key; struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program; @@ -290,10 +291,16 @@ static void brw_upload_vs_prog(struct brw_context *brw) key.program_string_id = vp->id; key.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0); key.uses_clip_distance = vp->program.UsesClipDistance; - if (!key.uses_clip_distance) { - key.userclip_planes_enabled = ctx->Transform.ClipPlanesEnabled; - key.nr_userclip_planes - = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled); + if (key.userclip_active && !key.uses_clip_distance) { + if (intel->gen < 6) { + key.nr_userclip_plane_consts + = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled); + key.userclip_planes_enabled_gen_4_5 + = ctx->Transform.ClipPlanesEnabled; + } else { + key.nr_userclip_plane_consts + = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1; + } } key.copy_edgeflag = (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL); |