[PATCH 9/9] intel gen4-5: Don't touch flatshaded values when clipping, only copy them.

Olivier Galibert
2012-07-19T20:00:24Z

This patch ensures that integers will pass through unscathed. Doing
(useless) computations on them is risky, especially when their bit
patterns correspond to values like inf or nan.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
---
src/mesa/drivers/dri/i965/brw_clip_util.c | 48 ++++++++++++++++++-----------
1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c b/src/mesa/drivers/dri/i965/brw_clip_util.c
index b06ad1d..998c304 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_util.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
@@ -293,30 +293,42 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
* header), so interpolate:
*
* New = attr0 + t*attr1 - t*attr0
+ *
+ * unless it's flat shaded, then just copy the value from a
+ * source vertex.
*/

- struct brw_reg tmp = get_tmp(c);
+ GLuint interp = brw->interpolation_mode[slot];

- struct brw_reg t =
- brw->interpolation_mode[slot] == INTERP_QUALIFIER_NOPERSPECTIVE ?
- t_nopersp : t0;
+ if(interp == INTERP_QUALIFIER_SMOOTH ||
+ interp == INTERP_QUALIFIER_NOPERSPECTIVE) {
+ struct brw_reg tmp = get_tmp(c);
+ struct brw_reg t =
+ interp == INTERP_QUALIFIER_NOPERSPECTIVE ?
+ t_nopersp : t0;

- brw_MUL(p,
- vec4(brw_null_reg()),
- deref_4f(v1_ptr, delta),
- t);
+ brw_MUL(p,
+ vec4(brw_null_reg()),
+ deref_4f(v1_ptr, delta),
+ t);

- brw_MAC(p,
- tmp,
- negate(deref_4f(v0_ptr, delta)),
- t);
+ brw_MAC(p,
+ tmp,
+ negate(deref_4f(v0_ptr, delta)),
+ t);

- brw_ADD(p,
- deref_4f(dest_ptr, delta),
- deref_4f(v0_ptr, delta),
- tmp);
-
- release_tmp(c, tmp);
+ brw_ADD(p,
+ deref_4f(dest_ptr, delta),
+ deref_4f(v0_ptr, delta),
+ tmp);
+
+ release_tmp(c, tmp);
+
+ } else if(interp == INTERP_QUALIFIER_FLAT) {
+ brw_MOV(p,
+ deref_4f(dest_ptr, delta),
+ deref_4f(v0_ptr, delta));
+ }
}
}

--
1.7.10.280.gaa39