Mesa (staging/20.1): gallivm/nir: fix const loading on big endian systems

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 29 18:57:47 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 58cd2fa0be09d3fbf0517a727f2dfcc071e8e264
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=58cd2fa0be09d3fbf0517a727f2dfcc071e8e264

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Jun 29 07:40:13 2020 +1000

gallivm/nir: fix const loading on big endian systems

The code was expecting the lower 32-bits of the 64-bit to be
what it wanted, don't be implicit, pull the value from the union.

This should fix rendering on big endian systems since NIR was
introduced.

Fixes: 44a6b0107b37 ("gallivm: add nir->llvm translation (v2)")
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5677>
(cherry picked from commit 237d72841805a6964b8ebef17c044020e34b1141)

---

 .pick_status.json                          | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_nir.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 31c7c80d4a9..35cdb930247 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -139,7 +139,7 @@
         "description": "gallivm/nir: fix const loading on big endian systems",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "44a6b0107b37ad9644d3435cf6d2d29b6779654f"
     },
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 218d46036e9..f7951a086c8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -862,7 +862,7 @@ static void visit_load_const(struct lp_build_nir_context *bld_base,
    LLVMValueRef result[NIR_MAX_VEC_COMPONENTS];
    struct lp_build_context *int_bld = get_int_bld(bld_base, true, instr->def.bit_size);
    for (unsigned i = 0; i < instr->def.num_components; i++)
-      result[i] = lp_build_const_int_vec(bld_base->base.gallivm, int_bld->type, instr->value[i].u64);
+      result[i] = lp_build_const_int_vec(bld_base->base.gallivm, int_bld->type, instr->def.bit_size == 32 ? instr->value[i].u32 : instr->value[i].u64);
    assign_ssa_dest(bld_base, &instr->def, result);
 }
 



More information about the mesa-commit mailing list