summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_clip_util.c
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2013-07-07 19:47:19 +1200
committerChris Forbes <chrisf@ijw.co.nz>2013-08-01 20:58:56 +1200
commitf0feb32eaf8d4b35e5c3a47ef90aa876b231ada6 (patch)
tree822a6125023093b62c12693eb5b817226d2debec /src/mesa/drivers/dri/i965/brw_clip_util.c
parent21922cb70d0a2de23f6080c8b9c4324cba5a2fff (diff)
downloadexternal_mesa3d-f0feb32eaf8d4b35e5c3a47ef90aa876b231ada6.zip
external_mesa3d-f0feb32eaf8d4b35e5c3a47ef90aa876b231ada6.tar.gz
external_mesa3d-f0feb32eaf8d4b35e5c3a47ef90aa876b231ada6.tar.bz2
i965 Gen4/5: clip: correctly handle flat varyings
Previously we only gave special treatment to the builtin color varyings. This patch adds support for arbitrary flat-shaded varyings, which is required for GLSL 1.30. Based on Olivier Galibert's patch from last year: http://lists.freedesktop.org/archives/mesa-dev/2012-July/024340.html V5: Move key.do_flat_shading to brw_clip_compile.has_flat_shading V6: Real bools. [V1-2]: Signed-off-by: Olivier Galibert <galibert at pobox.com> Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_clip_util.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_util.c46
1 files changed, 9 insertions, 37 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c b/src/mesa/drivers/dri/i965/brw_clip_util.c
index 37b7734..9d77d1e 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_util.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
@@ -290,49 +290,21 @@ struct brw_reg brw_clip_plane_stride( struct brw_clip_compile *c )
}
-/* If flatshading, distribute color from provoking vertex prior to
+/* Distribute flatshaded attributes from provoking vertex prior to
* clipping.
*/
-void brw_clip_copy_colors( struct brw_clip_compile *c,
+void brw_clip_copy_flatshaded_attributes( struct brw_clip_compile *c,
GLuint to, GLuint from )
{
struct brw_compile *p = &c->func;
- if (brw_clip_have_varying(c, VARYING_SLOT_COL0))
- brw_MOV(p,
- byte_offset(c->reg.vertex[to],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_COL0)),
- byte_offset(c->reg.vertex[from],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_COL0)));
-
- if (brw_clip_have_varying(c, VARYING_SLOT_COL1))
- brw_MOV(p,
- byte_offset(c->reg.vertex[to],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_COL1)),
- byte_offset(c->reg.vertex[from],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_COL1)));
-
- if (brw_clip_have_varying(c, VARYING_SLOT_BFC0))
- brw_MOV(p,
- byte_offset(c->reg.vertex[to],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_BFC0)),
- byte_offset(c->reg.vertex[from],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_BFC0)));
-
- if (brw_clip_have_varying(c, VARYING_SLOT_BFC1))
- brw_MOV(p,
- byte_offset(c->reg.vertex[to],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_BFC1)),
- byte_offset(c->reg.vertex[from],
- brw_varying_to_offset(&c->vue_map,
- VARYING_SLOT_BFC1)));
+ for (int i = 0; i < c->vue_map.num_slots; i++) {
+ if (c->key.interpolation_mode.mode[i] == INTERP_QUALIFIER_FLAT) {
+ brw_MOV(p,
+ byte_offset(c->reg.vertex[to], brw_vue_slot_to_offset(i)),
+ byte_offset(c->reg.vertex[from], brw_vue_slot_to_offset(i)));
+ }
+ }
}