gallivm: fix gather component handling.
authorDave Airlie <airlied@redhat.com>
Mon, 20 Jan 2020 02:03:23 +0000 (12:03 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 23 Jan 2020 03:48:16 +0000 (13:48 +1000)
Fixes the extended gather test for gpu shader5

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3528>

src/gallium/auxiliary/gallivm/lp_bld_nir.c

index 34e6420..a8a2f84 100644 (file)
@@ -1466,9 +1466,10 @@ static void visit_tex(struct lp_build_nir_context *bld_base, nir_tex_instr *inst
    }
    if (instr->op == nir_texop_txf || instr->op == nir_texop_txf_ms)
       sample_key |= LP_SAMPLER_OP_FETCH << LP_SAMPLER_OP_TYPE_SHIFT;
-   else if (instr->op == nir_texop_tg4)
+   else if (instr->op == nir_texop_tg4) {
       sample_key |= LP_SAMPLER_OP_GATHER << LP_SAMPLER_OP_TYPE_SHIFT;
-   else if (instr->op == nir_texop_lod)
+      sample_key |= (instr->component << LP_SAMPLER_GATHER_COMP_SHIFT);
+   } else if (instr->op == nir_texop_lod)
       sample_key |= LP_SAMPLER_OP_LODQ << LP_SAMPLER_OP_TYPE_SHIFT;
    for (unsigned i = 0; i < instr->num_srcs; i++) {
       switch (instr->src[i].src_type) {