[Mesa-dev] [RFC 14/16] nir: Consider float precision when deciding between uint/float
Topi Pohjolainen
topi.pohjolainen at intel.com
Fri May 15 02:39:41 PDT 2015
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/glsl/nir/glsl_to_nir.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 5da4122..4cb250a 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -883,6 +883,11 @@ nir_visitor::emit(nir_op op, unsigned dest_size, nir_src src1,
(type) == GLSL_TYPE_INT ? nir_op_i ## suffix : \
nir_op_u ## suffix
+#define OP_FLT_UINT(type, suffix) \
+ (type) == GLSL_TYPE_HALF ? nir_op_h ## suffix : \
+ (type) == GLSL_TYPE_FLOAT ? nir_op_f ## suffix : \
+ nir_op_u ## suffix
+
void
nir_visitor::visit(ir_expression *ir)
{
@@ -1239,10 +1244,7 @@ nir_visitor::visit(ir_expression *ir)
op = OP_FLT_INT_UINT(out_type, div);
break;
case ir_binop_mod:
- if (out_type == GLSL_TYPE_FLOAT)
- op = nir_op_fmod;
- else
- op = nir_op_umod;
+ op = OP_FLT_UINT(out_type, mod);
break;
case ir_binop_min:
op = OP_FLT_INT_UINT(out_type, min);
--
1.9.3
More information about the mesa-dev
mailing list