lima: use nir_src_as_float
authorKarol Herbst <kherbst@redhat.com>
Sat, 13 Apr 2019 17:33:41 +0000 (19:33 +0200)
committerKarol Herbst <kherbst@redhat.com>
Sun, 14 Apr 2019 20:25:56 +0000 (22:25 +0200)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
src/gallium/drivers/lima/ir/gp/nir.c
src/gallium/drivers/lima/ir/pp/nir.c

index 6e0b8995da4db0cb58cd1c1daee99cc727aeb0f7..4bb556e294f7432828d013036c3e5f7b2a5d804f 100644 (file)
@@ -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;
index 4f15f7c156438c1625069705455bf844ee5df56d..5d15668b2a35f708c157a95cdd63673db7e64a73 100644 (file)
@@ -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;