diff options
author | Luca Barbieri <[email protected]> | 2010-09-04 04:17:16 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-09-04 04:38:43 +0200 |
commit | 72648ca51fddb99a4b9724524c46a8c774aba820 (patch) | |
tree | 011e82a98461451bc26168f5d94f4588f0a41c42 /src | |
parent | 527a4f11a774a334c21027a51ce5530caf218677 (diff) |
nvfx: implement fp SSG properly
Diffstat (limited to 'src')
-rw-r--r-- | 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 159db99f552..32d642dd0cd 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; |