vkd3d: Store a count of used UAV counters instead of a mask.

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:
Zebediah Figura 2020-06-17 17:04:14 +04:30 committed by Alexandre Julliard
parent 671ca1e721
commit f0ce8aaf92
3 changed files with 8 additions and 8 deletions

View File

@ -1862,7 +1862,7 @@ static void d3d12_command_list_invalidate_current_render_pass(struct d3d12_comma
static void d3d12_command_list_invalidate_bindings(struct d3d12_command_list *list, static void d3d12_command_list_invalidate_bindings(struct d3d12_command_list *list,
struct d3d12_pipeline_state *state) struct d3d12_pipeline_state *state)
{ {
if (state && state->uav_counter_mask) if (state && state->uav_counter_count)
{ {
enum vkd3d_pipeline_bind_point bind_point = (enum vkd3d_pipeline_bind_point)state->vk_bind_point; enum vkd3d_pipeline_bind_point bind_point = (enum vkd3d_pipeline_bind_point)state->vk_bind_point;
list->pipeline_bindings[bind_point].uav_counters_dirty = true; list->pipeline_bindings[bind_point].uav_counters_dirty = true;
@ -2680,7 +2680,7 @@ static void d3d12_command_list_update_descriptor_table(struct d3d12_command_list
/* Track UAV counters. */ /* Track UAV counters. */
if (range->descriptor_magic == VKD3D_DESCRIPTOR_MAGIC_UAV) if (range->descriptor_magic == VKD3D_DESCRIPTOR_MAGIC_UAV)
{ {
for (k = 0; k < vkd3d_popcount(state->uav_counter_mask); ++k) for (k = 0; k < state->uav_counter_count; ++k)
{ {
if (state->uav_counters[k].register_index == register_idx) if (state->uav_counters[k].register_index == register_idx)
{ {
@ -2835,7 +2835,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma
if (!state || !bindings->uav_counters_dirty) if (!state || !bindings->uav_counters_dirty)
return; return;
uav_counter_count = vkd3d_popcount(state->uav_counter_mask); uav_counter_count = state->uav_counter_count;
assert(uav_counter_count <= ARRAY_SIZE(vk_descriptor_writes)); assert(uav_counter_count <= ARRAY_SIZE(vk_descriptor_writes));
vk_descriptor_set = d3d12_command_allocator_allocate_descriptor_set(list->allocator, state->vk_set_layout); vk_descriptor_set = d3d12_command_allocator_allocate_descriptor_set(list->allocator, state->vk_set_layout);

View File

@ -1418,7 +1418,7 @@ static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipel
vkd3d_free(binding_desc); vkd3d_free(binding_desc);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
state->uav_counter_mask = shader_info->uav_counter_mask; state->uav_counter_count = uav_counter_count;
memset(&context, 0, sizeof(context)); memset(&context, 0, sizeof(context));
if (root_signature->vk_push_set_layout) if (root_signature->vk_push_set_layout)
@ -1495,7 +1495,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
state->vk_pipeline_layout = VK_NULL_HANDLE; state->vk_pipeline_layout = VK_NULL_HANDLE;
state->vk_set_layout = VK_NULL_HANDLE; state->vk_set_layout = VK_NULL_HANDLE;
state->uav_counters = NULL; state->uav_counters = NULL;
state->uav_counter_mask = 0; state->uav_counter_count = 0;
if (!(root_signature = unsafe_impl_from_ID3D12RootSignature(desc->pRootSignature))) if (!(root_signature = unsafe_impl_from_ID3D12RootSignature(desc->pRootSignature)))
{ {
@ -1529,7 +1529,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
shader_interface.combined_samplers = NULL; shader_interface.combined_samplers = NULL;
shader_interface.combined_sampler_count = 0; shader_interface.combined_sampler_count = 0;
shader_interface.uav_counters = state->uav_counters; shader_interface.uav_counters = state->uav_counters;
shader_interface.uav_counter_count = vkd3d_popcount(state->uav_counter_mask); shader_interface.uav_counter_count = state->uav_counter_count;
vk_pipeline_layout = state->vk_pipeline_layout vk_pipeline_layout = state->vk_pipeline_layout
? state->vk_pipeline_layout : root_signature->vk_pipeline_layout; ? state->vk_pipeline_layout : root_signature->vk_pipeline_layout;
@ -2041,7 +2041,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
state->vk_pipeline_layout = VK_NULL_HANDLE; state->vk_pipeline_layout = VK_NULL_HANDLE;
state->vk_set_layout = VK_NULL_HANDLE; state->vk_set_layout = VK_NULL_HANDLE;
state->uav_counters = NULL; state->uav_counters = NULL;
state->uav_counter_mask = 0; state->uav_counter_count = 0;
graphics->stage_count = 0; graphics->stage_count = 0;
memset(&input_signature, 0, sizeof(input_signature)); memset(&input_signature, 0, sizeof(input_signature));

View File

@ -797,7 +797,7 @@ struct d3d12_pipeline_state
uint32_t set_index; uint32_t set_index;
struct vkd3d_shader_uav_counter_binding *uav_counters; struct vkd3d_shader_uav_counter_binding *uav_counters;
uint8_t uav_counter_mask; unsigned int uav_counter_count;
struct d3d12_device *device; struct d3d12_device *device;