diff options
author | Dave Airlie <[email protected]> | 2018-11-19 13:48:37 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-11-21 08:54:42 +1000 |
commit | baa4bdd3a6a7496f38c7b79235fe8ea24718729e (patch) | |
tree | da55090d05ec077104240614ba35540b8b0a12e3 | |
parent | ec9fe8abc730c890a76ffb6d01a3ec1099ddf264 (diff) |
radv: handle loading from shared pointers
We won't have a var to load from, so don't try to the processing
required if we don't need it.
This avoids crashes in:
dEQP-VK.spirv_assembly.instruction.compute.variable_pointers.compute.workgroup_two_buffers
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index fb350f1ff78..0416043eaf3 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1861,23 +1861,32 @@ static LLVMValueRef visit_load_var(struct ac_nir_context *ctx, nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr)); LLVMValueRef values[8]; - int idx = var->data.driver_location; + int idx = 0; int ve = instr->dest.ssa.num_components; - unsigned comp = var->data.location_frac; + unsigned comp = 0; LLVMValueRef indir_index; LLVMValueRef ret; unsigned const_index; - unsigned stride = var->data.compact ? 1 : 4; - bool vs_in = ctx->stage == MESA_SHADER_VERTEX && - var->data.mode == nir_var_shader_in; - - get_deref_offset(ctx, nir_instr_as_deref(instr->src[0].ssa->parent_instr), vs_in, NULL, NULL, - &const_index, &indir_index); + unsigned stride = 4; + int mode = nir_var_shared; + + if (var) { + bool vs_in = ctx->stage == MESA_SHADER_VERTEX && + var->data.mode == nir_var_shader_in; + if (var->data.compact) + stride = 1; + idx = var->data.driver_location; + comp = var->data.location_frac; + mode = var->data.mode; + + get_deref_offset(ctx, nir_instr_as_deref(instr->src[0].ssa->parent_instr), vs_in, NULL, NULL, + &const_index, &indir_index); + } if (instr->dest.ssa.bit_size == 64) ve *= 2; - switch (var->data.mode) { + switch (mode) { case nir_var_shader_in: if (ctx->stage == MESA_SHADER_TESS_CTRL || ctx->stage == MESA_SHADER_TESS_EVAL) { |