----- Original Message -----
> > I don't oppose either. Integer signedness has always been too loose for us
> > to be pedantic about it here.
> >
>
> Ok. We should update tgsi docs to reflect that, however.
> Note that we already moved some opcodes (ok only one, uadd) to the
> signed section in infer_src_type() for exactly this reason but yes
> that's a hack too, might as well move it back then for consistency.
How about the attached patch.
To be honest, from just looking at the code, I think that adding instructions
that explicitly work on signed integers would be cleaner (i.e. add IMAD and
IADD).
z
From 6db142347bcbe6d197317bc6ba9637233074cf4b Mon Sep 17 00:00:00 2001
From: Zack Rusin <za...@vmware.com>
Date: Sun, 28 Apr 2013 10:50:55 -0400
Subject: [PATCH] gallivm: allow negation of all integer types
It's valid. Some shaders do the negation on unsigned and then
use the results in opcodes taking signed integers.
---
src/gallium/auxiliary/gallivm/lp_bld_tgsi.c | 2 +-
src/gallium/auxiliary/tgsi/tgsi_info.c | 3 +--
src/gallium/docs/source/tgsi.rst | 7 ++-----
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index 7255d97..66ff14c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -339,9 +339,9 @@ lp_build_emit_fetch(
assert(0);
break;
case TGSI_TYPE_SIGNED:
+ case TGSI_TYPE_UNSIGNED:
res = lp_build_negate( &bld_base->int_bld, res );
break;
- case TGSI_TYPE_UNSIGNED:
case TGSI_TYPE_VOID:
default:
assert(0);
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index d5db6b9..eec49a8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -280,6 +280,7 @@ tgsi_opcode_infer_src_type( uint opcode )
/* XXX some src args may be signed for SAD ? */
case TGSI_OPCODE_SAD:
case TGSI_OPCODE_U2F:
+ case TGSI_OPCODE_UADD:
case TGSI_OPCODE_UDIV:
case TGSI_OPCODE_UMOD:
case TGSI_OPCODE_UMAD:
@@ -314,8 +315,6 @@ tgsi_opcode_infer_src_type( uint opcode )
case TGSI_OPCODE_IABS:
case TGSI_OPCODE_ISSG:
case TGSI_OPCODE_UARL:
- /* UADD is both signed and unsigned require signed for working modifiers */
- case TGSI_OPCODE_UADD:
return TGSI_TYPE_SIGNED;
default:
return TGSI_TYPE_FLOAT;
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 0a5b227..a528fd2 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -32,11 +32,8 @@ For inputs which have a floating point type, both absolute value and negation
modifiers are supported (with absolute value being applied first).
TGSI_OPCODE_MOV is considered to have float input type for applying modifiers.
-For inputs which have signed type only the negate modifier is supported. This
-includes instructions which are otherwise ignorant if the type is signed or
-unsigned, such as TGSI_OPCODE_UADD.
-
-For inputs with unsigned type no modifiers are allowed.
+For inputs which have signed or unsigned type only the negate modifier is
+supported.
Instruction Set
---------------
--
1.7.10.4
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev