}
if (block->flags & REG_FLAG_DIRTY_ALWAYS)
dirty |= R600_BLOCK_STATUS_DIRTY;
- if (block->pm4_bo_index[id]) {
+ if (block->pm4_bo_index[id] && state->regs[i].bo) {
/* find relocation */
reloc_id = block->pm4_bo_index[id];
- r600_bo_reference(ctx->radeon, &block->reloc[reloc_id].bo, state->regs[i].bo);
- state->regs[i].bo->fence = ctx->radeon->fence;
+ r600_bo_reference(ctx->radeon, &block->reloc[reloc_id].bo, reg->bo);
+ reg->bo->fence = ctx->radeon->fence;
/* always force dirty for relocs for now */
dirty |= R600_BLOCK_STATUS_DIRTY;
}