Skip to content

Commit e717fa1

Browse files
committed
VDR: Accumulate draws from secondaries
Currently each primary in CmdExecuteCommands executes its corresponding command buffer from the secondary context. In practice this means that each secondary is essentially run in isolation from the other secondaries which causes incorrect renderings. This commit addresses this by progressively accumulating command buffer from each secondary so that previous secondaries are send for execution along with subsequent ones from the same execute commands.
1 parent 95c33c5 commit e717fa1

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

framework/decode/vulkan_replay_dump_resources.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,8 @@ void VulkanReplayDumpResourcesBase::OverrideCmdExecuteCommands(const ApiCallInfo
22082208

22092209
if (dc_primary_context->ShouldHandleExecuteCommands(call_info.index))
22102210
{
2211-
uint32_t finalized_primaries = 0;
2211+
uint32_t finalized_primaries = 0;
2212+
std::vector<VkCommandBuffer> accumulated_secondaries_command_buffers;
22122213
for (uint32_t i = 0; i < commandBufferCount; ++i)
22132214
{
22142215
const std::vector<std::shared_ptr<DrawCallsDumpingContext>> dc_secondary_contexts =
@@ -2217,19 +2218,29 @@ void VulkanReplayDumpResourcesBase::OverrideCmdExecuteCommands(const ApiCallInfo
22172218
{
22182219
for (auto dc_secondary_context : dc_secondary_contexts)
22192220
{
2220-
const std::vector<VkCommandBuffer>& secondarys_command_buffers =
2221+
const std::vector<VkCommandBuffer>& secondaries_command_buffers =
22212222
dc_secondary_context->GetCommandBuffers();
2222-
2223-
GFXRECON_ASSERT(secondarys_command_buffers.size() <=
2223+
GFXRECON_ASSERT(secondaries_command_buffers.size() <=
22242224
primary_last - (primary_first + finalized_primaries));
2225-
for (size_t scb = 0; scb < secondarys_command_buffers.size(); ++scb)
2225+
for (size_t scb = 0; scb < secondaries_command_buffers.size(); ++scb)
22262226
{
2227-
func(*(primary_first + finalized_primaries), 1, &secondarys_command_buffers[scb]);
2227+
// Each primary should execute the command buffer from the previous
2228+
// secondary contexts as well
2229+
func(*(primary_first + finalized_primaries),
2230+
accumulated_secondaries_command_buffers.size(),
2231+
accumulated_secondaries_command_buffers.data());
2232+
2233+
func(*(primary_first + finalized_primaries), 1, &secondaries_command_buffers[scb]);
22282234
dc_primary_context->FinalizeCommandBuffer();
22292235
dc_primary_context->MergeRenderPasses(*dc_secondary_context);
22302236
++finalized_primaries;
22312237
}
22322238

2239+
// Keep accumulating the command buffer from all secondary contexts
2240+
accumulated_secondaries_command_buffers.insert(accumulated_secondaries_command_buffers.end(),
2241+
secondaries_command_buffers.begin(),
2242+
secondaries_command_buffers.end());
2243+
22332244
// All primaries have been finalized. Nothing else to do
22342245
if (finalized_primaries == primary_last - primary_first)
22352246
{

0 commit comments

Comments
 (0)