mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Index the "vk_uav_counter_views" array to match the "uav_counters" array.
That is, index elements of vk_uav_counter_views by their index in uav_counters, rather than by their register index. This is necessary because multiple UAVs can share the same register index but differ in register space. Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9b03ebde85
commit
671ca1e721
@ -1865,7 +1865,7 @@ static void d3d12_command_list_invalidate_bindings(struct d3d12_command_list *li
|
||||
if (state && state->uav_counter_mask)
|
||||
{
|
||||
enum vkd3d_pipeline_bind_point bind_point = (enum vkd3d_pipeline_bind_point)state->vk_bind_point;
|
||||
list->pipeline_bindings[bind_point].uav_counter_dirty_mask = ~(uint8_t)0;
|
||||
list->pipeline_bindings[bind_point].uav_counters_dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2652,9 +2652,10 @@ static void d3d12_command_list_update_descriptor_table(struct d3d12_command_list
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
|
||||
struct VkDescriptorImageInfo image_infos[24], *current_image_info;
|
||||
const struct d3d12_root_descriptor_table *descriptor_table;
|
||||
const struct d3d12_pipeline_state *state = list->state;
|
||||
const struct d3d12_root_descriptor_table_range *range;
|
||||
VkDevice vk_device = list->device->vk_device;
|
||||
unsigned int i, j, descriptor_count;
|
||||
unsigned int i, j, k, descriptor_count;
|
||||
struct d3d12_desc *descriptor;
|
||||
|
||||
descriptor_table = root_signature_get_descriptor_table(root_signature, index);
|
||||
@ -2677,14 +2678,20 @@ static void d3d12_command_list_update_descriptor_table(struct d3d12_command_list
|
||||
unsigned int register_idx = range->base_register_idx + j;
|
||||
|
||||
/* Track UAV counters. */
|
||||
if (range->descriptor_magic == VKD3D_DESCRIPTOR_MAGIC_UAV
|
||||
&& register_idx < ARRAY_SIZE(bindings->vk_uav_counter_views))
|
||||
if (range->descriptor_magic == VKD3D_DESCRIPTOR_MAGIC_UAV)
|
||||
{
|
||||
VkBufferView vk_counter_view = descriptor->magic == VKD3D_DESCRIPTOR_MAGIC_UAV
|
||||
? descriptor->u.view->vk_counter_view : VK_NULL_HANDLE;
|
||||
if (bindings->vk_uav_counter_views[register_idx] != vk_counter_view)
|
||||
bindings->uav_counter_dirty_mask |= 1u << register_idx;
|
||||
bindings->vk_uav_counter_views[register_idx] = vk_counter_view;
|
||||
for (k = 0; k < vkd3d_popcount(state->uav_counter_mask); ++k)
|
||||
{
|
||||
if (state->uav_counters[k].register_index == register_idx)
|
||||
{
|
||||
VkBufferView vk_counter_view = descriptor->magic == VKD3D_DESCRIPTOR_MAGIC_UAV
|
||||
? descriptor->u.view->vk_counter_view : VK_NULL_HANDLE;
|
||||
if (bindings->vk_uav_counter_views[k] != vk_counter_view)
|
||||
bindings->uav_counters_dirty = true;
|
||||
bindings->vk_uav_counter_views[k] = vk_counter_view;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!vk_write_descriptor_set_from_d3d12_desc(current_descriptor_write,
|
||||
@ -2825,7 +2832,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma
|
||||
unsigned int uav_counter_count;
|
||||
unsigned int i;
|
||||
|
||||
if (!state || !(state->uav_counter_mask & bindings->uav_counter_dirty_mask))
|
||||
if (!state || !bindings->uav_counters_dirty)
|
||||
return;
|
||||
|
||||
uav_counter_count = vkd3d_popcount(state->uav_counter_mask);
|
||||
@ -2840,7 +2847,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma
|
||||
const struct vkd3d_shader_uav_counter_binding *uav_counter = &state->uav_counters[i];
|
||||
const VkBufferView *vk_uav_counter_views = bindings->vk_uav_counter_views;
|
||||
|
||||
assert(vk_uav_counter_views[uav_counter->register_index]);
|
||||
assert(vk_uav_counter_views[i]);
|
||||
|
||||
vk_descriptor_writes[i].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
vk_descriptor_writes[i].pNext = NULL;
|
||||
@ -2851,7 +2858,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma
|
||||
vk_descriptor_writes[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
vk_descriptor_writes[i].pImageInfo = NULL;
|
||||
vk_descriptor_writes[i].pBufferInfo = NULL;
|
||||
vk_descriptor_writes[i].pTexelBufferView = &vk_uav_counter_views[uav_counter->register_index];
|
||||
vk_descriptor_writes[i].pTexelBufferView = &vk_uav_counter_views[i];
|
||||
}
|
||||
|
||||
VK_CALL(vkUpdateDescriptorSets(vk_device, uav_counter_count, vk_descriptor_writes, 0, NULL));
|
||||
@ -2859,7 +2866,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma
|
||||
VK_CALL(vkCmdBindDescriptorSets(list->vk_command_buffer, bindings->vk_bind_point,
|
||||
state->vk_pipeline_layout, state->set_index, 1, &vk_descriptor_set, 0, NULL));
|
||||
|
||||
bindings->uav_counter_dirty_mask = 0;
|
||||
bindings->uav_counters_dirty = false;
|
||||
}
|
||||
|
||||
static void d3d12_command_list_update_descriptors(struct d3d12_command_list *list,
|
||||
|
@ -921,7 +921,7 @@ struct vkd3d_pipeline_bindings
|
||||
uint64_t descriptor_table_active_mask;
|
||||
|
||||
VkBufferView vk_uav_counter_views[VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS];
|
||||
uint8_t uav_counter_dirty_mask;
|
||||
bool uav_counters_dirty;
|
||||
|
||||
/* Needed when VK_KHR_push_descriptor is not available. */
|
||||
struct vkd3d_push_descriptor push_descriptors[D3D12_MAX_ROOT_COST / 2];
|
||||
|
Loading…
x
Reference in New Issue
Block a user