[Mesa-dev] [PATCH 01/16] glsl/nir: int constants as float for native_integers=false
Jonathan Marek
jonathan at marek.ca
Wed Dec 19 16:39:50 UTC 2018
Note: the backend must take care that uniform index is now a float
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
---
src/compiler/glsl/glsl_to_nir.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index c5ba47d9e3..c8a7f3bd6c 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -94,6 +94,8 @@ private:
nir_deref_instr *evaluate_deref(ir_instruction *ir);
+ nir_constant *constant_copy(ir_constant *ir, void *mem_ctx);
+
/* most recent deref instruction created */
nir_deref_instr *deref;
@@ -194,8 +196,8 @@ nir_visitor::evaluate_deref(ir_instruction *ir)
return this->deref;
}
-static nir_constant *
-constant_copy(ir_constant *ir, void *mem_ctx)
+nir_constant *
+nir_visitor::constant_copy(ir_constant *ir, void *mem_ctx)
{
if (ir == NULL)
return NULL;
@@ -213,7 +215,10 @@ constant_copy(ir_constant *ir, void *mem_ctx)
assert(cols == 1);
for (unsigned r = 0; r < rows; r++)
- ret->values[0].u32[r] = ir->value.u[r];
+ if (supports_ints)
+ ret->values[0].u32[r] = ir->value.u[r];
+ else
+ ret->values[0].f32[r] = ir->value.u[r];
break;
@@ -222,7 +227,10 @@ constant_copy(ir_constant *ir, void *mem_ctx)
assert(cols == 1);
for (unsigned r = 0; r < rows; r++)
- ret->values[0].i32[r] = ir->value.i[r];
+ if (supports_ints)
+ ret->values[0].i32[r] = ir->value.i[r];
+ else
+ ret->values[0].f32[r] = ir->value.i[r];
break;
--
2.17.1
More information about the mesa-dev
mailing list