mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-21 17:31:17 +00:00
Add ability to re-record all cmd buffers (for whole-frame timing)
This commit is contained in:
@@ -264,6 +264,21 @@ struct CounterResult
|
||||
CounterResult(uint32_t EID, uint32_t c, uint32_t data) : eventID(EID), counterID(c) { value.u32 = data; }
|
||||
CounterResult(uint32_t EID, uint32_t c, uint64_t data) : eventID(EID), counterID(c) { value.u64 = data; }
|
||||
|
||||
bool operator <(const CounterResult &o) const
|
||||
{
|
||||
if(eventID != o.eventID) return eventID < o.eventID;
|
||||
if(counterID != o.counterID) return counterID < o.counterID;
|
||||
|
||||
// don't compare values, just consider equal
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator ==(const CounterResult &o) const
|
||||
{
|
||||
// don't compare values, just consider equal by EID/counterID
|
||||
return eventID == o.eventID && counterID == o.counterID;
|
||||
}
|
||||
|
||||
uint32_t eventID;
|
||||
uint32_t counterID;
|
||||
union
|
||||
|
||||
@@ -373,7 +373,7 @@ VkCommandBuffer WrappedVulkan::GetNextCmd()
|
||||
}
|
||||
else
|
||||
{
|
||||
VkCommandBufferAllocateInfo cmdInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, NULL, Unwrap(m_InternalCmds.m_CmdPool), VK_COMMAND_BUFFER_LEVEL_PRIMARY, 1 };
|
||||
VkCommandBufferAllocateInfo cmdInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, NULL, Unwrap(m_InternalCmds.cmdpool), VK_COMMAND_BUFFER_LEVEL_PRIMARY, 1 };
|
||||
VkResult vkr = ObjDisp(m_Device)->AllocateCommandBuffers(Unwrap(m_Device), &cmdInfo, &ret);
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
|
||||
@@ -459,6 +459,32 @@ void WrappedVulkan::FlushQ()
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t WrappedVulkan::HandlePreDraw(VkCommandBuffer commandBuffer)
|
||||
{
|
||||
if(!m_DrawcallCallback) return 0;
|
||||
|
||||
// look up the EID this drawcall came from
|
||||
DrawcallUse use(m_CurChunkOffset, 0);
|
||||
auto it = std::lower_bound(m_DrawcallUses.begin(), m_DrawcallUses.end(), use);
|
||||
RDCASSERT(it != m_DrawcallUses.end());
|
||||
|
||||
uint32_t eventID = it->eventID;
|
||||
|
||||
RDCASSERT(eventID != 0);
|
||||
|
||||
// handle all aliases of this drawcall
|
||||
++it;
|
||||
while(it != m_DrawcallUses.end() && it->fileOffset == m_CurChunkOffset)
|
||||
{
|
||||
m_DrawcallCallback->AliasEvent(eventID, it->eventID);
|
||||
++it;
|
||||
}
|
||||
|
||||
m_DrawcallCallback->PreDraw(eventID, commandBuffer);
|
||||
|
||||
return eventID;
|
||||
}
|
||||
|
||||
const char * WrappedVulkan::GetChunkName(uint32_t idx)
|
||||
{
|
||||
if(idx < FIRST_CHUNK_ID || idx >= NUM_VULKAN_CHUNKS)
|
||||
@@ -1197,7 +1223,7 @@ void WrappedVulkan::ReadLogInitialisation()
|
||||
m_pSerialiser->SetDebugText(false);
|
||||
|
||||
// ensure the capture at least created a device and fetched a queue.
|
||||
RDCASSERT(m_Device != VK_NULL_HANDLE && m_Queue != VK_NULL_HANDLE && m_InternalCmds.m_CmdPool != VK_NULL_HANDLE);
|
||||
RDCASSERT(m_Device != VK_NULL_HANDLE && m_Queue != VK_NULL_HANDLE && m_InternalCmds.cmdpool != VK_NULL_HANDLE);
|
||||
}
|
||||
|
||||
void WrappedVulkan::ContextReplayLog(LogState readType, uint32_t startEventID, uint32_t endEventID, bool partial)
|
||||
@@ -1329,6 +1355,16 @@ void WrappedVulkan::ContextReplayLog(LogState readType, uint32_t startEventID, u
|
||||
m_PartialReplayData.resultPartialCmdBuffer = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
for(auto it = m_RerecordCmds.begin(); it != m_RerecordCmds.end(); ++it)
|
||||
{
|
||||
VkCommandBuffer cmd = it->second;
|
||||
|
||||
// same as above (these are created in an identical way)
|
||||
vkFreeCommandBuffers(GetDev(), m_InternalCmds.cmdpool, 1, &cmd);
|
||||
}
|
||||
|
||||
m_RerecordCmds.clear();
|
||||
|
||||
m_State = READING;
|
||||
}
|
||||
|
||||
@@ -1877,10 +1913,20 @@ bool WrappedVulkan::InRerecordRange()
|
||||
return m_BakedCmdBufferInfo[m_PartialReplayData.partialParent].curEventID <= m_LastEventID - m_PartialReplayData.baseEvent;
|
||||
}
|
||||
|
||||
VkCommandBuffer WrappedVulkan::RerecordCmdBuf()
|
||||
VkCommandBuffer WrappedVulkan::RerecordCmdBuf(ResourceId cmdid)
|
||||
{
|
||||
if(m_PartialReplayData.outsideCmdBuffer != VK_NULL_HANDLE)
|
||||
return m_PartialReplayData.outsideCmdBuffer;
|
||||
|
||||
if(m_DrawcallCallback && m_DrawcallCallback->RecordAllCmds())
|
||||
{
|
||||
auto it = m_RerecordCmds.find(cmdid);
|
||||
|
||||
RDCASSERT(it != m_RerecordCmds.end());
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return m_PartialReplayData.resultPartialCmdBuffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,12 @@ struct DrawcallCallback
|
||||
// being replayed is larger than one command buffer (which usually means the
|
||||
// whole frame).
|
||||
virtual bool RecordAllCmds() = 0;
|
||||
|
||||
// if a command buffer is recorded once and submitted N > 1 times, then the same
|
||||
// drawcall will have several EIDs that refer to it. We'll only do the full
|
||||
// callbacks above for the first EID, then call this function for the others
|
||||
// to indicate that they are the same.
|
||||
virtual void AliasEvent(uint32_t primary, uint32_t alias) = 0;
|
||||
};
|
||||
|
||||
class WrappedVulkan : public IFrameCapturer
|
||||
@@ -176,6 +182,10 @@ private:
|
||||
Threading::CriticalSection m_CapTransitionLock;
|
||||
|
||||
DrawcallCallback *m_DrawcallCallback;
|
||||
|
||||
// util function to handle fetching the right eventID, calling any
|
||||
// aliases then calling PreDraw.
|
||||
uint32_t HandlePreDraw(VkCommandBuffer commandBuffer);
|
||||
|
||||
uint32_t m_FrameCounter;
|
||||
|
||||
@@ -232,7 +242,7 @@ private:
|
||||
{
|
||||
void Reset()
|
||||
{
|
||||
m_CmdPool = VK_NULL_HANDLE;
|
||||
cmdpool = VK_NULL_HANDLE;
|
||||
freecmds.clear();
|
||||
pendingcmds.clear();
|
||||
submittedcmds.clear();
|
||||
@@ -242,7 +252,7 @@ private:
|
||||
submittedcmds.clear();
|
||||
}
|
||||
|
||||
VkCommandPool m_CmdPool; // the command pool used for allocating our own command buffers
|
||||
VkCommandPool cmdpool; // the command pool used for allocating our own command buffers
|
||||
|
||||
vector<VkCommandBuffer> freecmds; // <
|
||||
// -> GetNextCmd() -> // |
|
||||
@@ -291,6 +301,24 @@ private:
|
||||
ResourceId m_LastCmdBufferID;
|
||||
int m_CmdBuffersInProgress;
|
||||
|
||||
// this is a list of uint64_t file offset -> uint32_t EIDs of where each
|
||||
// drawcall is used. E.g. the drawcall at offset 873954 is EID 50. If a
|
||||
// command buffer is submitted more than once, there may be more than
|
||||
// one entry here - the drawcall will be aliased among several EIDs, with
|
||||
// the first one being the 'primary'
|
||||
struct DrawcallUse
|
||||
{
|
||||
DrawcallUse(uint64_t offs, uint32_t eid) : fileOffset(offs), eventID(eid) {}
|
||||
uint64_t fileOffset;
|
||||
uint32_t eventID;
|
||||
bool operator<(const DrawcallUse &o) const
|
||||
{
|
||||
if(fileOffset != o.fileOffset) return fileOffset < o.fileOffset;
|
||||
return eventID < o.eventID;
|
||||
}
|
||||
};
|
||||
vector<DrawcallUse> m_DrawcallUses;
|
||||
|
||||
struct PartialReplayData
|
||||
{
|
||||
// if we're doing a partial replay, by definition only one command
|
||||
@@ -344,6 +372,8 @@ private:
|
||||
bool renderPassActive;
|
||||
} m_PartialReplayData;
|
||||
|
||||
map<ResourceId, VkCommandBuffer> m_RerecordCmds;
|
||||
|
||||
// There is only a state while currently partially replaying, it's
|
||||
// undefined/empty otherwise.
|
||||
// All IDs are original IDs, not live.
|
||||
@@ -351,7 +381,7 @@ private:
|
||||
|
||||
bool ShouldRerecordCmd(ResourceId cmdid);
|
||||
bool InRerecordRange();
|
||||
VkCommandBuffer RerecordCmdBuf();
|
||||
VkCommandBuffer RerecordCmdBuf(ResourceId cmdid);
|
||||
|
||||
// this info is stored in the record on capture, but we
|
||||
// need it on replay too
|
||||
|
||||
@@ -103,10 +103,20 @@ struct GPUTimerCallback : public DrawcallCallback
|
||||
return true;
|
||||
}
|
||||
|
||||
void AliasEvent(uint32_t primary, uint32_t alias)
|
||||
{
|
||||
m_AliasEvents.push_back(std::make_pair(primary, alias));
|
||||
}
|
||||
|
||||
WrappedVulkan *m_pDriver;
|
||||
VulkanReplay *m_pReplay;
|
||||
VkQueryPool m_QueryPool;
|
||||
vector<uint32_t> m_Results;
|
||||
// events which are the 'same' from being the same command buffer resubmitted
|
||||
// multiple times in the frame. We will only get the full callback when we're
|
||||
// recording the command buffer, and will be given the first EID. After that
|
||||
// we'll just be told which other EIDs alias this event.
|
||||
vector< pair<uint32_t, uint32_t> > m_AliasEvents;
|
||||
};
|
||||
|
||||
vector<CounterResult> VulkanReplay::FetchCounters(uint32_t frameID, const vector<uint32_t> &counters)
|
||||
@@ -169,6 +179,25 @@ vector<CounterResult> VulkanReplay::FetchCounters(uint32_t frameID, const vector
|
||||
ret.push_back(result);
|
||||
}
|
||||
|
||||
for(size_t i=0; i < cb.m_AliasEvents.size(); i++)
|
||||
{
|
||||
CounterResult search;
|
||||
search.counterID = eCounter_EventGPUDuration;
|
||||
search.eventID = cb.m_AliasEvents[i].first;
|
||||
|
||||
// find the result we're aliasing
|
||||
auto it = std::find(ret.begin(), ret.end(), search);
|
||||
RDCASSERT(it != ret.end());
|
||||
|
||||
// duplicate the result and append
|
||||
CounterResult aliased = *it;
|
||||
aliased.eventID = cb.m_AliasEvents[i].second;
|
||||
ret.push_back(aliased);
|
||||
}
|
||||
|
||||
// sort so that the alias results appear in the right places
|
||||
std::sort(ret.begin(), ret.end());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2318,6 +2318,11 @@ struct QuadOverdrawCallback : public DrawcallCallback
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AliasEvent(uint32_t primary, uint32_t alias)
|
||||
{
|
||||
// don't care
|
||||
}
|
||||
|
||||
uint32_t m_FrameID;
|
||||
WrappedVulkan *m_pDriver;
|
||||
@@ -4318,7 +4323,12 @@ void AddOutputDumping(const ShaderReflection &refl, const char *entryName,
|
||||
|
||||
void VulkanDebugManager::InitPostVSBuffers(uint32_t frameID, uint32_t eventID)
|
||||
{
|
||||
// go through any aliasing
|
||||
if(m_PostVSAlias.find(eventID) != m_PostVSAlias.end())
|
||||
eventID = m_PostVSAlias[eventID];
|
||||
|
||||
auto idx = std::make_pair(frameID, eventID);
|
||||
|
||||
if(m_PostVSData.find(idx) != m_PostVSData.end())
|
||||
return;
|
||||
|
||||
@@ -4980,6 +4990,10 @@ void VulkanDebugManager::InitPostVSBuffers(uint32_t frameID, uint32_t eventID)
|
||||
|
||||
MeshFormat VulkanDebugManager::GetPostVSBuffers(uint32_t frameID, uint32_t eventID, uint32_t instID, MeshDataStage stage)
|
||||
{
|
||||
// go through any aliasing
|
||||
if(m_PostVSAlias.find(eventID) != m_PostVSAlias.end())
|
||||
eventID = m_PostVSAlias[eventID];
|
||||
|
||||
VulkanPostVSData postvs;
|
||||
RDCEraseEl(postvs);
|
||||
|
||||
|
||||
@@ -112,6 +112,10 @@ class VulkanDebugManager
|
||||
ResourceId RenderOverlay(ResourceId texid, TextureDisplayOverlay overlay, uint32_t frameID, uint32_t eventID, const vector<uint32_t> &passEvents);
|
||||
|
||||
void InitPostVSBuffers(uint32_t frameID, uint32_t eventID);
|
||||
|
||||
// indicates that EID alias is the same as frameID/eventID
|
||||
void AliasPostVSBuffers(uint32_t frameID, uint32_t eventID, uint32_t alias) { m_PostVSAlias[alias] = eventID; }
|
||||
|
||||
MeshFormat GetPostVSBuffers(uint32_t frameID, uint32_t eventID, uint32_t instID, MeshDataStage stage);
|
||||
void GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, vector<byte> &ret);
|
||||
|
||||
@@ -265,6 +269,7 @@ class VulkanDebugManager
|
||||
map<uint64_t, MeshDisplayPipelines> m_CachedMeshPipelines;
|
||||
|
||||
map<pair<uint32_t,uint32_t>, VulkanPostVSData> m_PostVSData;
|
||||
map<uint32_t, uint32_t> m_PostVSAlias;
|
||||
|
||||
WrappedVulkan *m_pDriver;
|
||||
VulkanResourceManager *m_ResourceManager;
|
||||
|
||||
@@ -3782,9 +3782,8 @@ void VulkanReplay::InitPostVSBuffers(uint32_t frameID, uint32_t eventID)
|
||||
|
||||
struct InitPostVSCallback : public DrawcallCallback
|
||||
{
|
||||
InitPostVSCallback(WrappedVulkan *vk, VulkanReplay *rp, uint32_t frameID, const vector<uint32_t> &events)
|
||||
InitPostVSCallback(WrappedVulkan *vk, uint32_t frameID, const vector<uint32_t> &events)
|
||||
: m_pDriver(vk)
|
||||
, m_pReplay(rp)
|
||||
, m_FrameID(frameID)
|
||||
, m_Events(events)
|
||||
{ m_pDriver->SetDrawcallCB(this); }
|
||||
@@ -3794,7 +3793,7 @@ struct InitPostVSCallback : public DrawcallCallback
|
||||
void PreDraw(uint32_t eid, VkCommandBuffer cmd)
|
||||
{
|
||||
if(std::find(m_Events.begin(), m_Events.end(), eid) != m_Events.end())
|
||||
m_pReplay->InitPostVSBuffers(m_FrameID, eid);
|
||||
m_pDriver->GetDebugManager()->InitPostVSBuffers(m_FrameID, eid);
|
||||
}
|
||||
|
||||
bool PostDraw(uint32_t eid, VkCommandBuffer cmd)
|
||||
@@ -3810,10 +3809,15 @@ struct InitPostVSCallback : public DrawcallCallback
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AliasEvent(uint32_t primary, uint32_t alias)
|
||||
{
|
||||
if(std::find(m_Events.begin(), m_Events.end(), primary) != m_Events.end())
|
||||
m_pDriver->GetDebugManager()->AliasPostVSBuffers(m_FrameID, primary, alias);
|
||||
}
|
||||
|
||||
uint32_t m_FrameID;
|
||||
WrappedVulkan *m_pDriver;
|
||||
VulkanReplay *m_pReplay;
|
||||
const vector<uint32_t> &m_Events;
|
||||
};
|
||||
|
||||
@@ -3824,7 +3828,7 @@ void VulkanReplay::InitPostVSBuffers(uint32_t frameID, const vector<uint32_t> &e
|
||||
// command buffer
|
||||
m_pDriver->ReplayLog(frameID, 0, events.front(), eReplay_WithoutDraw);
|
||||
|
||||
InitPostVSCallback cb(m_pDriver, this, frameID, events);
|
||||
InitPostVSCallback cb(m_pDriver, frameID, events);
|
||||
|
||||
// now we replay the events, which are guaranteed (because we generated them in
|
||||
// GetPassEvents above) to come from the same command buffer, so the event IDs are
|
||||
|
||||
@@ -314,6 +314,8 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(
|
||||
const vector<uint32_t> &baseEvents = m_PartialReplayData.cmdBufferSubmits[bakeId];
|
||||
uint32_t length = m_BakedCmdBufferInfo[bakeId].eventCount;
|
||||
|
||||
bool partial = false;
|
||||
|
||||
for(auto it=baseEvents.begin(); it != baseEvents.end(); ++it)
|
||||
{
|
||||
if(*it <= m_LastEventID && m_LastEventID < (*it + length))
|
||||
@@ -323,29 +325,58 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(
|
||||
m_PartialReplayData.partialParent = cmdId;
|
||||
m_PartialReplayData.baseEvent = *it;
|
||||
m_PartialReplayData.renderPassActive = false;
|
||||
|
||||
VkCommandBuffer cmd = VK_NULL_HANDLE;
|
||||
VkResult ret = ObjDisp(device)->AllocateCommandBuffers(Unwrap(device), &allocInfo, &cmd);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
{
|
||||
RDCERR("Failed on resource serialise-creation, VkResult: 0x%08x", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->WrapResource(Unwrap(device), cmd);
|
||||
}
|
||||
|
||||
m_PartialReplayData.resultPartialCmdPool = (VkCommandPool)(uint64_t)GetResourceManager()->GetNonDispWrapper(allocInfo.commandPool);
|
||||
m_PartialReplayData.resultPartialCmdBuffer = cmd;
|
||||
m_PartialReplayData.partialDevice = device;
|
||||
|
||||
// add one-time submit flag as this partial cmd buffer will only be submitted once
|
||||
info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
||||
|
||||
ObjDisp(cmd)->BeginCommandBuffer(Unwrap(cmd), &info);
|
||||
m_PartialReplayData.resultPartialCmdPool = (VkCommandPool)(uint64_t)GetResourceManager()->GetNonDispWrapper(allocInfo.commandPool);
|
||||
|
||||
partial = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(partial || (m_DrawcallCallback && m_DrawcallCallback->RecordAllCmds()))
|
||||
{
|
||||
// pull all re-recorded commands from our own device and command pool for easier cleanup
|
||||
if(!partial)
|
||||
{
|
||||
device = GetDev();
|
||||
allocInfo.commandPool = Unwrap(m_InternalCmds.cmdpool);
|
||||
}
|
||||
|
||||
VkCommandBuffer cmd = VK_NULL_HANDLE;
|
||||
VkResult ret = ObjDisp(device)->AllocateCommandBuffers(Unwrap(device), &allocInfo, &cmd);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
{
|
||||
RDCERR("Failed on resource serialise-creation, VkResult: 0x%08x", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->WrapResource(Unwrap(device), cmd);
|
||||
}
|
||||
|
||||
if(partial)
|
||||
{
|
||||
m_PartialReplayData.resultPartialCmdBuffer = cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we store under both baked and non baked ID.
|
||||
// The baked ID is the 'real' entry, the non baked is simply so it
|
||||
// can be found in the subsequent serialised commands that ref the
|
||||
// non-baked ID. The baked ID is referenced by the submit itself.
|
||||
//
|
||||
// In vkEndCommandBuffer we erase the non-baked reference, and since
|
||||
// we know the serialised command buffers are independent (ie. aren't
|
||||
// overlapping in the capture even if they were recorded overlapping)
|
||||
// there's no issue with clashes here.
|
||||
m_RerecordCmds[bakeId] = cmd;
|
||||
m_RerecordCmds[cmdId] = cmd;
|
||||
}
|
||||
|
||||
// add one-time submit flag as this partial cmd buffer will only be submitted once
|
||||
info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
||||
|
||||
ObjDisp(cmd)->BeginCommandBuffer(Unwrap(cmd), &info);
|
||||
}
|
||||
|
||||
m_BakedCmdBufferInfo[cmdId].curEventID = 1;
|
||||
}
|
||||
@@ -439,13 +470,13 @@ VkResult WrappedVulkan::vkBeginCommandBuffer(
|
||||
|
||||
bool WrappedVulkan::Serialise_vkEndCommandBuffer(Serialiser* localSerialiser, VkCommandBuffer commandBuffer)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, cmdId, GetResID(commandBuffer));
|
||||
SERIALISE_ELEMENT(ResourceId, cmdid, GetResID(commandBuffer));
|
||||
|
||||
ResourceId bakedCmdId;
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
VkResourceRecord *record = GetResourceManager()->GetResourceRecord(cmdId);
|
||||
VkResourceRecord *record = GetResourceManager()->GetResourceRecord(cmdid);
|
||||
RDCASSERT(record->bakedCommands);
|
||||
if(record->bakedCommands)
|
||||
bakedCmdId = record->bakedCommands->GetResourceID();
|
||||
@@ -455,32 +486,36 @@ bool WrappedVulkan::Serialise_vkEndCommandBuffer(Serialiser* localSerialiser, Vk
|
||||
|
||||
if(m_State < WRITING)
|
||||
{
|
||||
m_LastCmdBufferID = cmdId;
|
||||
m_LastCmdBufferID = cmdid;
|
||||
m_CmdBuffersInProgress--;
|
||||
}
|
||||
|
||||
if(m_State == EXECUTING)
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdId))
|
||||
if(ShouldRerecordCmd(cmdid))
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
RDCDEBUG("Ending partial command buffer for %llu baked to %llu", cmdId, bakeId);
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
RDCDEBUG("Ending partial command buffer for %llu baked to %llu", cmdid, bakeId);
|
||||
|
||||
if(m_PartialReplayData.renderPassActive)
|
||||
ObjDisp(commandBuffer)->CmdEndRenderPass(Unwrap(commandBuffer));
|
||||
|
||||
ObjDisp(commandBuffer)->EndCommandBuffer(Unwrap(commandBuffer));
|
||||
|
||||
// erase the non-baked reference to this command buffer so that we don't have
|
||||
// duplicates when it comes time to clean up. See above in vkBeginCommandBuffer
|
||||
m_RerecordCmds.erase(cmdid);
|
||||
|
||||
m_PartialReplayData.partialParent = ResourceId();
|
||||
}
|
||||
|
||||
m_BakedCmdBufferInfo[cmdId].curEventID = 0;
|
||||
m_BakedCmdBufferInfo[cmdid].curEventID = 0;
|
||||
}
|
||||
else if(m_State == READING)
|
||||
{
|
||||
commandBuffer = GetResourceManager()->GetLiveHandle<VkCommandBuffer>(bakeId);
|
||||
|
||||
GetResourceManager()->RemoveReplacement(cmdId);
|
||||
GetResourceManager()->RemoveReplacement(cmdid);
|
||||
|
||||
ObjDisp(commandBuffer)->EndCommandBuffer(Unwrap(commandBuffer));
|
||||
|
||||
@@ -594,7 +629,7 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
m_PartialReplayData.renderPassActive = true;
|
||||
ObjDisp(commandBuffer)->CmdBeginRenderPass(Unwrap(commandBuffer), &beginInfo, cont);
|
||||
@@ -686,7 +721,7 @@ bool WrappedVulkan::Serialise_vkCmdNextSubpass(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
m_RenderState.subpass++;
|
||||
|
||||
@@ -768,7 +803,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
ObjDisp(commandBuffer)->CmdExecuteCommands(Unwrap(commandBuffer), count, &cmds[0]);
|
||||
}
|
||||
@@ -837,7 +872,7 @@ bool WrappedVulkan::Serialise_vkCmdEndRenderPass(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
m_PartialReplayData.renderPassActive = false;
|
||||
ObjDisp(commandBuffer)->CmdEndRenderPass(Unwrap(commandBuffer));
|
||||
@@ -900,7 +935,7 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
pipeline = GetResourceManager()->GetLiveHandle<VkPipeline>(pipeid);
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
ObjDisp(commandBuffer)->CmdBindPipeline(Unwrap(commandBuffer), bind, Unwrap(pipeline));
|
||||
|
||||
@@ -1044,7 +1079,7 @@ bool WrappedVulkan::Serialise_vkCmdBindDescriptorSets(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
ObjDisp(commandBuffer)->CmdBindDescriptorSets(Unwrap(commandBuffer), bind, Unwrap(layout), first, numSets, sets, offsCount, offs);
|
||||
|
||||
@@ -1206,7 +1241,7 @@ bool WrappedVulkan::Serialise_vkCmdBindVertexBuffers(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdBindVertexBuffers(Unwrap(commandBuffer), start, count, &bufs[0], &offs[0]);
|
||||
|
||||
if(m_RenderState.vbuffers.size() < start + count)
|
||||
@@ -1283,7 +1318,7 @@ bool WrappedVulkan::Serialise_vkCmdBindIndexBuffer(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdBindIndexBuffer(Unwrap(commandBuffer), Unwrap(buffer), offs, idxType);
|
||||
|
||||
m_RenderState.ibuffer.buf = GetResID(buffer);
|
||||
@@ -1353,7 +1388,7 @@ bool WrappedVulkan::Serialise_vkCmdUpdateBuffer(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdUpdateBuffer(Unwrap(commandBuffer), Unwrap(destBuffer), offs, sz, (uint32_t *)bufdata);
|
||||
}
|
||||
}
|
||||
@@ -1426,7 +1461,7 @@ bool WrappedVulkan::Serialise_vkCmdFillBuffer(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdFillBuffer(Unwrap(commandBuffer), Unwrap(destBuffer), offs, sz, d);
|
||||
}
|
||||
}
|
||||
@@ -1496,7 +1531,7 @@ bool WrappedVulkan::Serialise_vkCmdPushConstants(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
layout = GetResourceManager()->GetLiveHandle<VkPipelineLayout>(layid);
|
||||
ObjDisp(commandBuffer)->CmdPushConstants(Unwrap(commandBuffer), Unwrap(layout), flags, s, len, vals);
|
||||
|
||||
@@ -1603,10 +1638,10 @@ bool WrappedVulkan::Serialise_vkCmdPipelineBarrier(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdPipelineBarrier(Unwrap(commandBuffer), src, dest, region, (uint32_t)mems.size(), (const void **)&mems[0]);
|
||||
|
||||
ResourceId cmd = GetResID(RerecordCmdBuf());
|
||||
ResourceId cmd = GetResID(RerecordCmdBuf(cmdid));
|
||||
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts, (uint32_t)imBarriers.size(), &imBarriers[0]);
|
||||
}
|
||||
}
|
||||
@@ -1728,7 +1763,7 @@ bool WrappedVulkan::Serialise_vkCmdWriteTimestamp(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdWriteTimestamp(Unwrap(commandBuffer), stage, Unwrap(queryPool), e);
|
||||
}
|
||||
}
|
||||
@@ -1796,7 +1831,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyQueryPoolResults(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdCopyQueryPoolResults(Unwrap(commandBuffer), Unwrap(queryPool), start, count, Unwrap(destBuffer), offs, stride, f);
|
||||
}
|
||||
}
|
||||
@@ -1869,7 +1904,7 @@ bool WrappedVulkan::Serialise_vkCmdBeginQuery(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdBeginQuery(Unwrap(commandBuffer), Unwrap(queryPool), s, f);
|
||||
}
|
||||
}
|
||||
@@ -1925,7 +1960,7 @@ bool WrappedVulkan::Serialise_vkCmdEndQuery(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdEndQuery(Unwrap(commandBuffer), Unwrap(queryPool), s);
|
||||
}
|
||||
}
|
||||
@@ -1982,7 +2017,7 @@ bool WrappedVulkan::Serialise_vkCmdResetQueryPool(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdResetQueryPool(Unwrap(commandBuffer), Unwrap(queryPool), start, count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ void WrappedVulkan::Shutdown()
|
||||
GetResourceManager()->ReleaseWrappedResource(m_InternalCmds.freecmds[i]);
|
||||
|
||||
// destroy the pool
|
||||
ObjDisp(m_Device)->DestroyCommandPool(Unwrap(m_Device), Unwrap(m_InternalCmds.m_CmdPool), NULL);
|
||||
GetResourceManager()->ReleaseWrappedResource(m_InternalCmds.m_CmdPool);
|
||||
ObjDisp(m_Device)->DestroyCommandPool(Unwrap(m_Device), Unwrap(m_InternalCmds.cmdpool), NULL);
|
||||
GetResourceManager()->ReleaseWrappedResource(m_InternalCmds.cmdpool);
|
||||
|
||||
// we do more in Shutdown than the equivalent vkDestroyInstance since on replay there's
|
||||
// no explicit vkDestroyDevice, we destroy the device here then the instance
|
||||
@@ -555,13 +555,13 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
|
||||
|
||||
VkResult vkr = VK_SUCCESS;
|
||||
|
||||
if(m_InternalCmds.m_CmdPool == VK_NULL_HANDLE)
|
||||
if(m_InternalCmds.cmdpool == VK_NULL_HANDLE)
|
||||
{
|
||||
VkCommandPoolCreateInfo poolInfo = { VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, NULL, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, qFamilyIdx };
|
||||
vkr = ObjDisp(device)->CreateCommandPool(Unwrap(device), &poolInfo, NULL, &m_InternalCmds.m_CmdPool);
|
||||
vkr = ObjDisp(device)->CreateCommandPool(Unwrap(device), &poolInfo, NULL, &m_InternalCmds.cmdpool);
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
|
||||
GetResourceManager()->WrapResource(Unwrap(device), m_InternalCmds.m_CmdPool);
|
||||
GetResourceManager()->WrapResource(Unwrap(device), m_InternalCmds.cmdpool);
|
||||
}
|
||||
|
||||
ObjDisp(physicalDevice)->GetPhysicalDeviceProperties(Unwrap(physicalDevice), &m_PhysicalDeviceData.props);
|
||||
@@ -728,13 +728,13 @@ VkResult WrappedVulkan::vkCreateDevice(
|
||||
|
||||
m_QueueFamilyIdx = qFamilyIdx;
|
||||
|
||||
if(m_InternalCmds.m_CmdPool == VK_NULL_HANDLE)
|
||||
if(m_InternalCmds.cmdpool == VK_NULL_HANDLE)
|
||||
{
|
||||
VkCommandPoolCreateInfo poolInfo = { VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, NULL, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, qFamilyIdx };
|
||||
vkr = ObjDisp(device)->CreateCommandPool(Unwrap(device), &poolInfo, NULL, &m_InternalCmds.m_CmdPool);
|
||||
vkr = ObjDisp(device)->CreateCommandPool(Unwrap(device), &poolInfo, NULL, &m_InternalCmds.cmdpool);
|
||||
RDCASSERT(vkr == VK_SUCCESS);
|
||||
|
||||
GetResourceManager()->WrapResource(Unwrap(device), m_InternalCmds.m_CmdPool);
|
||||
GetResourceManager()->WrapResource(Unwrap(device), m_InternalCmds.cmdpool);
|
||||
}
|
||||
|
||||
ObjDisp(physicalDevice)->GetPhysicalDeviceProperties(Unwrap(physicalDevice), &m_PhysicalDeviceData.props);
|
||||
@@ -780,10 +780,10 @@ void WrappedVulkan::vkDestroyDevice(VkDevice device, const VkAllocationCallbacks
|
||||
GetResourceManager()->ReleaseWrappedResource(m_InternalCmds.freecmds[i]);
|
||||
|
||||
// destroy our command pool
|
||||
if(m_InternalCmds.m_CmdPool != VK_NULL_HANDLE)
|
||||
if(m_InternalCmds.cmdpool != VK_NULL_HANDLE)
|
||||
{
|
||||
ObjDisp(m_Device)->DestroyCommandPool(Unwrap(m_Device), Unwrap(m_InternalCmds.m_CmdPool), NULL);
|
||||
GetResourceManager()->ReleaseWrappedResource(m_InternalCmds.m_CmdPool);
|
||||
ObjDisp(m_Device)->DestroyCommandPool(Unwrap(m_Device), Unwrap(m_InternalCmds.cmdpool), NULL);
|
||||
GetResourceManager()->ReleaseWrappedResource(m_InternalCmds.cmdpool);
|
||||
}
|
||||
|
||||
for(size_t i=0; i < m_InternalCmds.freesems.size(); i++)
|
||||
|
||||
@@ -45,19 +45,16 @@ bool WrappedVulkan::Serialise_vkCmdDraw(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
if(m_DrawcallCallback) m_DrawcallCallback->PreDraw(m_RootEventID, commandBuffer);
|
||||
uint32_t eventID = HandlePreDraw(commandBuffer);
|
||||
|
||||
ObjDisp(commandBuffer)->CmdDraw(Unwrap(commandBuffer), vtxCount, instCount, firstVtx, firstInst);
|
||||
|
||||
if(m_DrawcallCallback)
|
||||
if(eventID && m_DrawcallCallback->PostDraw(eventID, commandBuffer))
|
||||
{
|
||||
if(m_DrawcallCallback->PostDraw(m_RootEventID, commandBuffer))
|
||||
{
|
||||
ObjDisp(commandBuffer)->CmdDraw(Unwrap(commandBuffer), vtxCount, instCount, firstVtx, firstInst);
|
||||
m_DrawcallCallback->PostRedraw(m_RootEventID, commandBuffer);
|
||||
}
|
||||
ObjDisp(commandBuffer)->CmdDraw(Unwrap(commandBuffer), vtxCount, instCount, firstVtx, firstInst);
|
||||
m_DrawcallCallback->PostRedraw(eventID, commandBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +143,7 @@ bool WrappedVulkan::Serialise_vkCmdBlitImage(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdBlitImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions, f);
|
||||
}
|
||||
}
|
||||
@@ -246,7 +243,7 @@ bool WrappedVulkan::Serialise_vkCmdResolveImage(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdResolveImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions);
|
||||
}
|
||||
}
|
||||
@@ -345,7 +342,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyImage(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdCopyImage(Unwrap(commandBuffer), Unwrap(srcImage), srclayout, Unwrap(destImage), dstlayout, count, regions);
|
||||
}
|
||||
}
|
||||
@@ -442,7 +439,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyBufferToImage(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdCopyBufferToImage(Unwrap(commandBuffer), Unwrap(srcBuffer), Unwrap(destImage), layout, count, regions);
|
||||
}
|
||||
}
|
||||
@@ -539,7 +536,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyImageToBuffer(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdCopyImageToBuffer(Unwrap(commandBuffer), Unwrap(srcImage), layout, Unwrap(destBuffer), count, regions);
|
||||
}
|
||||
}
|
||||
@@ -637,7 +634,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyBuffer(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdCopyBuffer(Unwrap(commandBuffer), Unwrap(srcBuffer), Unwrap(destBuffer), count, regions);
|
||||
}
|
||||
}
|
||||
@@ -735,7 +732,7 @@ bool WrappedVulkan::Serialise_vkCmdClearColorImage(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdClearColorImage(Unwrap(commandBuffer), Unwrap(image), layout, &col, count, ranges);
|
||||
}
|
||||
}
|
||||
@@ -818,7 +815,7 @@ bool WrappedVulkan::Serialise_vkCmdClearDepthStencilImage(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdClearDepthStencilImage(Unwrap(commandBuffer), Unwrap(image), l, &ds, count, ranges);
|
||||
}
|
||||
}
|
||||
@@ -900,7 +897,7 @@ bool WrappedVulkan::Serialise_vkCmdClearAttachments(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdClearAttachments(Unwrap(commandBuffer), acount, atts, rcount, rects);
|
||||
}
|
||||
}
|
||||
@@ -987,19 +984,16 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexed(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
|
||||
if(m_DrawcallCallback) m_DrawcallCallback->PreDraw(m_RootEventID, commandBuffer);
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
uint32_t eventID = HandlePreDraw(commandBuffer);
|
||||
|
||||
ObjDisp(commandBuffer)->CmdDrawIndexed(Unwrap(commandBuffer), idxCount, instCount, firstIdx, vtxOffs, firstInst);
|
||||
|
||||
if(m_DrawcallCallback)
|
||||
if(eventID && m_DrawcallCallback->PostDraw(eventID, commandBuffer))
|
||||
{
|
||||
if(m_DrawcallCallback->PostDraw(m_RootEventID, commandBuffer))
|
||||
{
|
||||
ObjDisp(commandBuffer)->CmdDrawIndexed(Unwrap(commandBuffer), idxCount, instCount, firstIdx, vtxOffs, firstInst);
|
||||
m_DrawcallCallback->PostRedraw(m_RootEventID, commandBuffer);
|
||||
}
|
||||
ObjDisp(commandBuffer)->CmdDrawIndexed(Unwrap(commandBuffer), idxCount, instCount, firstIdx, vtxOffs, firstInst);
|
||||
m_DrawcallCallback->PostRedraw(eventID, commandBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1081,7 +1075,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirect(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdDrawIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs, cnt, strd);
|
||||
}
|
||||
}
|
||||
@@ -1142,7 +1136,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdDrawIndexedIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs, cnt, strd);
|
||||
}
|
||||
}
|
||||
@@ -1198,7 +1192,7 @@ bool WrappedVulkan::Serialise_vkCmdDispatch(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdDispatch(Unwrap(commandBuffer), x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -1252,7 +1246,7 @@ bool WrappedVulkan::Serialise_vkCmdDispatchIndirect(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
commandBuffer = RerecordCmdBuf();
|
||||
commandBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(commandBuffer)->CmdDispatchIndirect(Unwrap(commandBuffer), Unwrap(buffer), offs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ bool WrappedVulkan::Serialise_vkCmdSetViewport(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetViewport(Unwrap(cmdBuffer), count, views);
|
||||
m_RenderState.views.assign(views, views + count);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ bool WrappedVulkan::Serialise_vkCmdSetScissor(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetScissor(Unwrap(cmdBuffer), count, scissors);
|
||||
m_RenderState.scissors.assign(scissors, scissors + count);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ bool WrappedVulkan::Serialise_vkCmdSetLineWidth(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetLineWidth(Unwrap(cmdBuffer), width);
|
||||
m_RenderState.lineWidth = width;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ bool WrappedVulkan::Serialise_vkCmdSetDepthBias(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetDepthBias(Unwrap(cmdBuffer), bias, biasclamp, slope);
|
||||
m_RenderState.bias.depth = bias;
|
||||
m_RenderState.bias.biasclamp = biasclamp;
|
||||
@@ -261,7 +261,7 @@ bool WrappedVulkan::Serialise_vkCmdSetBlendConstants(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetBlendConstants(Unwrap(cmdBuffer), blendFactor);
|
||||
memcpy(m_RenderState.blendConst, blendFactor, sizeof(blendFactor));
|
||||
}
|
||||
@@ -312,7 +312,7 @@ bool WrappedVulkan::Serialise_vkCmdSetDepthBounds(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetDepthBounds(Unwrap(cmdBuffer), mind, maxd);
|
||||
m_RenderState.mindepth = mind;
|
||||
m_RenderState.maxdepth = maxd;
|
||||
@@ -365,7 +365,7 @@ bool WrappedVulkan::Serialise_vkCmdSetStencilCompareMask(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetStencilCompareMask(Unwrap(cmdBuffer), face, mask);
|
||||
|
||||
if(face & VK_STENCIL_FACE_FRONT_BIT)
|
||||
@@ -421,7 +421,7 @@ bool WrappedVulkan::Serialise_vkCmdSetStencilWriteMask(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetStencilWriteMask(Unwrap(cmdBuffer), face, mask);
|
||||
|
||||
if(face & VK_STENCIL_FACE_FRONT_BIT)
|
||||
@@ -477,7 +477,7 @@ bool WrappedVulkan::Serialise_vkCmdSetStencilReference(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetStencilReference(Unwrap(cmdBuffer), face, mask);
|
||||
|
||||
if(face & VK_STENCIL_FACE_FRONT_BIT)
|
||||
|
||||
@@ -265,7 +265,11 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
|
||||
|
||||
m_RootEventID--;
|
||||
|
||||
if(m_LastEventID == startEID)
|
||||
if(numCmds == 0)
|
||||
{
|
||||
// do nothing, don't bother with the logic below
|
||||
}
|
||||
else if(m_LastEventID == startEID)
|
||||
{
|
||||
RDCDEBUG("Queue Submit no replay %u == %u", m_LastEventID, startEID);
|
||||
}
|
||||
@@ -284,10 +288,10 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
|
||||
|
||||
if(eid == m_PartialReplayData.baseEvent)
|
||||
{
|
||||
ResourceId partial = GetResID(RerecordCmdBuf());
|
||||
ResourceId partial = GetResID(RerecordCmdBuf(cmdIds[c]));
|
||||
RDCDEBUG("Queue Submit partial replay of %llu at %u, using %llu", cmdIds[c], eid, partial);
|
||||
trimmedCmdIds.push_back(partial);
|
||||
trimmedCmds.push_back(Unwrap(RerecordCmdBuf()));
|
||||
trimmedCmds.push_back(Unwrap(RerecordCmdBuf(cmdIds[c])));
|
||||
}
|
||||
else if(m_LastEventID >= end)
|
||||
{
|
||||
@@ -315,8 +319,30 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
|
||||
GetResourceManager()->ApplyBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts);
|
||||
}
|
||||
}
|
||||
else if(m_DrawcallCallback && m_DrawcallCallback->RecordAllCmds())
|
||||
{
|
||||
RDCDEBUG("Queue Submit re-recording from %u", m_RootEventID);
|
||||
|
||||
vector<VkCommandBuffer> rerecordedCmds;
|
||||
|
||||
for(uint32_t c=0; c < numCmds; c++)
|
||||
{
|
||||
VkCommandBuffer cmd = RerecordCmdBuf(cmdIds[c]);
|
||||
ResourceId rerecord = GetResID(cmd);
|
||||
RDCDEBUG("Queue Submit fully re-recorded replay of %llu, using %llu", cmdIds[c], rerecord);
|
||||
rerecordedCmds.push_back(Unwrap(cmd));
|
||||
|
||||
GetResourceManager()->ApplyBarriers(m_BakedCmdBufferInfo[rerecord].imgbarriers, m_ImageLayouts);
|
||||
}
|
||||
|
||||
submitInfo.commandBufferCount = (uint32_t)rerecordedCmds.size();
|
||||
submitInfo.pCommandBuffers = &rerecordedCmds[0];
|
||||
ObjDisp(queue)->QueueSubmit(Unwrap(queue), 1, &submitInfo, Unwrap(fence));
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("Queue Submit full replay %u >= %u", m_LastEventID, m_RootEventID);
|
||||
|
||||
ObjDisp(queue)->QueueSubmit(Unwrap(queue), 1, &submitInfo, Unwrap(fence));
|
||||
|
||||
for(uint32_t i=0; i < numCmds; i++)
|
||||
@@ -346,6 +372,12 @@ void WrappedVulkan::RefreshIDs(vector<DrawcallTreeNode> &nodes, uint32_t baseEve
|
||||
m_Events.push_back(nodes[i].draw.events[e]);
|
||||
}
|
||||
|
||||
DrawcallUse use(m_Events.back().fileOffset, nodes[i].draw.eventID);
|
||||
|
||||
// insert in sorted location
|
||||
auto it = std::lower_bound(m_DrawcallUses.begin(), m_DrawcallUses.end(), use);
|
||||
m_DrawcallUses.insert(it, use);
|
||||
|
||||
RefreshIDs(nodes[i].children, baseEventID, baseDrawID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ bool WrappedVulkan::Serialise_vkCmdSetEvent(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
ObjDisp(cmdBuffer)->CmdSetEvent(Unwrap(cmdBuffer), Unwrap(event), mask);
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,7 @@ bool WrappedVulkan::Serialise_vkCmdResetEvent(
|
||||
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
//ObjDisp(cmdBuffer)->CmdResetEvent(Unwrap(cmdBuffer), Unwrap(event), mask);
|
||||
}
|
||||
}
|
||||
@@ -718,7 +718,7 @@ bool WrappedVulkan::Serialise_vkCmdWaitEvents(
|
||||
{
|
||||
if(ShouldRerecordCmd(cmdid) && InRerecordRange())
|
||||
{
|
||||
cmdBuffer = RerecordCmdBuf();
|
||||
cmdBuffer = RerecordCmdBuf(cmdid);
|
||||
|
||||
VkEventCreateInfo evInfo = {
|
||||
VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, NULL, 0,
|
||||
@@ -736,7 +736,7 @@ bool WrappedVulkan::Serialise_vkCmdWaitEvents(
|
||||
// register to clean this event up once we're done replaying this section of the log
|
||||
m_CleanupEvents.push_back(ev);
|
||||
|
||||
ResourceId cmd = GetResID(RerecordCmdBuf());
|
||||
ResourceId cmd = GetResID(RerecordCmdBuf(cmdid));
|
||||
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts, (uint32_t)imBarriers.size(), &imBarriers[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user