[PATCH vkd3d 2/5] vkd3d: Store a count of used UAV counters instead of a mask.

Zebediah Figura zfigura at codeweavers.com
Wed Jun 3 20:49:12 CDT 2020


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 libs/vkd3d/command.c       | 6 +++---
 libs/vkd3d/state.c         | 8 ++++----
 libs/vkd3d/vkd3d_private.h | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 7c6b758..0903a7f 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -1865,7 +1865,7 @@ static void d3d12_command_list_invalidate_bindings(struct d3d12_command_list *li
     if (!state)
         return;
 
-    if (state->uav_counter_mask)
+    if (state->uav_counter_count)
     {
         struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[state->vk_bind_point];
         bindings->uav_counter_dirty_mask = ~(uint8_t)0;
@@ -2681,7 +2681,7 @@ static void d3d12_command_list_update_descriptor_table(struct d3d12_command_list
             /* Track UAV counters. */
             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)
                     {
@@ -2836,7 +2836,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma
     if (!state || !bindings->uav_counter_dirty_mask)
         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));
 
     vk_descriptor_set = d3d12_command_allocator_allocate_descriptor_set(list->allocator, state->vk_set_layout);
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index a7b6251..44891a1 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -1418,7 +1418,7 @@ static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipel
         vkd3d_free(binding_desc);
         return E_OUTOFMEMORY;
     }
-    state->uav_counter_mask = shader_info->uav_counter_mask;
+    state->uav_counter_count = uav_counter_count;
 
     memset(&context, 0, sizeof(context));
     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_set_layout = VK_NULL_HANDLE;
     state->uav_counters = NULL;
-    state->uav_counter_mask = 0;
+    state->uav_counter_count = 0;
 
     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_sampler_count = 0;
     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
             ? 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_set_layout = VK_NULL_HANDLE;
     state->uav_counters = NULL;
-    state->uav_counter_mask = 0;
+    state->uav_counter_count = 0;
     graphics->stage_count = 0;
 
     memset(&input_signature, 0, sizeof(input_signature));
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index bb53e48..0afc38d 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -797,7 +797,7 @@ struct d3d12_pipeline_state
     uint32_t set_index;
 
     struct vkd3d_shader_uav_counter_binding *uav_counters;
-    uint8_t uav_counter_mask;
+    unsigned int uav_counter_count;
 
     struct d3d12_device *device;
 
-- 
2.26.2




More information about the wine-devel mailing list