Fix bug with secondary cmd buffers

This commit is contained in:
Aliya Pazylbekova
2020-02-28 11:38:10 +00:00
committed by Baldur Karlsson
parent ef2804bfd3
commit 29a8637ae1
4 changed files with 16 additions and 12 deletions
+11 -8
View File
@@ -2492,10 +2492,8 @@ ReplayStatus WrappedVulkan::ContextReplayLog(CaptureState readType, uint32_t sta
if(!partial && !IsStructuredExporting(m_State))
AddFrameTerminator(AMDRGPControl::GetEndTag());
if(m_Partial[Secondary].partialParent != ResourceId())
m_RenderState = m_BakedCmdBufferInfo[m_Partial[Primary].partialParent].state;
else if(m_Partial[Primary].partialParent != ResourceId())
m_RenderState = m_BakedCmdBufferInfo[m_Partial[Primary].partialParent].state;
// Save the current render state in the partial command buffer.
m_RenderState = m_BakedCmdBufferInfo[GetPartialCommandBuffer()].state;
// swap the structure back now that we've accumulated the frame as well.
if(IsLoading(m_State) || IsStructuredExporting(m_State))
@@ -3150,10 +3148,8 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
}
else
{
if(m_Partial[Secondary].partialParent != ResourceId())
m_BakedCmdBufferInfo[m_Partial[Primary].partialParent].state = m_RenderState;
else if(m_Partial[Primary].partialParent != ResourceId())
m_BakedCmdBufferInfo[m_Partial[Primary].partialParent].state = m_RenderState;
// Copy the state in case m_RenderState was modified externally for the partial replay.
m_BakedCmdBufferInfo[GetPartialCommandBuffer()].state = m_RenderState;
}
VkResult vkr = VK_SUCCESS;
@@ -3654,6 +3650,13 @@ VkCommandBuffer WrappedVulkan::RerecordCmdBuf(ResourceId cmdid, PartialReplayInd
return it->second;
}
ResourceId WrappedVulkan::GetPartialCommandBuffer()
{
if(m_Partial[Secondary].partialParent != ResourceId())
return m_Partial[Secondary].partialParent;
return m_Partial[Primary].partialParent;
}
void WrappedVulkan::AddDrawcall(const DrawcallDescription &d, bool hasEvents)
{
m_AddedDrawcall = true;
+2
View File
@@ -668,6 +668,8 @@ private:
bool ShouldUpdateRenderState(ResourceId cmdid, bool forcePrimary = false);
VkCommandBuffer RerecordCmdBuf(ResourceId cmdid, PartialReplayIndex partialType = ePartialNum);
ResourceId GetPartialCommandBuffer();
// this info is stored in the record on capture, but we
// need it on replay too
struct DescriptorSetInfo
+2 -2
View File
@@ -1653,11 +1653,11 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeCast, Floa
vkr = vt->EndCommandBuffer(Unwrap(cmd));
RDCASSERTEQUAL(vkr, VK_SUCCESS);
for (size_t i = startEvent; i < events.size(); i++)
for(size_t i = startEvent; i < events.size(); i++)
{
m_pDriver->ReplayLog(events[i], events[i], eReplay_OnlyDraw);
if (overlay == DebugOverlay::ClearBeforePass && i + 1 < events.size())
if(overlay == DebugOverlay::ClearBeforePass && i + 1 < events.size())
m_pDriver->ReplayLog(events[i] + 1, events[i + 1], eReplay_WithoutDraw);
}
@@ -1773,7 +1773,6 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass2(SerialiserType &ser,
// be in subpass 0's layout
if(m_FirstEventID == m_LastEventID)
{
// VulkanCreationInfo::Framebuffer fbinfo = m_CreationInfo.m_Framebuffer[fb];
VulkanCreationInfo::RenderPass rpinfo =
m_CreationInfo.m_RenderPass[GetCmdRenderState().renderPass];
unwrappedInfo.renderPass = Unwrap(rpinfo.loadRPs[0]);
@@ -3488,6 +3487,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(SerialiserType &ser, VkComman
m_BakedCmdBufferInfo[cmd].state.SetFramebuffer(
parentCmdBufInfo.state.GetFramebuffer(),
parentCmdBufInfo.state.GetFramebufferAttachments());
m_BakedCmdBufferInfo[cmd].state.renderArea = parentCmdBufInfo.state.renderArea;
// 2 extra for the virtual labels around the command buffer
parentCmdBufInfo.curEventID += 2 + m_BakedCmdBufferInfo[cmd].eventCount;
@@ -4931,7 +4931,6 @@ bool WrappedVulkan::Serialise_vkCmdBeginTransformFeedbackEXT(
// track while reading, for fetching the right set of outputs in AddDrawcall
m_BakedCmdBufferInfo[m_LastCmdBufferID].state.firstxfbcounter = firstBuffer;
// TODO: should change the xfbcount, resize?
m_BakedCmdBufferInfo[m_LastCmdBufferID].state.xfbcounters.resize(bufferCount);
}
}