Commit dbdb44d5 authored by Bas Nieuwenhuizen's avatar Bas Nieuwenhuizen
Browse files

amd/common: Fix stores to derefs with unknown variable.

Fixes: a2b5cc3c

 "radv: enable variable pointers"
Reviewed-by: Samuel Pitoiset's avatarSamuel Pitoiset <samuel.pitoiset@gmail.com>
parent 3c24fc64
......@@ -2006,18 +2006,23 @@ static void
visit_store_var(struct ac_nir_context *ctx,
nir_intrinsic_instr *instr)
{
nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
nir_variable *var = nir_deref_instr_get_variable(deref);
LLVMValueRef temp_ptr, value;
int idx = var->data.driver_location;
unsigned comp = var->data.location_frac;
int idx = 0;
unsigned comp = 0;
LLVMValueRef src = ac_to_float(&ctx->ac, get_src(ctx, instr->src[1]));
int writemask = instr->const_index[0];
LLVMValueRef indir_index;
unsigned const_index;
get_deref_offset(ctx, nir_instr_as_deref(instr->src[0].ssa->parent_instr), false,
NULL, NULL, &const_index, &indir_index);
if (var) {
get_deref_offset(ctx, deref, false,
NULL, NULL, &const_index, &indir_index);
idx = var->data.driver_location;
comp = var->data.location_frac;
}
if (ac_get_elem_bits(&ctx->ac, LLVMTypeOf(src)) == 64) {
......@@ -2030,7 +2035,7 @@ visit_store_var(struct ac_nir_context *ctx,
writemask = writemask << comp;
switch (var->data.mode) {
switch (deref->mode) {
case nir_var_shader_out:
if (ctx->stage == MESA_SHADER_TESS_CTRL) {
......@@ -2039,8 +2044,8 @@ visit_store_var(struct ac_nir_context *ctx,
unsigned const_index = 0;
const bool is_patch = var->data.patch;
get_deref_offset(ctx, nir_instr_as_deref(instr->src[0].ssa->parent_instr),
false, NULL, is_patch ? NULL : &vertex_index,
get_deref_offset(ctx, deref, false, NULL,
is_patch ? NULL : &vertex_index,
&const_index, &indir_index);
ctx->abi->store_tcs_outputs(ctx->abi, var,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment