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) {
writemask = writemask << comp;
- switch (var->data.mode) {
+ switch (deref->mode) {
case nir_var_shader_out:
if (ctx->stage == MESA_SHADER_TESS_CTRL) {
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,