From 989b5722dc350b01c4148b1cd978b71ec4bcfe81 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 26 Dec 2011 14:20:47 -0800 Subject: [PATCH] i965: Fix transform feedback of gl_ClipVertex. Previously, on i965 Gen6 and above, we weren't allocating space for gl_ClipVertex in the VUE, since the VS was automatically converting it to clip distances. This prevented transform feedback from being able to capture gl_ClipVertex. This patch goes aheads and allocates space for gl_ClipVertex in the VUE on Gen6 and above. The old behavior is retained on Gen5 and below, since (a) transform feedback is not yet supported on those platforms, and (b) those platforms don't currently support gl_ClipVertex anyhow. Note: this constitutes a slight waste of VUE space for shaders that use gl_ClipVertex and don't use transform feedback to capture it. However, that seems preferable to making the VUE map (and all of the state that depends on it) dependent on transform feedback settings. Fixes Piglit test "EXT_transform_feedback/builtin-varyings gl_ClipVertex". Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_vs.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index be1ed001a44..7fc7dcca5a3 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -139,14 +139,17 @@ brw_compute_vue_map(struct brw_vue_map *vue_map, * assign them contiguously. Don't reassign outputs that already have a * slot. * - * Also, don't assign a slot for VERT_RESULT_CLIP_VERTEX, since it is - * unsupported in pre-GEN6, and in GEN6+ the vertex shader converts it into - * clip distances. + * Also, prior to Gen6, don't assign a slot for VERT_RESULT_CLIP_VERTEX, + * since it is unsupported. In Gen6 and above, VERT_RESULT_CLIP_VERTEX may + * be needed for transform feedback; since we don't want to have to + * recompute the VUE map (and everything that depends on it) when transform + * feedback is enabled or disabled, just go ahead and assign a slot for it. */ for (int i = 0; i < VERT_RESULT_MAX; ++i) { + if (intel->gen < 6 && i == VERT_RESULT_CLIP_VERTEX) + continue; if ((outputs_written & BITFIELD64_BIT(i)) && - vue_map->vert_result_to_slot[i] == -1 && - i != VERT_RESULT_CLIP_VERTEX) { + vue_map->vert_result_to_slot[i] == -1) { assign_vue_slot(vue_map, i); } } -- 2.30.2