summaryrefslogtreecommitdiff
path: root/src/mesa/x86/mmx_blend.S
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-04-12 21:56:42 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-04-12 21:56:42 +0000
commitcffb351a62ebc0e1954422cf749458106671b9d6 (patch)
treebcac5e12067886e5d2ab21da0f1dfd25b1dc6561 /src/mesa/x86/mmx_blend.S
parent8c598cfd8280357de7777019afa2a3d6ae0a7781 (diff)
Jose's latest patch (GMBT_GEOMETRIC_CORRECTION)
Diffstat (limited to 'src/mesa/x86/mmx_blend.S')
-rw-r--r--src/mesa/x86/mmx_blend.S18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/x86/mmx_blend.S b/src/mesa/x86/mmx_blend.S
index caf1f17ba4..8efae08f5e 100644
--- a/src/mesa/x86/mmx_blend.S
+++ b/src/mesa/x86/mmx_blend.S
@@ -39,7 +39,15 @@
*
* achieving the exact results
*/
-#define GMBT_ROUNDOFF 1
+#define GMBT_ROUNDOFF 0
+
+/* instead of the roundoff this adds a small correction to satisfy the OpenGL criteria
+ *
+ * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8
+ *
+ * note that although is faster than rounding off it doesn't give always the exact results
+ */
+#define GMBT_GEOMETRIC_CORRECTION 1
/*
* do
@@ -282,6 +290,14 @@ LLBL (GMBT_loop_begin):
PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */
PADDW ( MM5, MM6 ) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */
+
+#if GMBT_GEOMETRIC_CORRECTION
+ PSRLW ( CONST(7), MM3 ) /* t1 >> 15 */
+ PSRLW ( CONST(7), MM5 ) /* t2 >> 15 */
+
+ PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */
+ PADDW ( MM5, MM6 ) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */
+#endif
#endif
#if GMBT_SIGNED_ARITHMETIC