[Mesa-dev] [PATCH 1/3] glsl/nir: int constants as float for native_integers=false
Jonathan Marek
jonathan at marek.ca
Mon Nov 19 20:00:48 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 0479f8fcfe..22863c072f 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -93,6 +93,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;
@@ -196,8 +198,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;
@@ -215,7 +217,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;
@@ -224,7 +229,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