diff options
author | Axel Davy <[email protected]> | 2014-12-03 15:31:44 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-01-22 22:16:20 +0000 |
commit | f5e8e3fb806ef8516a7bd5fabdce4cc24e4c9636 (patch) | |
tree | 80cc81cf43d3bbffed3d513abd170c164719a0a0 /src/gallium/state_trackers/nine/nine_shader.c | |
parent | 2487f7357449ee520a59f6d81506d297aca752f2 (diff) |
st/nine: Handle NRM with input of null norm
When the input's xyz are 0.0, the output
should be 0.0. This is due to the fact that
Inf * 0 = 0 for dx9. To handle this case,
cap the result of RSQ to FLT_MAX. We have
FLT_MAX * 0 = 0.
Reviewed-by: David Heidelberg <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Cc: "10.4" <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/nine_shader.c')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_shader.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 1f113789d1d..fa1151c124a 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -1963,10 +1963,12 @@ DECL_SPECIAL(NRM) struct ureg_program *ureg = tx->ureg; struct ureg_dst tmp = tx_scratch_scalar(tx); struct ureg_src nrm = tx_src_scalar(tmp); + struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]); struct ureg_src src = tx_src_param(tx, &tx->insn.src[0]); ureg_DP3(ureg, tmp, src, src); ureg_RSQ(ureg, tmp, nrm); - ureg_MUL(ureg, tx_dst_param(tx, &tx->insn.dst[0]), src, nrm); + ureg_MIN(ureg, tmp, ureg_imm1f(ureg, FLT_MAX), nrm); + ureg_MUL(ureg, dst, src, nrm); return D3D_OK; } |