Mesa (master): r300/compiler: fake equal/notequal for shadow samplers

Marek Olšák mareko at kemper.freedesktop.org
Sat May 8 21:25:51 UTC 2010


Module: Mesa
Branch: master
Commit: e812c0439cc6a6ee7b0cda33d30dc5cbc9159733
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e812c0439cc6a6ee7b0cda33d30dc5cbc9159733

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat May  8 05:26:31 2010 +0200

r300/compiler: fake equal/notequal for shadow samplers

This is actually better than a real implementation, which would be useless
due to inaccuracy (I know because I've tried to implement it).

---

 .../drivers/dri/r300/compiler/radeon_program_tex.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
index f7c54d0..53154f7 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
@@ -162,6 +162,13 @@ int radeonTransformTEX(
 			inst_mad->U.I.SrcReg[tex].Index = tmp_texsample;
 			inst_mad->U.I.SrcReg[tex].Swizzle = compiler->state.unit[inst->U.I.TexSrcUnit].depth_texture_swizzle;
 
+			/* Fake EQUAL/NOTEQUAL, it seems to pass some tests suprisingly. */
+			if (comparefunc == RC_COMPARE_FUNC_EQUAL) {
+				comparefunc = RC_COMPARE_FUNC_GEQUAL;
+			} else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) {
+				comparefunc = RC_COMPARE_FUNC_LESS;
+			}
+
 			/* Recall that SrcReg[0] is r, SrcReg[tex] is tex and:
 			 *   LESS:    r  < tex  <=>      -tex+r < 0
 			 *   GEQUAL:  r >= tex  <=> not (-tex+r < 0)




More information about the mesa-commit mailing list