ac/nir_to_llvm: fix component packing for double outputs
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 21 Mar 2018 01:23:08 +0000 (12:23 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 27 Mar 2018 22:59:37 +0000 (09:59 +1100)
We need to wait until after the writemask is widened before we
adjust it for component packing.

Together with the previous patch this fixes a number of
arb_enhanced_layouts component layout piglit tests.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c

index b7d29ef0b53456bfec8b9444518785ca5b0a23ad..0d85d047cd9e16ef433ba666504eb8a02ef0b25c 100644 (file)
@@ -1793,7 +1793,7 @@ visit_store_var(struct ac_nir_context *ctx,
        int idx = instr->variables[0]->var->data.driver_location;
        unsigned comp = instr->variables[0]->var->data.location_frac;
        LLVMValueRef src = ac_to_float(&ctx->ac, get_src(ctx, instr->src[0]));
-       int writemask = instr->const_index[0] << comp;
+       int writemask = instr->const_index[0];
        LLVMValueRef indir_index;
        unsigned const_index;
        get_deref_offset(ctx, instr->variables[0], false,
@@ -1808,6 +1808,8 @@ visit_store_var(struct ac_nir_context *ctx,
                writemask = widen_mask(writemask, 2);
        }
 
+       writemask = writemask << comp;
+
        switch (instr->variables[0]->var->data.mode) {
        case nir_var_shader_out: