Skip to content

Commit 61c775c

Browse files
panos-lunarglocke-lunarg
authored andcommitted
Each output json gen func keeps its own index
1 parent 26bf7a2 commit 61c775c

4 files changed

+26
-25
lines changed

framework/decode/vulkan_replay_dump_resources_compute_ray_tracing.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ VkResult DispatchTraceRaysDumpingContext::DumpDispatchTraceRays(
882882
GFXRECON_ASSERT(dispatch_param_entry != dispatch_params.end());
883883
draw_call_info.disp_param = &dispatch_param_entry->second;
884884

885-
delegate_.DumpDrawCallInfo(draw_call_info, i);
885+
delegate_.DumpDrawCallInfo(draw_call_info);
886886
}
887887

888888
for (size_t i = 0; i < trace_rays_indices.size(); ++i)
@@ -924,7 +924,7 @@ VkResult DispatchTraceRaysDumpingContext::DumpDispatchTraceRays(
924924
GFXRECON_ASSERT(trace_rays_param_entry != trace_rays_params.end());
925925
draw_call_info.tr_param = &trace_rays_param_entry->second;
926926

927-
delegate_.DumpDrawCallInfo(draw_call_info, i);
927+
delegate_.DumpDrawCallInfo(draw_call_info);
928928
}
929929

930930
// Clean up references to dumped descriptors in case this command buffer is submitted again

framework/decode/vulkan_replay_dump_resources_delegate.cpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727
GFXRECON_BEGIN_NAMESPACE(gfxrecon)
2828
GFXRECON_BEGIN_NAMESPACE(decode)
2929

30-
void DefaultVulkanDumpResourcesDelegate::DumpDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info, size_t index)
30+
void DefaultVulkanDumpResourcesDelegate::DumpDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info)
3131
{
3232
switch (draw_call_info.type)
3333
{
3434
case DumpResourceType::kDrawCallInfo:
35-
GenerateOutputJsonDrawCallInfo(draw_call_info, index);
35+
GenerateOutputJsonDrawCallInfo(draw_call_info);
3636
break;
3737
case DumpResourceType::kDispatchInfo:
38-
GenerateOutputJsonDispatchInfo(draw_call_info, index);
38+
GenerateOutputJsonDispatchInfo(draw_call_info);
3939
break;
4040
case DumpResourceType::kTraceRaysIndex:
41-
GenerateOutputJsonTraceRaysIndex(draw_call_info, index);
41+
GenerateOutputJsonTraceRaysIndex(draw_call_info);
4242
break;
4343
default:
4444
break;
@@ -434,8 +434,7 @@ DefaultVulkanDumpResourcesDelegate::GenerateIndexBufferFilename(const VulkanDump
434434
return (filedirname / filebasename).string();
435435
}
436436

437-
void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info,
438-
size_t index)
437+
void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info)
439438
{
440439
if (options_.dump_resources_json_per_command)
441440
{
@@ -1251,8 +1250,7 @@ std::string DefaultVulkanDumpResourcesDelegate::GenerateDispatchTraceRaysInlineU
12511250
return (filedirname / filebasename).string();
12521251
}
12531252

1254-
void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonDispatchInfo(const VulkanDumpDrawCallInfo& draw_call_info,
1255-
size_t index)
1253+
void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonDispatchInfo(const VulkanDumpDrawCallInfo& draw_call_info)
12561254
{
12571255
if (draw_call_info.disp_param == nullptr)
12581256
{
@@ -1275,8 +1273,10 @@ void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonDispatchInfo(const Vu
12751273
auto& current_block = dump_json_.GetCurrentSubEntry();
12761274
auto& dispatch_json_entries =
12771275
!options_.dump_resources_json_per_command ? current_block["dispatchCommands"] : dump_json_.GetData();
1276+
1277+
static uint64_t unique_json_entry = 0;
12781278
auto& dispatch_json_entry =
1279-
!options_.dump_resources_json_per_command ? dispatch_json_entries[index] : dump_json_.GetData();
1279+
!options_.dump_resources_json_per_command ? dispatch_json_entries[unique_json_entry++] : dump_json_.GetData();
12801280

12811281
dispatch_json_entry["dispatchIndex"] = draw_call_info.cmd_index;
12821282
dispatch_json_entry["beginCommandBufferIndex"] = draw_call_info.bcb_index;
@@ -1715,8 +1715,7 @@ void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonDispatchInfo(const Vu
17151715
}
17161716
}
17171717

1718-
void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonTraceRaysIndex(const VulkanDumpDrawCallInfo& draw_call_info,
1719-
size_t index)
1718+
void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonTraceRaysIndex(const VulkanDumpDrawCallInfo& draw_call_info)
17201719
{
17211720
if (draw_call_info.tr_param == nullptr)
17221721
{
@@ -1739,7 +1738,9 @@ void DefaultVulkanDumpResourcesDelegate::GenerateOutputJsonTraceRaysIndex(const
17391738
dump_json_.Open(full_filename);
17401739
dump_json_.BlockStart();
17411740
}
1742-
auto& tr_entry = !options_.dump_resources_json_per_command ? tr_json_entries[index] : dump_json_.GetData();
1741+
1742+
static uint64_t unique_json_entry = 0;
1743+
auto& tr_entry = !options_.dump_resources_json_per_command ? tr_json_entries[unique_json_entry++] : dump_json_.GetData();
17431744

17441745
tr_entry["traceRaysIndex"] = draw_call_info.cmd_index;
17451746
tr_entry["beginCommandBufferIndex"] = draw_call_info.bcb_index;

framework/decode/vulkan_replay_dump_resources_delegate.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ class VulkanDumpResourcesDelegate
107107
VulkanDumpResourcesDelegate(const VulkanReplayOptions& options, const std::string capture_filename) {}
108108
virtual ~VulkanDumpResourcesDelegate() {}
109109

110-
virtual bool Open() = 0;
111-
virtual void DumpDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info, size_t index) = 0;
112-
virtual void DumpStart() = 0;
113-
virtual VkResult DumpResource(const VulkanDumpResourceInfo& resource_info) = 0;
114-
virtual void DumpEnd() = 0;
115-
virtual void Close() = 0;
110+
virtual bool Open() = 0;
111+
virtual void DumpDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info) = 0;
112+
virtual void DumpStart() = 0;
113+
virtual VkResult DumpResource(const VulkanDumpResourceInfo& resource_info) = 0;
114+
virtual void DumpEnd() = 0;
115+
virtual void Close() = 0;
116116
};
117117

118118
class DefaultVulkanDumpResourcesDelegate : public VulkanDumpResourcesDelegate
@@ -129,7 +129,7 @@ class DefaultVulkanDumpResourcesDelegate : public VulkanDumpResourcesDelegate
129129
return dump_json_.Open(options_.capture_filename, options_.dump_resources_output_dir);
130130
}
131131

132-
virtual void DumpDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info, size_t index) override;
132+
virtual void DumpDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info) override;
133133

134134
virtual void DumpStart() override { dump_json_.BlockStart(); }
135135

@@ -171,7 +171,7 @@ class DefaultVulkanDumpResourcesDelegate : public VulkanDumpResourcesDelegate
171171

172172
std::string GenerateIndexBufferFilename(const VulkanDumpResourceInfo& resource_info) const;
173173

174-
void GenerateOutputJsonDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info, size_t index);
174+
void GenerateOutputJsonDrawCallInfo(const VulkanDumpDrawCallInfo& draw_call_info);
175175

176176
// DispatchTraceRaysDumpingContext
177177
VkResult DumpeDispatchTraceRaysImage(const VulkanDumpResourceInfo& resource_info);
@@ -201,9 +201,9 @@ class DefaultVulkanDumpResourcesDelegate : public VulkanDumpResourcesDelegate
201201
std::string
202202
GenerateDispatchTraceRaysInlineUniformBufferDescriptorFilename(const VulkanDumpResourceInfo& resource_info) const;
203203

204-
void GenerateOutputJsonDispatchInfo(const VulkanDumpDrawCallInfo& draw_call_info, size_t index);
204+
void GenerateOutputJsonDispatchInfo(const VulkanDumpDrawCallInfo& draw_call_info);
205205

206-
void GenerateOutputJsonTraceRaysIndex(const VulkanDumpDrawCallInfo& draw_call_info, size_t index);
206+
void GenerateOutputJsonTraceRaysIndex(const VulkanDumpDrawCallInfo& draw_call_info);
207207

208208
// Keep track of images for which scalling failed so we can
209209
// note them in the output json

framework/decode/vulkan_replay_dump_resources_draw_calls.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ VkResult DrawCallsDumpingContext::DumpDrawCalls(
879879
GFXRECON_ASSERT(dc_param_entry != draw_call_params.end());
880880
draw_call_info.dc_param = &dc_param_entry->second;
881881

882-
delegate_.DumpDrawCallInfo(draw_call_info, cb);
882+
delegate_.DumpDrawCallInfo(draw_call_info);
883883
}
884884

885885
res = RevertRenderTargetImageLayouts(queue, cb);

0 commit comments

Comments
 (0)