@@ -46,9 +46,10 @@ GFXRECON_BEGIN_NAMESPACE(decode)
46
46
47
47
VulkanReplayDumpResourcesBase::VulkanReplayDumpResourcesBase(const VulkanReplayOptions& options,
48
48
CommonObjectInfoTable* object_info_table) :
49
- QueueSubmit_indices_(options.QueueSubmit_Indices),
50
- recording_(false ), dump_resources_before_(options.dump_resources_before), object_info_table_(object_info_table),
51
- output_json_per_command(options.dump_resources_json_per_command), dump_json_(options)
49
+ QueueSubmit_indices_(options.QueueSubmit_Indices), recording_(false ),
50
+ dump_resources_before_(options.dump_resources_before), object_info_table_(object_info_table),
51
+ output_json_per_command(options.dump_resources_json_per_command), user_delegate_(nullptr ),
52
+ active_delegate_(nullptr ), default_delegate_(nullptr )
52
53
{
53
54
capture_filename = std::filesystem::path (options.capture_filename ).stem ().string ();
54
55
@@ -57,9 +58,20 @@ VulkanReplayDumpResourcesBase::VulkanReplayDumpResourcesBase(const VulkanReplayO
57
58
return ;
58
59
}
59
60
61
+ if (user_delegate_ != nullptr )
62
+ {
63
+ active_delegate_ = user_delegate_;
64
+ }
65
+ else
66
+ {
67
+ // Use a default delegate if none was provided.
68
+ default_delegate_ = std::make_unique<DefaultVulkanDumpResourcesDelegate>(options, capture_filename);
69
+ active_delegate_ = default_delegate_.get ();
70
+ }
71
+
60
72
if (!options.dump_resources_json_per_command )
61
73
{
62
- dump_json_. Open (options. capture_filename , options. dump_resources_output_dir );
74
+ active_delegate_-> Open ();
63
75
}
64
76
65
77
for (size_t i = 0 ; i < options.BeginCommandBuffer_Indices .size (); ++i)
@@ -75,8 +87,7 @@ VulkanReplayDumpResourcesBase::VulkanReplayDumpResourcesBase(const VulkanReplayO
75
87
options.RenderPass_Indices [i],
76
88
*object_info_table,
77
89
options,
78
- dump_json_,
79
- capture_filename));
90
+ *active_delegate_));
80
91
}
81
92
82
93
if ((i < options.Dispatch_Indices .size () && options.Dispatch_Indices [i].size ()) ||
@@ -92,8 +103,7 @@ VulkanReplayDumpResourcesBase::VulkanReplayDumpResourcesBase(const VulkanReplayO
92
103
: std::vector<uint64_t >(),
93
104
*object_info_table_,
94
105
options,
95
- dump_json_,
96
- capture_filename));
106
+ *active_delegate_));
97
107
}
98
108
}
99
109
}
@@ -105,7 +115,7 @@ VulkanReplayDumpResourcesBase::~VulkanReplayDumpResourcesBase()
105
115
106
116
void VulkanReplayDumpResourcesBase::Release ()
107
117
{
108
- dump_json_. Close ();
118
+ active_delegate_-> Close ();
109
119
draw_call_contexts.clear ();
110
120
dispatch_ray_contexts.clear ();
111
121
cmd_buf_begin_map_.clear ();
@@ -1847,7 +1857,7 @@ VkResult VulkanReplayDumpResourcesBase::QueueSubmit(const std::vector<VkSubmitIn
1847
1857
1848
1858
if (!output_json_per_command)
1849
1859
{
1850
- dump_json_. BlockStart ();
1860
+ active_delegate_-> DumpStart ();
1851
1861
}
1852
1862
1853
1863
for (size_t s = 0 ; s < submit_infos.size (); s++)
@@ -1906,7 +1916,7 @@ VkResult VulkanReplayDumpResourcesBase::QueueSubmit(const std::vector<VkSubmitIn
1906
1916
1907
1917
if (!output_json_per_command)
1908
1918
{
1909
- dump_json_. BlockEnd ();
1919
+ active_delegate_-> DumpEnd ();
1910
1920
}
1911
1921
1912
1922
// Looks like we didn't submit anything. Do the submission as it would have been done
0 commit comments