mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
glsl/nir: int constants as float for native_integers=false
All alu instructions emitted with native_integers=false expect float (or bool in some cases) constants, so this change is necessary. This will cause changes with some intrinsics which had integer sources, such as nir_intrinsic_load_uniform. Apparently it might cause issues with some opt passes, but perhaps those don't apply in OpenGL ES 2.0 cases? Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
1ede463b6e
commit
d3b47e073e
1 changed files with 12 additions and 4 deletions
|
|
@ -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;
|
||||
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue