d3d12: Fix indexing of local_reference_state

Instead of manually indexing a single-dimensional array as 2-dimensional
(and using the wrong stride for the outer array) just actually make it
a 2-dimensional array.

Fixes: 7edae456 ("d3d12: Track up to 16 contexts worth of batch references locally in bos")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24041>
This commit is contained in:
Jesse Natalie
2023-07-07 09:00:19 -07:00
parent 8166c1f8c1
commit a6740ee7a4
2 changed files with 4 additions and 4 deletions

View File

@@ -284,7 +284,7 @@ d3d12_batch_get_reference(struct d3d12_batch *batch,
{
if (batch->ctx_id != D3D12_CONTEXT_NO_ID) {
if ((bo->local_reference_mask[batch->ctx_id] & (1 << batch->ctx_index)) != 0) {
return &bo->local_reference_state[(batch->ctx_id * 16) + batch->ctx_index];
return &bo->local_reference_state[batch->ctx_id][batch->ctx_index];
}
else
return NULL;
@@ -307,9 +307,9 @@ d3d12_batch_acquire_reference(struct d3d12_batch *batch,
d3d12_bo_reference(bo);
util_dynarray_append(&batch->local_bos, d3d12_bo*, bo);
bo->local_reference_mask[batch->ctx_id] |= (1 << batch->ctx_index);
bo->local_reference_state[(batch->ctx_id * 16) + batch->ctx_index] = batch_bo_reference_none;
bo->local_reference_state[batch->ctx_id][batch->ctx_index] = batch_bo_reference_none;
}
return &bo->local_reference_state[(batch->ctx_id * 16) + batch->ctx_index];
return &bo->local_reference_state[batch->ctx_id][batch->ctx_index];
}
else {
hash_entry* entry = _mesa_hash_table_search(batch->bos, bo);

View File

@@ -71,7 +71,7 @@ struct d3d12_bo {
uint8_t local_reference_mask[16];
d3d12_context_state_table_entry local_context_states[16];
uint8_t local_reference_state[128];
uint8_t local_reference_state[8][16];
};
struct d3d12_buffer {