summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2019-04-13 19:33:41 +0200
committerKarol Herbst <[email protected]>2019-04-14 22:25:56 +0200
commit606b74035e6c97cbee2efaeff235892770ab7cc0 (patch)
tree8885fddcd0eedc72c543faa43ee58d8ed052ee50
parentfe8c57e859d18a2d308c035611aee8300bb8c8ef (diff)
lima: use nir_src_as_float
Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Qiang Yu <[email protected]>
-rw-r--r--src/gallium/drivers/lima/ir/gp/nir.c5
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c6
2 files changed, 2 insertions, 9 deletions
diff --git a/src/gallium/drivers/lima/ir/gp/nir.c b/src/gallium/drivers/lima/ir/gp/nir.c
index 6e0b8995da4..4bb556e294f 100644
--- a/src/gallium/drivers/lima/ir/gp/nir.c
+++ b/src/gallium/drivers/lima/ir/gp/nir.c
@@ -177,10 +177,7 @@ static bool gpir_emit_intrinsic(gpir_block *block, nir_instr *ni)
return false;
int offset = nir_intrinsic_base(instr);
-
- nir_const_value *const_offset = nir_src_as_const_value(instr->src[0]);
- assert(const_offset);
- offset += (int)const_offset->f32[0];
+ offset += (int)nir_src_as_float(instr->src[0]);
load->index = offset / 4;
load->component = offset % 4;
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 4f15f7c1564..5d15668b2a3 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -209,7 +209,6 @@ static ppir_node *ppir_emit_intrinsic(ppir_block *block, nir_instr *ni)
unsigned mask = 0;
ppir_load_node *lnode;
ppir_store_node *snode;
- nir_const_value *const_offset;
switch (instr->intrinsic) {
case nir_intrinsic_load_input:
@@ -234,10 +233,7 @@ static ppir_node *ppir_emit_intrinsic(ppir_block *block, nir_instr *ni)
lnode->num_components = instr->num_components;
lnode->index = nir_intrinsic_base(instr);
-
- const_offset = nir_src_as_const_value(instr->src[0]);
- assert(const_offset);
- lnode->index += (uint32_t)const_offset->f32[0];
+ lnode->index += (uint32_t)nir_src_as_float(instr->src[0]);
return &lnode->node;