From b98c0262d1183d24a37272558c51678cd6a0e9ec Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 11 Apr 2015 10:04:50 -0400 Subject: [PATCH] freedreno/ir3/nir: couple little fixes Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 34598db..f7ea879 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -303,6 +303,11 @@ declare_var(struct ir3_compile *ctx, nir_variable *var) (length * sizeof(arr->arr[0]))); arr->length = length; arr->aid = ++ctx->num_arrays; + /* Some shaders end up reading array elements without first writing.. + * so initialize things to prevent null instr ptrs later: + */ + for (unsigned i = 0; i < length; i++) + arr->arr[i] = create_immed(ctx->block, 0); _mesa_hash_table_insert(ctx->var_ht, var, arr); } @@ -733,6 +738,8 @@ emit_alu(struct ir3_compile *ctx, nir_alu_instr *alu) compile_assert(ctx, !asrc->negate); src[i] = get_src(ctx, &asrc->src)[asrc->swizzle[chan]]; + + compile_assert(ctx, src[i]); } switch (alu->op) { @@ -1613,8 +1620,9 @@ setup_input(struct ir3_compile *ctx, nir_variable *in) /* with NIR, we need to infer TGSI_INTERPOLATE_COLOR * from the semantic name: */ - if ((semantic_name == TGSI_SEMANTIC_COLOR) || - (semantic_name == TGSI_SEMANTIC_BCOLOR)) + if ((in->data.interpolation == INTERP_QUALIFIER_NONE) && + ((semantic_name == TGSI_SEMANTIC_COLOR) || + (semantic_name == TGSI_SEMANTIC_BCOLOR))) so->inputs[n].interpolate = TGSI_INTERPOLATE_COLOR; if (ctx->flat_bypass) { -- 2.7.4