Mesa (master): nvfx: implement fp SSG properly
Luca Barbieri
lb at kemper.freedesktop.org
Sat Sep 4 02:53:57 UTC 2010
Module: Mesa
Branch: master
Commit: 72648ca51fddb99a4b9724524c46a8c774aba820
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=72648ca51fddb99a4b9724524c46a8c774aba820
Author: Luca Barbieri <luca at luca-barbieri.com>
Date: Sat Sep 4 04:17:16 2010 +0200
nvfx: implement fp SSG properly
---
src/gallium/drivers/nvfx/nvfx_fragprog.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index 159db99..32d642d 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -757,12 +757,25 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
nvfx_fp_emit(fpc, arith(sat, SNE, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SSG:
- tmp = nvfx_src(temp(fpc));
- tmp2 = nvfx_src(temp(fpc));
- nvfx_fp_emit(fpc, arith(0, SGT, tmp.reg, mask, src[0], nvfx_src(nvfx_reg(NVFXSR_CONST, 0)), none));
- nvfx_fp_emit(fpc, arith(0, SLT, tmp.reg, mask, src[0], nvfx_src(nvfx_reg(NVFXSR_CONST, 0)), none));
- nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, tmp, neg(tmp2), none));
+ {
+ float minonesv[4] = {-1.0, -1.0, -1.0, -1.0};
+ struct nvfx_src minones = swz(nvfx_src(constant(fpc, -1, minonesv)), X, X, X, X);
+
+ insn = arith(sat, MOV, dst, mask, src[0], none, none);
+ insn.cc_update = 1;
+ nvfx_fp_emit(fpc, insn);
+
+ insn = arith(0, STR, dst, mask, none, none, none);
+ insn.cc_test = NVFX_COND_GT;
+ nvfx_fp_emit(fpc, insn);
+
+ if(!sat) {
+ insn = arith(0, MOV, dst, mask, minones, none, none);
+ insn.cc_test = NVFX_COND_LT;
+ nvfx_fp_emit(fpc, insn);
+ }
break;
+ }
case TGSI_OPCODE_STR:
nvfx_fp_emit(fpc, arith(sat, STR, dst, mask, src[0], src[1], none));
break;
More information about the mesa-commit
mailing list