Le 07/01/2015 19:09, Ilia Mirkin a écrit :
On Wed, Jan 7, 2015 at 11:36 AM, Axel Davy <axel.d...@ens.fr> wrote:
We should use the absolute value of the input as input to ureg_RSQ.

Moreover, an input of 0.0 should return FLT_MAX.

Reviewed-by: David Heidelberg <da...@ixit.cz>
Signed-off-by: Axel Davy <axel.d...@ens.fr>

Cc: "10.4" <mesa-sta...@lists.freedesktop.org>
---
  src/gallium/state_trackers/nine/nine_shader.c | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index da77da5..4dee5f5 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -1957,6 +1957,17 @@ DECL_SPECIAL(POW)
      return D3D_OK;
  }

+DECL_SPECIAL(RSQ)
+{
+    struct ureg_program *ureg = tx->ureg;
+    struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
+    struct ureg_src src = tx_src_param(tx, &tx->insn.src[0]);
+    struct ureg_dst tmp = tx_scratch(tx);
+    ureg_RSQ(ureg, tmp, ureg_abs(src));
+    ureg_MIN(ureg, dst, ureg_imm1f(ureg, FLT_MAX), ureg_src(tmp));
When would this MIN not return the value in tmp? In the description
you say that RSQ(0.0) should return FLT_MAX... is the theory that
MIN(NaN, FLT_MAX) == FLT_MAX? Is RSQ(0) in tgsi defined to return NaN?
Yes, the theory is that min (x, NaN) = x

The particular value of RSQ(0) in TGSI is undefined, but it is likely to be INF


   -ilia


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to