summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-08-27 14:04:40 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-09-03 22:31:03 -0700
commit294282aaa6a517b455d3e31d12e2d85516ac04e6 (patch)
tree7c9c5beb1bbd4bc9fd450b7b8d7ee1e2b6a97798
parenta2151560b8d65be31129c00872ea8d70c564b110 (diff)
i965: Remove legacy clip plane handling from geometry shaders.
We only support geometry shaders in core profiles, where gl_ClipVertex doesn't exist. Presumably the even older behavior of clipping to gl_Position isn't supported either. In fact, GLSL 1.50 page 76 claims: "The shader must also set all values in gl_ClipDistance that have been enabled via the OpenGL API, or results are undefined." So we don't need to handle legacy clipping in geometry shaders. I think Paul added this back when we were considering supporting the old GL_ARB_geometry_shader4 extension. This removes a non-orthagonal state dependency on GS compilation. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c25
3 files changed, 8 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 02e7bb4f8e..41ba7696d4 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -2058,11 +2058,6 @@ void gen8_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
uint32_t get_hw_prim_for_gl_prim(int mode);
void
-brw_setup_vue_key_clip_info(struct brw_context *brw,
- struct brw_vue_prog_key *key,
- bool program_uses_clip_distance);
-
-void
gen6_upload_push_constants(struct brw_context *brw,
const struct gl_program *prog,
const struct brw_stage_prog_data *prog_data,
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 5c0d923016..f1da63543c 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -121,15 +121,6 @@ brw_codegen_gs_prog(struct brw_context *brw,
GLbitfield64 outputs_written = gp->program.Base.OutputsWritten;
- /* In order for legacy clipping to work, we need to populate the clip
- * distance varying slots whenever clipping is enabled, even if the vertex
- * shader doesn't write to gl_ClipDistance.
- */
- if (c.key.base.userclip_active) {
- outputs_written |= BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0);
- outputs_written |= BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1);
- }
-
brw_compute_vue_map(brw->intelScreen->devinfo,
&c.prog_data.base.vue_map, outputs_written);
@@ -310,8 +301,6 @@ brw_gs_populate_key(struct brw_context *brw,
memset(key, 0, sizeof(*key));
key->base.program_string_id = gp->id;
- brw_setup_vue_key_clip_info(brw, &key->base,
- gp->program.Base.UsesClipDistanceOut);
/* _NEW_TEXTURE */
brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count,
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index c53cb49b61..211929a523 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -279,21 +279,6 @@ brw_vs_debug_recompile(struct brw_context *brw,
}
}
-
-void
-brw_setup_vue_key_clip_info(struct brw_context *brw,
- struct brw_vue_prog_key *key,
- bool program_uses_clip_distance)
-{
- struct gl_context *ctx = &brw->ctx;
-
- key->userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
- if (key->userclip_active && !program_uses_clip_distance) {
- key->nr_userclip_plane_consts
- = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
- }
-}
-
static bool
brw_vs_state_dirty(struct brw_context *brw)
{
@@ -325,8 +310,14 @@ brw_vs_populate_key(struct brw_context *brw,
* the inputs it asks for, whether they are varying or not.
*/
key->base.program_string_id = vp->id;
- brw_setup_vue_key_clip_info(brw, &key->base,
- vp->program.Base.UsesClipDistanceOut);
+
+ if (ctx->Transform.ClipPlanesEnabled != 0) {
+ key->base.userclip_active = true;
+ if (!vp->program.Base.UsesClipDistanceOut) {
+ key->base.nr_userclip_plane_consts =
+ _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
+ }
+ }
/* _NEW_POLYGON */
if (brw->gen < 6) {