Skip to content

Commit

Permalink
vkd3d: Use device global implicit instance index.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans-Kristian Arntzen <[email protected]>
  • Loading branch information
HansKristian-Work committed May 15, 2023
1 parent 1823cec commit 3bbce3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
25 changes: 15 additions & 10 deletions libs/vkd3d/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -6342,17 +6342,20 @@ static void d3d12_command_list_emit_execute_indirect_debug_ring(struct d3d12_com
{
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
struct vkd3d_execute_indirect_debug_ring_args args;
static uint32_t vkd3d_implicit_instance_count;
VkCommandBuffer vk_patch_cmd_buffer;
VkMemoryBarrier2 vk_barrier;
VkDependencyInfo dep_info;

args.api_buffer_va = indirect_args;
args.indirect_count_va = count_arg;
args.api_buffer_word_stride = signature->desc.ByteStride / sizeof(uint32_t);
args.debug_tag = signature->desc.pArgumentDescs[signature->desc.NumArgumentDescs - 1].Type;
args.implicit_instance = vkd3d_atomic_uint32_increment(
&vkd3d_implicit_instance_count, vkd3d_memory_order_relaxed) - 1;

if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_BREADCRUMBS_TRACE_INDIRECT)
{
args.debug_tag = signature->desc.pArgumentDescs[signature->desc.NumArgumentDescs - 1].Type;
args.implicit_instance = vkd3d_atomic_uint32_increment(
&list->device->debug_ring.implicit_instance_count, vkd3d_memory_order_relaxed) - 1;
}

memset(&dep_info, 0, sizeof(dep_info));
dep_info.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO;
Expand Down Expand Up @@ -6419,7 +6422,6 @@ static bool d3d12_command_list_emit_multi_dispatch_indirect_count_state(struct d
struct vkd3d_multi_dispatch_indirect_info pipeline_info;
struct vkd3d_multi_dispatch_indirect_state_args args;
struct vkd3d_scratch_allocation template_scratch;
static uint32_t vkd3d_implicit_instance_count;
VkCommandBuffer vk_patch_cmd_buffer;
VkMemoryBarrier2 vk_barrier;
VkDependencyInfo dep_info;
Expand Down Expand Up @@ -6458,9 +6460,13 @@ static bool d3d12_command_list_emit_multi_dispatch_indirect_count_state(struct d
args.root_parameter_template_va = template_scratch.va;
args.stride_words = stride / sizeof(uint32_t);
args.dispatch_offset_words = signature->state_template.compute.dispatch_offset_words;
args.debug_tag = signature->desc.pArgumentDescs[signature->desc.NumArgumentDescs - 1].Type;
args.implicit_instance = vkd3d_atomic_uint32_increment(
&vkd3d_implicit_instance_count, vkd3d_memory_order_relaxed) - 1;

if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_BREADCRUMBS_TRACE_INDIRECT)
{
args.debug_tag = signature->desc.pArgumentDescs[signature->desc.NumArgumentDescs - 1].Type;
args.implicit_instance = vkd3d_atomic_uint32_increment(
&list->device->debug_ring.implicit_instance_count, vkd3d_memory_order_relaxed) - 1;
}

/* Allow correlation against breadcrumb log. */
VKD3D_BREADCRUMB_TAG("Implicit instance (compute template)");
Expand Down Expand Up @@ -11682,9 +11688,8 @@ static void d3d12_command_list_execute_indirect_state_template_graphics(
if (patch_args.debug_tag != 0)
{
/* Makes log easier to understand since a sorted log will appear in-order. */
static uint32_t vkd3d_implicit_instance_count;
patch_args.implicit_instance = vkd3d_atomic_uint32_increment(
&vkd3d_implicit_instance_count, vkd3d_memory_order_relaxed) - 1;
&list->device->debug_ring.implicit_instance_count, vkd3d_memory_order_relaxed) - 1;

/* Allow correlation against breadcrumb log. */
VKD3D_BREADCRUMB_TAG("Implicit instance (template)");
Expand Down
1 change: 1 addition & 0 deletions libs/vkd3d/vkd3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,7 @@ struct vkd3d_shader_debug_ring
VkDeviceAddress atomic_device_address;
size_t ring_size;
size_t control_block_size;
uint32_t implicit_instance_count;

pthread_t ring_thread;
pthread_mutex_t ring_lock;
Expand Down

0 comments on commit 3bbce3a

Please sign in to comment.