mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 01:16:31 +00:00
Add resettable chunk allocator for recording command buffers
This commit is contained in:
@@ -387,13 +387,6 @@ struct ResourceRecord
|
||||
void Delete(ResourceRecordHandler *mgr);
|
||||
|
||||
ResourceId GetResourceID() const { return ResID; }
|
||||
void RemoveChunk(Chunk *chunk)
|
||||
{
|
||||
LockChunks();
|
||||
m_Chunks.removeOneIf([chunk](const rdcpair<int64_t, Chunk *> &c) { return c.second == chunk; });
|
||||
UnlockChunks();
|
||||
}
|
||||
|
||||
void AddChunk(Chunk *chunk, int64_t ID = 0)
|
||||
{
|
||||
if(ID == 0)
|
||||
@@ -445,7 +438,7 @@ struct ResourceRecord
|
||||
{
|
||||
LockChunks();
|
||||
for(auto it = m_Chunks.begin(); it != m_Chunks.end(); ++it)
|
||||
SAFE_DELETE(it->second);
|
||||
it->second->Delete();
|
||||
m_Chunks.clear();
|
||||
UnlockChunks();
|
||||
}
|
||||
@@ -720,7 +713,7 @@ protected:
|
||||
{
|
||||
if(chunk)
|
||||
{
|
||||
delete chunk;
|
||||
chunk->Delete();
|
||||
chunk = NULL;
|
||||
}
|
||||
|
||||
@@ -984,7 +977,7 @@ void ResourceManager<Configuration>::SetInitialChunk(ResourceId id, Chunk *chunk
|
||||
InitialContentDataOrChunk &data = m_InitialContents[id];
|
||||
|
||||
if(data.chunk)
|
||||
delete data.chunk;
|
||||
data.chunk->Delete();
|
||||
|
||||
data.chunk = chunk;
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ void WrappedID3D11DeviceContext::AttemptCapture()
|
||||
{
|
||||
Chunk *chunk = m_ContextRecord->GetLastChunk();
|
||||
|
||||
SAFE_DELETE(chunk);
|
||||
chunk->Delete();
|
||||
m_ContextRecord->PopChunk();
|
||||
}
|
||||
m_ContextRecord->UnlockChunks();
|
||||
@@ -646,7 +646,7 @@ void WrappedID3D11DeviceContext::CleanupCapture()
|
||||
{
|
||||
Chunk *chunk = m_ContextRecord->GetLastChunk();
|
||||
|
||||
SAFE_DELETE(chunk);
|
||||
chunk->Delete();
|
||||
m_ContextRecord->PopChunk();
|
||||
}
|
||||
m_ContextRecord->UnlockChunks();
|
||||
|
||||
@@ -5445,7 +5445,7 @@ HRESULT WrappedID3D11DeviceContext::FinishCommandList(BOOL RestoreDeferredContex
|
||||
while(m_ContextRecord->HasChunks())
|
||||
{
|
||||
Chunk *chunk = m_ContextRecord->GetLastChunk();
|
||||
SAFE_DELETE(chunk);
|
||||
chunk->Delete();
|
||||
m_ContextRecord->PopChunk();
|
||||
}
|
||||
m_ContextRecord->UnlockChunks();
|
||||
|
||||
@@ -2561,7 +2561,7 @@ void WrappedID3D11Device::SetResourceName(ID3D11DeviceChild *pResource, const ch
|
||||
|
||||
if(end->GetChunkType<D3D11Chunk>() == D3D11Chunk::SetResourceName)
|
||||
{
|
||||
SAFE_DELETE(end);
|
||||
end->Delete();
|
||||
record->PopChunk();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ void WrappedID3D12GraphicsCommandList::AtomicCopyBufferUINT(
|
||||
Serialise_AtomicCopyBufferUINT(ser, pDstBuffer, DstOffset, pSrcBuffer, SrcOffset, Dependencies,
|
||||
ppDependentResources, pDependentSubresourceRanges);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDstBuffer), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrcBuffer), eFrameRef_Read);
|
||||
|
||||
@@ -252,7 +252,7 @@ void WrappedID3D12GraphicsCommandList::AtomicCopyBufferUINT64(
|
||||
Serialise_AtomicCopyBufferUINT64(ser, pDstBuffer, DstOffset, pSrcBuffer, SrcOffset, Dependencies,
|
||||
ppDependentResources, pDependentSubresourceRanges);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDstBuffer), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrcBuffer), eFrameRef_Read);
|
||||
|
||||
@@ -331,7 +331,7 @@ void WrappedID3D12GraphicsCommandList::OMSetDepthBounds(FLOAT Min, FLOAT Max)
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_OMSetDepthBounds);
|
||||
Serialise_OMSetDepthBounds(ser, Min, Max);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ void WrappedID3D12GraphicsCommandList::SetSamplePositions(UINT NumSamplesPerPixe
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetSamplePositions);
|
||||
Serialise_SetSamplePositions(ser, NumSamplesPerPixel, NumPixels, pSamplePositions);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ void WrappedID3D12GraphicsCommandList::ResolveSubresourceRegion(
|
||||
Serialise_ResolveSubresourceRegion(ser, pDstResource, DstSubresource, DstX, DstY, pSrcResource,
|
||||
SrcSubresource, pSrcRect, Format, ResolveMode);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDstResource), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrcResource), eFrameRef_Read);
|
||||
}
|
||||
@@ -583,7 +583,7 @@ void WrappedID3D12GraphicsCommandList::SetViewInstanceMask(UINT Mask)
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetViewInstanceMask);
|
||||
Serialise_SetViewInstanceMask(ser, Mask);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void WrappedID3D12GraphicsCommandList::WriteBufferImmediate(
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_WriteBufferImmediate);
|
||||
Serialise_WriteBufferImmediate(ser, Count, pParams, pModes);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
for(UINT i = 0; i < Count; i++)
|
||||
m_ListRecord->MarkResourceFrameReferenced(
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(pParams[i].Dest), eFrameRef_PartialWrite);
|
||||
|
||||
@@ -289,7 +289,7 @@ void WrappedID3D12GraphicsCommandList::BeginRenderPass(
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_BeginRenderPass);
|
||||
Serialise_BeginRenderPass(ser, NumRenderTargets, pRenderTargets, pDepthStencil, Flags);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
for(UINT i = 0; i < NumRenderTargets; i++)
|
||||
{
|
||||
D3D12Descriptor *desc = GetWrapped(pRenderTargets[i].cpuDescriptor);
|
||||
@@ -412,7 +412,7 @@ void WrappedID3D12GraphicsCommandList::EndRenderPass()
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_EndRenderPass);
|
||||
Serialise_EndRenderPass(ser);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::RSSetShadingRate(
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_RSSetShadingRate);
|
||||
Serialise_RSSetShadingRate(ser, baseShadingRate, combiners);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ WrappedID3D12GraphicsCommandList::RSSetShadingRateImage(ID3D12Resource *shadingR
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_RSSetShadingRateImage);
|
||||
Serialise_RSSetShadingRateImage(ser, shadingRateImage);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(shadingRateImage), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ HRESULT WrappedID3D12GraphicsCommandList::Close()
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_Close);
|
||||
Serialise_Close(ser);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
|
||||
m_ListRecord->Bake();
|
||||
@@ -426,12 +426,14 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat
|
||||
m_ListRecord->bakedCommands->InternalResource = true;
|
||||
m_ListRecord->bakedCommands->cmdInfo = new CmdListRecordingInfo();
|
||||
|
||||
m_ListRecord->cmdInfo->alloc = &((WrappedID3D12CommandAllocator *)pAllocator)->alloc;
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_Reset);
|
||||
Serialise_Reset(ser, pAllocator, pInitialState);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
|
||||
// add allocator and initial state (if there is one) as frame refs. We can't add
|
||||
@@ -597,7 +599,7 @@ void WrappedID3D12GraphicsCommandList::ResourceBarrier(UINT NumBarriers,
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_ResourceBarrier);
|
||||
Serialise_ResourceBarrier(ser, NumBarriers, pBarriers);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
m_ListRecord->cmdInfo->barriers.append(pBarriers, NumBarriers);
|
||||
}
|
||||
@@ -666,7 +668,7 @@ void WrappedID3D12GraphicsCommandList::ClearState(ID3D12PipelineState *pPipeline
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_ClearState);
|
||||
Serialise_ClearState(ser, pPipelineState);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pPipelineState), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -729,7 +731,7 @@ void WrappedID3D12GraphicsCommandList::IASetPrimitiveTopology(D3D12_PRIMITIVE_TO
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_IASetPrimitiveTopology);
|
||||
Serialise_IASetPrimitiveTopology(ser, PrimitiveTopology);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,7 +800,7 @@ void WrappedID3D12GraphicsCommandList::RSSetViewports(UINT NumViewports,
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_RSSetViewports);
|
||||
Serialise_RSSetViewports(ser, NumViewports, pViewports);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,7 +867,7 @@ void WrappedID3D12GraphicsCommandList::RSSetScissorRects(UINT NumRects, const D3
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_RSSetScissorRects);
|
||||
Serialise_RSSetScissorRects(ser, NumRects, pRects);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -924,7 +926,7 @@ void WrappedID3D12GraphicsCommandList::OMSetBlendFactor(const FLOAT BlendFactor[
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_OMSetBlendFactor);
|
||||
Serialise_OMSetBlendFactor(ser, BlendFactor);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -981,7 +983,7 @@ void WrappedID3D12GraphicsCommandList::OMSetStencilRef(UINT StencilRef)
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_OMSetStencilRef);
|
||||
Serialise_OMSetStencilRef(ser, StencilRef);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1060,7 +1062,7 @@ void WrappedID3D12GraphicsCommandList::SetDescriptorHeaps(UINT NumDescriptorHeap
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetDescriptorHeaps);
|
||||
Serialise_SetDescriptorHeaps(ser, NumDescriptorHeaps, ppDescriptorHeaps);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
for(UINT i = 0; i < NumDescriptorHeaps; i++)
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(ppDescriptorHeaps[i]), eFrameRef_Read);
|
||||
}
|
||||
@@ -1138,7 +1140,7 @@ void WrappedID3D12GraphicsCommandList::IASetIndexBuffer(const D3D12_INDEX_BUFFER
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_IASetIndexBuffer);
|
||||
Serialise_IASetIndexBuffer(ser, pView);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
if(pView)
|
||||
m_ListRecord->MarkResourceFrameReferenced(
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(pView->BufferLocation), eFrameRef_Read);
|
||||
@@ -1218,7 +1220,7 @@ void WrappedID3D12GraphicsCommandList::IASetVertexBuffers(UINT StartSlot, UINT N
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_IASetVertexBuffers);
|
||||
Serialise_IASetVertexBuffers(ser, StartSlot, NumViews, pViews);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
for(UINT i = 0; pViews && i < NumViews; i++)
|
||||
m_ListRecord->MarkResourceFrameReferenced(
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read);
|
||||
@@ -1300,7 +1302,7 @@ void WrappedID3D12GraphicsCommandList::SOSetTargets(UINT StartSlot, UINT NumView
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SOSetTargets);
|
||||
Serialise_SOSetTargets(ser, StartSlot, NumViews, pViews);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
for(UINT i = 0; pViews && i < NumViews; i++)
|
||||
m_ListRecord->MarkResourceFrameReferenced(
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read);
|
||||
@@ -1361,7 +1363,7 @@ void WrappedID3D12GraphicsCommandList::SetPipelineState(ID3D12PipelineState *pPi
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetPipelineState);
|
||||
Serialise_SetPipelineState(ser, pPipelineState);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pPipelineState), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -1546,7 +1548,7 @@ void WrappedID3D12GraphicsCommandList::OMSetRenderTargets(
|
||||
Serialise_OMSetRenderTargets(ser, num, pRenderTargetDescriptors,
|
||||
RTsSingleHandleToDescriptorRange, pDepthStencilDescriptor);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
if(RTsSingleHandleToDescriptorRange)
|
||||
{
|
||||
D3D12Descriptor *desc =
|
||||
@@ -1648,7 +1650,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootSignature(ID3D12RootSignatu
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetComputeRootSignature);
|
||||
Serialise_SetComputeRootSignature(ser, pRootSignature);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pRootSignature), eFrameRef_Read);
|
||||
|
||||
// store this so we can look up how many descriptors a given slot references, etc
|
||||
@@ -1721,7 +1723,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootDescriptorTable(
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetComputeRootDescriptorTable);
|
||||
Serialise_SetComputeRootDescriptorTable(ser, RootParameterIndex, BaseDescriptor);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetWrapped(BaseDescriptor)->GetHeapResourceId(),
|
||||
eFrameRef_Read);
|
||||
|
||||
@@ -1830,7 +1832,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRoot32BitConstant(UINT RootPara
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetComputeRoot32BitConstant);
|
||||
Serialise_SetComputeRoot32BitConstant(ser, RootParameterIndex, SrcData, DestOffsetIn32BitValues);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1909,7 +1911,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRoot32BitConstants(UINT RootPar
|
||||
Serialise_SetComputeRoot32BitConstants(ser, RootParameterIndex, Num32BitValuesToSet, pSrcData,
|
||||
DestOffsetIn32BitValues);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1988,7 +1990,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootConstantBufferView(
|
||||
UINT64 offs = 0;
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2068,7 +2070,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootShaderResourceView(
|
||||
UINT64 offs = 0;
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2148,7 +2150,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootUnorderedAccessView(
|
||||
UINT64 offs = 0;
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2224,7 +2226,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootSignature(ID3D12RootSignat
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetGraphicsRootSignature);
|
||||
Serialise_SetGraphicsRootSignature(ser, pRootSignature);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pRootSignature), eFrameRef_Read);
|
||||
|
||||
// store this so we can look up how many descriptors a given slot references, etc
|
||||
@@ -2297,7 +2299,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable(
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetGraphicsRootDescriptorTable);
|
||||
Serialise_SetGraphicsRootDescriptorTable(ser, RootParameterIndex, BaseDescriptor);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetWrapped(BaseDescriptor)->GetHeapResourceId(),
|
||||
eFrameRef_Read);
|
||||
|
||||
@@ -2406,7 +2408,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRoot32BitConstant(UINT RootPar
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetGraphicsRoot32BitConstant);
|
||||
Serialise_SetGraphicsRoot32BitConstant(ser, RootParameterIndex, SrcData, DestOffsetIn32BitValues);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2485,7 +2487,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRoot32BitConstants(UINT RootPa
|
||||
Serialise_SetGraphicsRoot32BitConstants(ser, RootParameterIndex, Num32BitValuesToSet, pSrcData,
|
||||
DestOffsetIn32BitValues);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2564,7 +2566,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootConstantBufferView(
|
||||
UINT64 offs = 0;
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2644,7 +2646,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootShaderResourceView(
|
||||
UINT64 offs = 0;
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2724,7 +2726,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootUnorderedAccessView(
|
||||
UINT64 offs = 0;
|
||||
WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2775,7 +2777,7 @@ void WrappedID3D12GraphicsCommandList::BeginQuery(ID3D12QueryHeap *pQueryHeap,
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_BeginQuery);
|
||||
Serialise_BeginQuery(ser, pQueryHeap, Type, Index);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pQueryHeap), eFrameRef_Read);
|
||||
}
|
||||
@@ -2824,7 +2826,7 @@ void WrappedID3D12GraphicsCommandList::EndQuery(ID3D12QueryHeap *pQueryHeap, D3D
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_EndQuery);
|
||||
Serialise_EndQuery(ser, pQueryHeap, Type, Index);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pQueryHeap), eFrameRef_Read);
|
||||
}
|
||||
@@ -2881,7 +2883,7 @@ void WrappedID3D12GraphicsCommandList::ResolveQueryData(ID3D12QueryHeap *pQueryH
|
||||
Serialise_ResolveQueryData(ser, pQueryHeap, Type, StartIndex, NumQueries, pDestinationBuffer,
|
||||
AlignedDestinationBufferOffset);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pQueryHeap), eFrameRef_Read);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDestinationBuffer), eFrameRef_PartialWrite);
|
||||
@@ -2924,7 +2926,7 @@ void WrappedID3D12GraphicsCommandList::SetPredication(ID3D12Resource *pBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_SetPredication);
|
||||
Serialise_SetPredication(ser, pBuffer, AlignedBufferOffset, Operation);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pBuffer), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2988,7 +2990,7 @@ void WrappedID3D12GraphicsCommandList::SetMarker(UINT Metadata, const void *pDat
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::SetMarker);
|
||||
Serialise_SetMarker(ser, Metadata, pData, Size);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3053,7 +3055,7 @@ void WrappedID3D12GraphicsCommandList::BeginEvent(UINT Metadata, const void *pDa
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::PushMarker);
|
||||
Serialise_BeginEvent(ser, Metadata, pData, Size);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3123,7 +3125,7 @@ void WrappedID3D12GraphicsCommandList::EndEvent()
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::PopMarker);
|
||||
Serialise_EndEvent(ser);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3212,7 +3214,7 @@ void WrappedID3D12GraphicsCommandList::DrawInstanced(UINT VertexCountPerInstance
|
||||
Serialise_DrawInstanced(ser, VertexCountPerInstance, InstanceCount, StartVertexLocation,
|
||||
StartInstanceLocation);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3300,7 +3302,7 @@ void WrappedID3D12GraphicsCommandList::DrawIndexedInstanced(UINT IndexCountPerIn
|
||||
Serialise_DrawIndexedInstanced(ser, IndexCountPerInstance, InstanceCount, StartIndexLocation,
|
||||
BaseVertexLocation, StartInstanceLocation);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3373,7 +3375,7 @@ void WrappedID3D12GraphicsCommandList::Dispatch(UINT ThreadGroupCountX, UINT Thr
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_Dispatch);
|
||||
Serialise_Dispatch(ser, ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3441,7 +3443,7 @@ void WrappedID3D12GraphicsCommandList::ExecuteBundle(ID3D12GraphicsCommandList *
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_ExecuteBundle);
|
||||
Serialise_ExecuteBundle(ser, pCommandList);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
D3D12ResourceRecord *record = GetRecord(pCommandList);
|
||||
|
||||
@@ -4438,7 +4440,7 @@ void WrappedID3D12GraphicsCommandList::ExecuteIndirect(ID3D12CommandSignature *p
|
||||
Serialise_ExecuteIndirect(ser, pCommandSignature, MaxCommandCount, pArgumentBuffer,
|
||||
ArgumentBufferOffset, pCountBuffer, CountBufferOffset);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
m_ListRecord->ContainsExecuteIndirect = true;
|
||||
|
||||
@@ -4540,7 +4542,7 @@ void WrappedID3D12GraphicsCommandList::ClearDepthStencilView(
|
||||
Serialise_ClearDepthStencilView(ser, DepthStencilView, ClearFlags, Depth, Stencil, NumRects,
|
||||
pRects);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
{
|
||||
D3D12Descriptor *desc = GetWrapped(DepthStencilView);
|
||||
@@ -4632,7 +4634,7 @@ void WrappedID3D12GraphicsCommandList::ClearRenderTargetView(
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_ClearRenderTargetView);
|
||||
Serialise_ClearRenderTargetView(ser, RenderTargetView, ColorRGBA, NumRects, pRects);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
{
|
||||
D3D12Descriptor *desc = GetWrapped(RenderTargetView);
|
||||
@@ -4732,7 +4734,7 @@ void WrappedID3D12GraphicsCommandList::ClearUnorderedAccessViewUint(
|
||||
Serialise_ClearUnorderedAccessViewUint(ser, ViewGPUHandleInCurrentHeap, ViewCPUHandle,
|
||||
pResource, Values, NumRects, pRects);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
{
|
||||
D3D12Descriptor *desc = GetWrapped(ViewGPUHandleInCurrentHeap);
|
||||
@@ -4838,7 +4840,7 @@ void WrappedID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat(
|
||||
Serialise_ClearUnorderedAccessViewFloat(ser, ViewGPUHandleInCurrentHeap, ViewCPUHandle,
|
||||
pResource, Values, NumRects, pRects);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
|
||||
{
|
||||
D3D12Descriptor *desc = GetWrapped(ViewGPUHandleInCurrentHeap);
|
||||
@@ -4924,7 +4926,7 @@ void WrappedID3D12GraphicsCommandList::DiscardResource(ID3D12Resource *pResource
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_DiscardResource);
|
||||
Serialise_DiscardResource(ser, pResource, pRegion);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pResource), eFrameRef_PartialWrite);
|
||||
}
|
||||
}
|
||||
@@ -5020,7 +5022,7 @@ void WrappedID3D12GraphicsCommandList::CopyBufferRegion(ID3D12Resource *pDstBuff
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_CopyBufferRegion);
|
||||
Serialise_CopyBufferRegion(ser, pDstBuffer, DstOffset, pSrcBuffer, SrcOffset, NumBytes);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDstBuffer), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrcBuffer), eFrameRef_Read);
|
||||
}
|
||||
@@ -5139,7 +5141,7 @@ void WrappedID3D12GraphicsCommandList::CopyTextureRegion(const D3D12_TEXTURE_COP
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_CopyTextureRegion);
|
||||
Serialise_CopyTextureRegion(ser, pDst, DstX, DstY, DstZ, pSrc, pSrcBox);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDst->pResource), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrc->pResource), eFrameRef_Read);
|
||||
}
|
||||
@@ -5222,7 +5224,7 @@ void WrappedID3D12GraphicsCommandList::CopyResource(ID3D12Resource *pDstResource
|
||||
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_CopyResource);
|
||||
Serialise_CopyResource(ser, pDstResource, pSrcResource);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDstResource), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrcResource), eFrameRef_Read);
|
||||
}
|
||||
@@ -5322,7 +5324,7 @@ void WrappedID3D12GraphicsCommandList::ResolveSubresource(ID3D12Resource *pDstRe
|
||||
Serialise_ResolveSubresource(ser, pDstResource, DstSubresource, pSrcResource, SrcSubresource,
|
||||
Format);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pDstResource), eFrameRef_PartialWrite);
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pSrcResource), eFrameRef_Read);
|
||||
}
|
||||
|
||||
@@ -2149,7 +2149,8 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
|
||||
RenderDoc::Inst().FinishCaptureWriting(rdc, m_CapturedFrames.back().frameNumber);
|
||||
|
||||
SAFE_DELETE(m_HeaderChunk);
|
||||
m_HeaderChunk->Delete();
|
||||
m_HeaderChunk = NULL;
|
||||
|
||||
for(auto it = queues.begin(); it != queues.end(); ++it)
|
||||
(*it)->ClearAfterCapture();
|
||||
@@ -2200,7 +2201,8 @@ bool WrappedID3D12Device::DiscardFrameCapture(void *dev, void *wnd)
|
||||
queues = m_Queues;
|
||||
}
|
||||
|
||||
SAFE_DELETE(m_HeaderChunk);
|
||||
m_HeaderChunk->Delete();
|
||||
m_HeaderChunk = NULL;
|
||||
|
||||
for(auto it = queues.begin(); it != queues.end(); ++it)
|
||||
(*it)->ClearAfterCapture();
|
||||
@@ -2551,7 +2553,7 @@ void WrappedID3D12Device::SetName(ID3D12DeviceChild *pResource, const char *Name
|
||||
|
||||
if(end->GetChunkType<D3D12Chunk>() == D3D12Chunk::SetName)
|
||||
{
|
||||
SAFE_DELETE(end);
|
||||
end->Delete();
|
||||
record->PopChunk();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -418,6 +418,8 @@ struct D3D12ResourceRecord;
|
||||
|
||||
struct CmdListRecordingInfo
|
||||
{
|
||||
ChunkAllocator *alloc;
|
||||
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
// a list of all resources dirtied by this command list
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "driver/shaders/dxbc/dxbc_container.h"
|
||||
#include "serialise/serialiser.h"
|
||||
#include "d3d12_device.h"
|
||||
#include "d3d12_manager.h"
|
||||
|
||||
@@ -350,7 +351,11 @@ public:
|
||||
class WrappedID3D12CommandAllocator : public WrappedDeviceChild12<ID3D12CommandAllocator>
|
||||
{
|
||||
public:
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12CommandAllocator);
|
||||
static const int AllocPoolCount = 8192;
|
||||
static const int AllocMaxByteSize = 192 * 8192;
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12CommandAllocator, AllocPoolCount, AllocMaxByteSize);
|
||||
|
||||
ChunkAllocator alloc;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -358,14 +363,18 @@ public:
|
||||
};
|
||||
|
||||
WrappedID3D12CommandAllocator(ID3D12CommandAllocator *real, WrappedID3D12Device *device)
|
||||
: WrappedDeviceChild12(real, device)
|
||||
: WrappedDeviceChild12(real, device), alloc(32 * 1024)
|
||||
{
|
||||
}
|
||||
virtual ~WrappedID3D12CommandAllocator() { Shutdown(); }
|
||||
//////////////////////////////
|
||||
// implement ID3D12CommandAllocator
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Reset() { return m_pReal->Reset(); }
|
||||
virtual HRESULT STDMETHODCALLTYPE Reset()
|
||||
{
|
||||
alloc.Reset();
|
||||
return m_pReal->Reset();
|
||||
}
|
||||
};
|
||||
|
||||
class WrappedID3D12CommandSignature : public WrappedDeviceChild12<ID3D12CommandSignature>
|
||||
|
||||
@@ -2707,7 +2707,7 @@ void WrappedOpenGL::CleanupResourceRecord(GLResourceRecord *record, bool freePar
|
||||
{
|
||||
Chunk *chunk = record->GetLastChunk();
|
||||
|
||||
SAFE_DELETE(chunk);
|
||||
chunk->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
record->UnlockChunks();
|
||||
|
||||
@@ -325,7 +325,7 @@ void WrappedOpenGL::glBindBuffer(GLenum target, GLuint buffer)
|
||||
if(end->GetChunkType<GLChunk>() == GLChunk::glBindBuffer ||
|
||||
end->GetChunkType<GLChunk>() == GLChunk::glBindBufferARB)
|
||||
{
|
||||
SAFE_DELETE(end);
|
||||
end->Delete();
|
||||
|
||||
r->PopChunk();
|
||||
|
||||
@@ -662,21 +662,21 @@ void WrappedOpenGL::glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const v
|
||||
while(record->NumChunks() > 2)
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
c->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int64_t id2 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
c->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int64_t id1 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
c->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
@@ -814,21 +814,21 @@ void WrappedOpenGL::glBufferData(GLenum target, GLsizeiptr size, const void *dat
|
||||
while(record->NumChunks() > 2)
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
c->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int64_t id2 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
c->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int64_t id1 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
c->Delete();
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
|
||||
@@ -2052,7 +2052,8 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd)
|
||||
|
||||
RenderDoc::Inst().FinishCaptureWriting(rdc, m_CapturedFrames.back().frameNumber);
|
||||
|
||||
SAFE_DELETE(m_HeaderChunk);
|
||||
m_HeaderChunk->Delete();
|
||||
m_HeaderChunk = NULL;
|
||||
|
||||
m_State = CaptureState::BackgroundCapturing;
|
||||
|
||||
@@ -2115,7 +2116,8 @@ bool WrappedVulkan::DiscardFrameCapture(void *dev, void *wnd)
|
||||
|
||||
Atomic::Inc32(&m_ReuseEnabled);
|
||||
|
||||
SAFE_DELETE(m_HeaderChunk);
|
||||
m_HeaderChunk->Delete();
|
||||
m_HeaderChunk = NULL;
|
||||
|
||||
// delete cmd buffers now - had to keep them alive until after serialiser flush.
|
||||
for(size_t i = 0; i < m_CmdBufferRecords.size(); i++)
|
||||
|
||||
@@ -3765,6 +3765,9 @@ VkResourceRecord::~VkResourceRecord()
|
||||
|
||||
if(resType == eResDescUpdateTemplate)
|
||||
SAFE_DELETE(descTemplateInfo);
|
||||
|
||||
if(resType == eResCommandPool)
|
||||
SAFE_DELETE(cmdPoolInfo);
|
||||
}
|
||||
|
||||
void VkResourceRecord::MarkImageFrameReferenced(VkResourceRecord *img, const ImageRange &range,
|
||||
|
||||
@@ -1014,6 +1014,8 @@ struct CmdBufferRecordingInfo
|
||||
VkDevice device;
|
||||
VkCommandBufferAllocateInfo allocInfo;
|
||||
|
||||
ChunkAllocator *alloc = NULL;
|
||||
|
||||
VkResourceRecord *framebuffer = NULL;
|
||||
VkResourceRecord *allocRecord = NULL;
|
||||
|
||||
@@ -1083,6 +1085,13 @@ struct DescPoolInfo
|
||||
rdcarray<VkResourceRecord *> freelist;
|
||||
};
|
||||
|
||||
struct CmdPoolInfo
|
||||
{
|
||||
CmdPoolInfo() : alloc(32 * 1024) {}
|
||||
uint32_t queueFamilyIndex;
|
||||
ChunkAllocator alloc;
|
||||
};
|
||||
|
||||
struct MemMapState
|
||||
{
|
||||
VkBuffer wholeMemBuf = VK_NULL_HANDLE;
|
||||
@@ -2284,7 +2293,8 @@ public:
|
||||
DescriptorSetData *descInfo; // only for descriptor sets and descriptor set layouts
|
||||
DescUpdateTemplate *descTemplateInfo; // only for descriptor update templates
|
||||
DescPoolInfo *descPoolInfo; // only for descriptor pools
|
||||
uint32_t queueFamilyIndex; // only for queues and command pools
|
||||
CmdPoolInfo *cmdPoolInfo; // only for command pools
|
||||
uint32_t queueFamilyIndex; // only for queues
|
||||
};
|
||||
|
||||
VkResourceRecord *bakedCommands;
|
||||
|
||||
@@ -524,7 +524,8 @@ VkResult WrappedVulkan::vkCreateCommandPool(VkDevice device,
|
||||
}
|
||||
|
||||
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pCmdPool);
|
||||
record->queueFamilyIndex = pCreateInfo->queueFamilyIndex;
|
||||
record->cmdPoolInfo = new CmdPoolInfo;
|
||||
record->cmdPoolInfo->queueFamilyIndex = pCreateInfo->queueFamilyIndex;
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
@@ -680,6 +681,7 @@ VkResult WrappedVulkan::vkAllocateCommandBuffers(VkDevice device,
|
||||
record->cmdInfo->allocInfo.commandBufferCount = 1;
|
||||
record->cmdInfo->allocRecord = allocRecord;
|
||||
record->cmdInfo->present = false;
|
||||
record->cmdInfo->alloc = &record->pool->cmdPoolInfo->alloc;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1021,7 +1023,7 @@ VkResult WrappedVulkan::vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkBeginCommandBuffer);
|
||||
Serialise_vkBeginCommandBuffer(ser, commandBuffer, pBeginInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
|
||||
if(pBeginInfo->pInheritanceInfo)
|
||||
@@ -1220,7 +1222,7 @@ VkResult WrappedVulkan::vkEndCommandBuffer(VkCommandBuffer commandBuffer)
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkEndCommandBuffer);
|
||||
Serialise_vkEndCommandBuffer(ser, commandBuffer);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
|
||||
record->Bake();
|
||||
@@ -1550,7 +1552,7 @@ void WrappedVulkan::vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBeginRenderPass);
|
||||
Serialise_vkCmdBeginRenderPass(ser, commandBuffer, pRenderPassBegin, contents);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(pRenderPassBegin->renderPass), eFrameRef_Read);
|
||||
|
||||
VkResourceRecord *fb = GetRecord(pRenderPassBegin->framebuffer);
|
||||
@@ -1716,7 +1718,7 @@ void WrappedVulkan::vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassCon
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdNextSubpass);
|
||||
Serialise_vkCmdNextSubpass(ser, commandBuffer, contents);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1848,12 +1850,13 @@ void WrappedVulkan::vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdEndRenderPass);
|
||||
Serialise_vkCmdEndRenderPass(ser, commandBuffer);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
const rdcarray<VkImageMemoryBarrier> &barriers = record->cmdInfo->rpbarriers;
|
||||
|
||||
// apply the implicit layout transitions here
|
||||
GetResourceManager()->RecordBarriers(record->cmdInfo->imageStates, record->pool->queueFamilyIndex,
|
||||
GetResourceManager()->RecordBarriers(record->cmdInfo->imageStates,
|
||||
record->pool->cmdPoolInfo->queueFamilyIndex,
|
||||
(uint32_t)barriers.size(), barriers.data());
|
||||
}
|
||||
}
|
||||
@@ -2160,7 +2163,7 @@ void WrappedVulkan::vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBeginRenderPass2);
|
||||
Serialise_vkCmdBeginRenderPass2(ser, commandBuffer, pRenderPassBegin, pSubpassBeginInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(pRenderPassBegin->renderPass), eFrameRef_Read);
|
||||
|
||||
VkResourceRecord *fb = GetRecord(pRenderPassBegin->framebuffer);
|
||||
@@ -2352,7 +2355,7 @@ void WrappedVulkan::vkCmdNextSubpass2(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdNextSubpass2);
|
||||
Serialise_vkCmdNextSubpass2(ser, commandBuffer, pSubpassBeginInfo, pSubpassEndInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2490,12 +2493,13 @@ void WrappedVulkan::vkCmdEndRenderPass2(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdEndRenderPass2);
|
||||
Serialise_vkCmdEndRenderPass2(ser, commandBuffer, pSubpassEndInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
const rdcarray<VkImageMemoryBarrier> &barriers = record->cmdInfo->rpbarriers;
|
||||
|
||||
// apply the implicit layout transitions here
|
||||
GetResourceManager()->RecordBarriers(record->cmdInfo->imageStates, record->pool->queueFamilyIndex,
|
||||
GetResourceManager()->RecordBarriers(record->cmdInfo->imageStates,
|
||||
record->pool->cmdPoolInfo->queueFamilyIndex,
|
||||
(uint32_t)barriers.size(), barriers.data());
|
||||
}
|
||||
}
|
||||
@@ -2716,7 +2720,7 @@ void WrappedVulkan::vkCmdBindPipeline(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBindPipeline);
|
||||
Serialise_vkCmdBindPipeline(ser, commandBuffer, pipelineBindPoint, pipeline);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(pipeline), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -2875,7 +2879,7 @@ void WrappedVulkan::vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer,
|
||||
Serialise_vkCmdBindDescriptorSets(ser, commandBuffer, pipelineBindPoint, layout, firstSet,
|
||||
setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(layout), eFrameRef_Read);
|
||||
record->cmdInfo->boundDescSets.insert(pDescriptorSets, pDescriptorSets + setCount);
|
||||
}
|
||||
@@ -2964,7 +2968,7 @@ void WrappedVulkan::vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32
|
||||
Serialise_vkCmdBindVertexBuffers(ser, commandBuffer, firstBinding, bindingCount, pBuffers,
|
||||
pOffsets);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < bindingCount; i++)
|
||||
{
|
||||
// binding NULL is legal with robustness2
|
||||
@@ -3068,7 +3072,7 @@ void WrappedVulkan::vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, ui
|
||||
Serialise_vkCmdBindVertexBuffers2EXT(ser, commandBuffer, firstBinding, bindingCount, pBuffers,
|
||||
pOffsets, pSizes, pStrides);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < bindingCount; i++)
|
||||
{
|
||||
// binding NULL is legal with robustness2
|
||||
@@ -3157,7 +3161,7 @@ void WrappedVulkan::vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBindIndexBuffer);
|
||||
Serialise_vkCmdBindIndexBuffer(ser, commandBuffer, buffer, offset, indexType);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkBufferFrameReferenced(GetRecord(buffer), 0, VK_WHOLE_SIZE, eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -3221,7 +3225,7 @@ void WrappedVulkan::vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer de
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdUpdateBuffer);
|
||||
Serialise_vkCmdUpdateBuffer(ser, commandBuffer, destBuffer, destOffset, dataSize, pData);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(destBuffer), destOffset, dataSize,
|
||||
eFrameRef_CompleteWrite);
|
||||
@@ -3298,7 +3302,7 @@ void WrappedVulkan::vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipeline
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdPushConstants);
|
||||
Serialise_vkCmdPushConstants(ser, commandBuffer, layout, stageFlags, start, length, values);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(layout), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -3494,13 +3498,13 @@ void WrappedVulkan::vkCmdPipelineBarrier(
|
||||
pBufferMemoryBarriers, imageMemoryBarrierCount,
|
||||
pImageMemoryBarriers);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
if(imageMemoryBarrierCount > 0)
|
||||
{
|
||||
GetResourceManager()->RecordBarriers(record->cmdInfo->imageStates,
|
||||
record->pool->queueFamilyIndex, imageMemoryBarrierCount,
|
||||
pImageMemoryBarriers);
|
||||
record->pool->cmdPoolInfo->queueFamilyIndex,
|
||||
imageMemoryBarrierCount, pImageMemoryBarriers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3560,7 +3564,7 @@ void WrappedVulkan::vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdWriteTimestamp);
|
||||
Serialise_vkCmdWriteTimestamp(ser, commandBuffer, pipelineStage, queryPool, query);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
}
|
||||
@@ -3630,7 +3634,7 @@ void WrappedVulkan::vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQ
|
||||
Serialise_vkCmdCopyQueryPoolResults(ser, commandBuffer, queryPool, firstQuery, queryCount,
|
||||
destBuffer, destOffset, destStride, flags);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
|
||||
@@ -3694,7 +3698,7 @@ void WrappedVulkan::vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool q
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBeginQuery);
|
||||
Serialise_vkCmdBeginQuery(ser, commandBuffer, queryPool, query, flags);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -3746,7 +3750,7 @@ void WrappedVulkan::vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool que
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdEndQuery);
|
||||
Serialise_vkCmdEndQuery(ser, commandBuffer, queryPool, query);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -3807,7 +3811,7 @@ void WrappedVulkan::vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPo
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdResetQueryPool);
|
||||
Serialise_vkCmdResetQueryPool(ser, commandBuffer, queryPool, firstQuery, queryCount);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -4139,7 +4143,7 @@ void WrappedVulkan::vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdExecuteCommands);
|
||||
Serialise_vkCmdExecuteCommands(ser, commandBuffer, commandBufferCount, pCommandBuffers);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
for(uint32_t i = 0; i < commandBufferCount; i++)
|
||||
{
|
||||
@@ -4224,7 +4228,7 @@ void WrappedVulkan::vkCmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDebugMarkerBeginEXT);
|
||||
Serialise_vkCmdDebugMarkerBeginEXT(ser, commandBuffer, pMarker);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4297,7 +4301,7 @@ void WrappedVulkan::vkCmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer)
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDebugMarkerEndEXT);
|
||||
Serialise_vkCmdDebugMarkerEndEXT(ser, commandBuffer);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4375,7 +4379,7 @@ void WrappedVulkan::vkCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDebugMarkerInsertEXT);
|
||||
Serialise_vkCmdDebugMarkerInsertEXT(ser, commandBuffer, pMarker);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4713,7 +4717,7 @@ void WrappedVulkan::vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer,
|
||||
Serialise_vkCmdPushDescriptorSetKHR(ser, commandBuffer, pipelineBindPoint, layout, set,
|
||||
descriptorWriteCount, pDescriptorWrites);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < descriptorWriteCount; i++)
|
||||
{
|
||||
const VkWriteDescriptorSet &write = pDescriptorWrites[i];
|
||||
@@ -4997,7 +5001,7 @@ void WrappedVulkan::vkCmdPushDescriptorSetWithTemplateKHR(
|
||||
Serialise_vkCmdPushDescriptorSetWithTemplateKHR(ser, commandBuffer, descriptorUpdateTemplate,
|
||||
layout, set, pData);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(descriptorUpdateTemplate), eFrameRef_Read);
|
||||
for(size_t i = 0; i < frameRefs.size(); i++)
|
||||
record->MarkResourceFrameReferenced(frameRefs[i].first, frameRefs[i].second);
|
||||
@@ -5077,7 +5081,7 @@ void WrappedVulkan::vkCmdWriteBufferMarkerAMD(VkCommandBuffer commandBuffer,
|
||||
Serialise_vkCmdWriteBufferMarkerAMD(ser, commandBuffer, pipelineStage, dstBuffer, dstOffset,
|
||||
marker);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(dstBuffer), dstOffset, 4, eFrameRef_PartialWrite);
|
||||
}
|
||||
@@ -5149,7 +5153,7 @@ void WrappedVulkan::vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBeginDebugUtilsLabelEXT);
|
||||
Serialise_vkCmdBeginDebugUtilsLabelEXT(ser, commandBuffer, pLabelInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5222,7 +5226,7 @@ void WrappedVulkan::vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer)
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdEndDebugUtilsLabelEXT);
|
||||
Serialise_vkCmdEndDebugUtilsLabelEXT(ser, commandBuffer);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5290,7 +5294,7 @@ void WrappedVulkan::vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdInsertDebugUtilsLabelEXT);
|
||||
Serialise_vkCmdInsertDebugUtilsLabelEXT(ser, commandBuffer, pLabelInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5341,7 +5345,7 @@ void WrappedVulkan::vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t d
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDeviceMask);
|
||||
Serialise_vkCmdSetDeviceMask(ser, commandBuffer, deviceMask);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5431,7 +5435,7 @@ void WrappedVulkan::vkCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer command
|
||||
Serialise_vkCmdBindTransformFeedbackBuffersEXT(ser, commandBuffer, firstBinding, bindingCount,
|
||||
pBuffers, pOffsets, pSizes);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < bindingCount; i++)
|
||||
{
|
||||
VkDeviceSize size = VK_WHOLE_SIZE;
|
||||
@@ -5527,7 +5531,7 @@ void WrappedVulkan::vkCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer
|
||||
Serialise_vkCmdBeginTransformFeedbackEXT(ser, commandBuffer, firstBuffer, bufferCount,
|
||||
pCounterBuffers, pCounterBufferOffsets);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < bufferCount; i++)
|
||||
{
|
||||
if(pCounterBuffers && pCounterBuffers[i] != VK_NULL_HANDLE)
|
||||
@@ -5615,7 +5619,7 @@ void WrappedVulkan::vkCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer,
|
||||
Serialise_vkCmdEndTransformFeedbackEXT(ser, commandBuffer, firstBuffer, bufferCount,
|
||||
pCounterBuffers, pCounterBufferOffsets);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < bufferCount; i++)
|
||||
{
|
||||
if(pCounterBuffers && pCounterBuffers[i] != VK_NULL_HANDLE)
|
||||
@@ -5683,7 +5687,7 @@ void WrappedVulkan::vkCmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQ
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBeginQueryIndexedEXT);
|
||||
Serialise_vkCmdBeginQueryIndexedEXT(ser, commandBuffer, queryPool, query, flags, index);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -5741,7 +5745,7 @@ void WrappedVulkan::vkCmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQue
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdEndQueryIndexedEXT);
|
||||
Serialise_vkCmdEndQueryIndexedEXT(ser, commandBuffer, queryPool, query, index);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(queryPool), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -5812,7 +5816,7 @@ void WrappedVulkan::vkCmdBeginConditionalRenderingEXT(
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBeginConditionalRenderingEXT);
|
||||
Serialise_vkCmdBeginConditionalRenderingEXT(ser, commandBuffer, pConditionalRenderingBegin);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
VkResourceRecord *buf = GetRecord(pConditionalRenderingBegin->buffer);
|
||||
|
||||
@@ -5873,7 +5877,7 @@ void WrappedVulkan::vkCmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffe
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdEndConditionalRenderingEXT);
|
||||
Serialise_vkCmdEndConditionalRenderingEXT(ser, commandBuffer);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ void WrappedVulkan::vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCoun
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDraw);
|
||||
Serialise_vkCmdDraw(ser, commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ void WrappedVulkan::vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t ind
|
||||
Serialise_vkCmdDrawIndexed(ser, commandBuffer, indexCount, instanceCount, firstIndex,
|
||||
vertexOffset, firstInstance);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ void WrappedVulkan::vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer bu
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDrawIndirect);
|
||||
Serialise_vkCmdDrawIndirect(ser, commandBuffer, buffer, offset, count, stride);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
VkDeviceSize size = 0;
|
||||
if(count > 0)
|
||||
@@ -1131,7 +1131,7 @@ void WrappedVulkan::vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBu
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDrawIndexedIndirect);
|
||||
Serialise_vkCmdDrawIndexedIndirect(ser, commandBuffer, buffer, offset, count, stride);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
VkDeviceSize size = 0;
|
||||
if(count > 0)
|
||||
@@ -1215,7 +1215,7 @@ void WrappedVulkan::vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uin
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDispatch);
|
||||
Serialise_vkCmdDispatch(ser, commandBuffer, x, y, z);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,7 +1304,7 @@ void WrappedVulkan::vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffe
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdDispatchIndirect);
|
||||
Serialise_vkCmdDispatchIndirect(ser, commandBuffer, buffer, offset);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(buffer), offset, sizeof(VkDispatchIndirectCommand),
|
||||
eFrameRef_Read);
|
||||
@@ -1431,7 +1431,7 @@ void WrappedVulkan::vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcIma
|
||||
Serialise_vkCmdBlitImage(ser, commandBuffer, srcImage, srcImageLayout, destImage,
|
||||
destImageLayout, regionCount, pRegions, filter);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
for(uint32_t i = 0; i < regionCount; i++)
|
||||
{
|
||||
@@ -1580,7 +1580,7 @@ void WrappedVulkan::vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage src
|
||||
Serialise_vkCmdResolveImage(ser, commandBuffer, srcImage, srcImageLayout, destImage,
|
||||
destImageLayout, regionCount, pRegions);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
for(uint32_t i = 0; i < regionCount; i++)
|
||||
{
|
||||
@@ -1718,7 +1718,7 @@ void WrappedVulkan::vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcIma
|
||||
Serialise_vkCmdCopyImage(ser, commandBuffer, srcImage, srcImageLayout, destImage,
|
||||
destImageLayout, regionCount, pRegions);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < regionCount; i++)
|
||||
{
|
||||
const VkImageCopy ®ion = pRegions[i];
|
||||
@@ -1841,7 +1841,7 @@ void WrappedVulkan::vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuff
|
||||
Serialise_vkCmdCopyBufferToImage(ser, commandBuffer, srcBuffer, destImage, destImageLayout,
|
||||
regionCount, pRegions);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkBufferImageCopyFrameReferenced(GetRecord(srcBuffer), GetRecord(destImage),
|
||||
regionCount, pRegions, eFrameRef_Read,
|
||||
eFrameRef_CompleteWrite);
|
||||
@@ -1954,7 +1954,7 @@ void WrappedVulkan::vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImag
|
||||
Serialise_vkCmdCopyImageToBuffer(ser, commandBuffer, srcImage, srcImageLayout, destBuffer,
|
||||
regionCount, pRegions);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkBufferImageCopyFrameReferenced(GetRecord(destBuffer), GetRecord(srcImage),
|
||||
regionCount, pRegions, eFrameRef_CompleteWrite,
|
||||
eFrameRef_Read);
|
||||
@@ -2067,7 +2067,7 @@ void WrappedVulkan::vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcB
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdCopyBuffer);
|
||||
Serialise_vkCmdCopyBuffer(ser, commandBuffer, srcBuffer, destBuffer, regionCount, pRegions);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < regionCount; i++)
|
||||
{
|
||||
record->MarkBufferFrameReferenced(GetRecord(srcBuffer), pRegions[i].srcOffset,
|
||||
@@ -2164,7 +2164,7 @@ void WrappedVulkan::vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dest
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdFillBuffer);
|
||||
Serialise_vkCmdFillBuffer(ser, commandBuffer, destBuffer, destOffset, fillSize, data);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(destBuffer), destOffset, fillSize,
|
||||
eFrameRef_CompleteWrite);
|
||||
@@ -2273,7 +2273,7 @@ void WrappedVulkan::vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage
|
||||
Serialise_vkCmdClearColorImage(ser, commandBuffer, image, imageLayout, pColor, rangeCount,
|
||||
pRanges);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetRecord(image)->baseResource, eFrameRef_Read);
|
||||
VkResourceRecord *imageRecord = GetRecord(image);
|
||||
if(imageRecord->resInfo && imageRecord->resInfo->IsSparse())
|
||||
@@ -2390,7 +2390,7 @@ void WrappedVulkan::vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, V
|
||||
Serialise_vkCmdClearDepthStencilImage(ser, commandBuffer, image, imageLayout, pDepthStencil,
|
||||
rangeCount, pRanges);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(image), eFrameRef_PartialWrite);
|
||||
record->MarkResourceFrameReferenced(GetRecord(image)->baseResource, eFrameRef_Read);
|
||||
VkResourceRecord *imageRecord = GetRecord(image);
|
||||
@@ -2544,7 +2544,7 @@ void WrappedVulkan::vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_
|
||||
Serialise_vkCmdClearAttachments(ser, commandBuffer, attachmentCount, pAttachments, rectCount,
|
||||
pRects);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
// image/attachments are referenced when the render pass is started and the framebuffer is
|
||||
// bound.
|
||||
@@ -2644,7 +2644,7 @@ void WrappedVulkan::vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t ba
|
||||
Serialise_vkCmdDispatchBase(ser, commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX,
|
||||
groupCountY, groupCountZ);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2955,7 +2955,7 @@ void WrappedVulkan::vkCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuff
|
||||
Serialise_vkCmdDrawIndirectCount(ser, commandBuffer, buffer, offset, countBuffer,
|
||||
countBufferOffset, maxDrawCount, stride);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(buffer), offset,
|
||||
stride * (maxDrawCount - 1) + sizeof(VkDrawIndirectCommand),
|
||||
@@ -3273,7 +3273,7 @@ void WrappedVulkan::vkCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer,
|
||||
Serialise_vkCmdDrawIndexedIndirectCount(ser, commandBuffer, buffer, offset, countBuffer,
|
||||
countBufferOffset, maxDrawCount, stride);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(buffer), offset,
|
||||
stride * (maxDrawCount - 1) + sizeof(VkDrawIndirectCommand),
|
||||
@@ -3401,7 +3401,7 @@ void WrappedVulkan::vkCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer,
|
||||
counterBuffer, counterBufferOffset, counterOffset,
|
||||
vertexStride);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
|
||||
record->MarkBufferFrameReferenced(GetRecord(counterBuffer), counterBufferOffset, 4,
|
||||
eFrameRef_Read);
|
||||
|
||||
@@ -89,7 +89,7 @@ void WrappedVulkan::vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t fir
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetViewport);
|
||||
Serialise_vkCmdSetViewport(ser, commandBuffer, firstViewport, viewportCount, pViewports);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void WrappedVulkan::vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetViewportWithCountEXT);
|
||||
Serialise_vkCmdSetViewportWithCountEXT(ser, commandBuffer, viewportCount, pViewports);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ void WrappedVulkan::vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firs
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetScissor);
|
||||
Serialise_vkCmdSetScissor(ser, commandBuffer, firstScissor, scissorCount, pScissors);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void WrappedVulkan::vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetScissorWithCountEXT);
|
||||
Serialise_vkCmdSetScissorWithCountEXT(ser, commandBuffer, scissorCount, pScissors);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void WrappedVulkan::vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineW
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetLineWidth);
|
||||
Serialise_vkCmdSetLineWidth(ser, commandBuffer, lineWidth);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ void WrappedVulkan::vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depth
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDepthBias);
|
||||
Serialise_vkCmdSetDepthBias(ser, commandBuffer, depthBias, depthBiasClamp, slopeScaledDepthBias);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ void WrappedVulkan::vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetBlendConstants);
|
||||
Serialise_vkCmdSetBlendConstants(ser, commandBuffer, blendConst);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ void WrappedVulkan::vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float min
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDepthBounds);
|
||||
Serialise_vkCmdSetDepthBounds(ser, commandBuffer, minDepthBounds, maxDepthBounds);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ void WrappedVulkan::vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetStencilCompareMask);
|
||||
Serialise_vkCmdSetStencilCompareMask(ser, commandBuffer, faceMask, compareMask);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@ void WrappedVulkan::vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetStencilWriteMask);
|
||||
Serialise_vkCmdSetStencilWriteMask(ser, commandBuffer, faceMask, writeMask);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ void WrappedVulkan::vkCmdSetStencilReference(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetStencilReference);
|
||||
Serialise_vkCmdSetStencilReference(ser, commandBuffer, faceMask, reference);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ void WrappedVulkan::vkCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetSampleLocationsEXT);
|
||||
Serialise_vkCmdSetSampleLocationsEXT(ser, commandBuffer, pSampleLocationsInfo);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ void WrappedVulkan::vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer,
|
||||
Serialise_vkCmdSetDiscardRectangleEXT(ser, commandBuffer, firstDiscardRectangle,
|
||||
discardRectangleCount, pDiscardRectangles);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,7 +932,7 @@ void WrappedVulkan::vkCmdSetLineStippleEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetLineStippleEXT);
|
||||
Serialise_vkCmdSetLineStippleEXT(ser, commandBuffer, lineStippleFactor, lineStipplePattern);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,7 +990,7 @@ void WrappedVulkan::vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullMod
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetCullModeEXT);
|
||||
Serialise_vkCmdSetCullModeEXT(ser, commandBuffer, cullMode);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1048,7 +1048,7 @@ void WrappedVulkan::vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, VkFrontF
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetFrontFaceEXT);
|
||||
Serialise_vkCmdSetFrontFaceEXT(ser, commandBuffer, frontFace);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1109,7 +1109,7 @@ void WrappedVulkan::vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetPrimitiveTopologyEXT);
|
||||
Serialise_vkCmdSetPrimitiveTopologyEXT(ser, commandBuffer, primitiveTopology);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1169,7 +1169,7 @@ void WrappedVulkan::vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, Vk
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDepthTestEnableEXT);
|
||||
Serialise_vkCmdSetDepthTestEnableEXT(ser, commandBuffer, depthTestEnable);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1230,7 +1230,7 @@ void WrappedVulkan::vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDepthWriteEnableEXT);
|
||||
Serialise_vkCmdSetDepthWriteEnableEXT(ser, commandBuffer, depthWriteEnable);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1291,7 +1291,7 @@ void WrappedVulkan::vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDepthCompareOpEXT);
|
||||
Serialise_vkCmdSetDepthCompareOpEXT(ser, commandBuffer, depthCompareOp);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1353,7 +1353,7 @@ void WrappedVulkan::vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuff
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetDepthBoundsTestEnableEXT);
|
||||
Serialise_vkCmdSetDepthBoundsTestEnableEXT(ser, commandBuffer, depthBoundsTestEnable);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1414,7 +1414,7 @@ void WrappedVulkan::vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetStencilTestEnableEXT);
|
||||
Serialise_vkCmdSetStencilTestEnableEXT(ser, commandBuffer, stencilTestEnable);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1498,7 +1498,7 @@ void WrappedVulkan::vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, VkStenci
|
||||
Serialise_vkCmdSetStencilOpEXT(ser, commandBuffer, faceMask, failOp, passOp, depthFailOp,
|
||||
compareOp);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -686,7 +686,7 @@ void WrappedVulkan::vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdSetEvent);
|
||||
Serialise_vkCmdSetEvent(ser, commandBuffer, event, stageMask);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(event), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -743,7 +743,7 @@ void WrappedVulkan::vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdResetEvent);
|
||||
Serialise_vkCmdResetEvent(ser, commandBuffer, event, stageMask);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
record->MarkResourceFrameReferenced(GetResID(event), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
@@ -944,11 +944,11 @@ void WrappedVulkan::vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t even
|
||||
if(imageMemoryBarrierCount > 0)
|
||||
{
|
||||
GetResourceManager()->RecordBarriers(record->cmdInfo->imageStates,
|
||||
record->pool->queueFamilyIndex, imageMemoryBarrierCount,
|
||||
pImageMemoryBarriers);
|
||||
record->pool->cmdPoolInfo->queueFamilyIndex,
|
||||
imageMemoryBarrierCount, pImageMemoryBarriers);
|
||||
}
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
record->AddChunk(scope.Get(record->cmdInfo->alloc));
|
||||
for(uint32_t i = 0; i < eventCount; i++)
|
||||
record->MarkResourceFrameReferenced(GetResID(pEvents[i]), eFrameRef_Read);
|
||||
}
|
||||
|
||||
@@ -947,3 +947,97 @@ rdcstr DoStringise(const bool &el)
|
||||
|
||||
return "False";
|
||||
}
|
||||
|
||||
Chunk::Chunk(Serialiser<SerialiserMode::Writing> &ser, uint16_t chunkType, ChunkAllocator *allocator)
|
||||
{
|
||||
RDCCOMPILE_ASSERT(sizeof(Chunk) <= 16, "Chunk should be no more than 16 bytes");
|
||||
|
||||
m_Length = (uint32_t)ser.GetWriter()->GetOffset();
|
||||
|
||||
RDCASSERT(ser.GetWriter()->GetOffset() < 0xffffffff);
|
||||
|
||||
m_ChunkType = chunkType;
|
||||
|
||||
m_Data = NULL;
|
||||
if(allocator)
|
||||
{
|
||||
m_ChunkAlloced = false;
|
||||
m_Data = allocator->AllocAlignedBuffer(m_Length);
|
||||
if(m_Data)
|
||||
m_DataAlloced = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ChunkAlloced = true;
|
||||
}
|
||||
|
||||
if(m_Data == NULL)
|
||||
{
|
||||
m_Data = AllocAlignedBuffer(m_Length);
|
||||
m_DataAlloced = true;
|
||||
}
|
||||
|
||||
memcpy(m_Data, ser.GetWriter()->GetData(), (size_t)m_Length);
|
||||
|
||||
ser.GetWriter()->Rewind();
|
||||
|
||||
#if ENABLED(RDOC_DEVEL)
|
||||
Atomic::Inc64(&m_LiveChunks);
|
||||
Atomic::ExchAdd64(&m_TotalMem, int64_t(m_Length));
|
||||
#endif
|
||||
}
|
||||
|
||||
byte *ChunkAllocator::AllocAlignedBuffer(uint64_t size)
|
||||
{
|
||||
// always allocate 64-bytes at a time even if the size is smaller
|
||||
return AllocateFromPages(freeBufferPages, fullBufferPages, AlignUp(size, (size_t)64));
|
||||
}
|
||||
|
||||
byte *ChunkAllocator::AllocChunk()
|
||||
{
|
||||
RDCCOMPILE_ASSERT(sizeof(ChunkAllocator) <= 128, "foo");
|
||||
return AllocateFromPages(freeChunkPages, fullChunkPages, sizeof(Chunk));
|
||||
}
|
||||
|
||||
void ChunkAllocator::Reset()
|
||||
{
|
||||
freeBufferPages.append(fullBufferPages);
|
||||
freeChunkPages.append(fullChunkPages);
|
||||
fullBufferPages.clear();
|
||||
fullChunkPages.clear();
|
||||
|
||||
for(Page &p : freeBufferPages)
|
||||
p.head = p.base;
|
||||
for(Page &p : freeChunkPages)
|
||||
p.head = p.base;
|
||||
}
|
||||
|
||||
byte *ChunkAllocator::AllocateFromPages(rdcarray<Page> &freeList, rdcarray<Page> &fullList,
|
||||
size_t size)
|
||||
{
|
||||
// if the size can't be satisfied in a page, return NULL and we'll force a full allocation which
|
||||
// will be freed on its own
|
||||
if(size > PageSize)
|
||||
return NULL;
|
||||
|
||||
// if the last free page can't satisfy this allocation, retire it to the full list
|
||||
if(!freeList.empty() && GetRemainingBytes(freeList.back()) < size)
|
||||
{
|
||||
fullList.push_back(freeList.back());
|
||||
freeList.pop_back();
|
||||
}
|
||||
|
||||
// if there are no free pages, allocate a new one
|
||||
if(freeList.empty())
|
||||
{
|
||||
byte *buf = ::AllocAlignedBuffer(PageSize);
|
||||
freeList.push_back({buf, buf});
|
||||
}
|
||||
|
||||
Page &p = freeList.back();
|
||||
|
||||
byte *ret = p.head;
|
||||
p.head += size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1446,14 +1446,48 @@ DECLARE_STRINGISE_TYPE(SDObject *);
|
||||
|
||||
class ScopedChunk;
|
||||
|
||||
class ChunkAllocator
|
||||
{
|
||||
public:
|
||||
ChunkAllocator(size_t PageSize) : PageSize(PageSize) {}
|
||||
ChunkAllocator(const ChunkAllocator &) = delete;
|
||||
ChunkAllocator(ChunkAllocator &&) = delete;
|
||||
ChunkAllocator &operator=(const ChunkAllocator &) = delete;
|
||||
byte *AllocAlignedBuffer(uint64_t size);
|
||||
byte *AllocChunk();
|
||||
// reset all pages to free
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
size_t PageSize;
|
||||
|
||||
struct Page
|
||||
{
|
||||
// base of the buffer
|
||||
byte *base;
|
||||
// head of the buffer
|
||||
byte *head;
|
||||
};
|
||||
|
||||
// we allocate at two granularities, chunks are 16 bytes, buffers are multiples of 64-bytes
|
||||
rdcarray<Page> freeBufferPages;
|
||||
rdcarray<Page> freeChunkPages;
|
||||
|
||||
rdcarray<Page> fullBufferPages;
|
||||
rdcarray<Page> fullChunkPages;
|
||||
|
||||
size_t GetRemainingBytes(const Page &p) { return PageSize - (p.head - p.base); }
|
||||
byte *AllocateFromPages(rdcarray<Page> &freeList, rdcarray<Page> &fullList, size_t size);
|
||||
};
|
||||
|
||||
// holds the memory, length and type for a given chunk, so that it can be
|
||||
// passed around and moved between owners before being serialised out
|
||||
class Chunk
|
||||
{
|
||||
public:
|
||||
~Chunk()
|
||||
{
|
||||
FreeAlignedBuffer(m_Data);
|
||||
if(m_DataAlloced)
|
||||
FreeAlignedBuffer(m_Data);
|
||||
|
||||
#if ENABLED(RDOC_DEVEL)
|
||||
Atomic::Dec64(&m_LiveChunks);
|
||||
@@ -1461,6 +1495,15 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
void Delete()
|
||||
{
|
||||
if(m_ChunkAlloced)
|
||||
delete this;
|
||||
else
|
||||
this->~Chunk();
|
||||
}
|
||||
|
||||
template <typename ChunkType>
|
||||
ChunkType GetChunkType()
|
||||
{
|
||||
@@ -1475,34 +1518,19 @@ public:
|
||||
#endif
|
||||
|
||||
// grab current contents of the serialiser into this chunk
|
||||
Chunk(Serialiser<SerialiserMode::Writing> &ser, uint32_t chunkType)
|
||||
{
|
||||
m_Length = (uint32_t)ser.GetWriter()->GetOffset();
|
||||
|
||||
RDCASSERT(ser.GetWriter()->GetOffset() < 0xffffffff);
|
||||
|
||||
m_ChunkType = chunkType;
|
||||
|
||||
m_Data = AllocAlignedBuffer(m_Length);
|
||||
|
||||
memcpy(m_Data, ser.GetWriter()->GetData(), (size_t)m_Length);
|
||||
|
||||
ser.GetWriter()->Rewind();
|
||||
|
||||
#if ENABLED(RDOC_DEVEL)
|
||||
Atomic::Inc64(&m_LiveChunks);
|
||||
Atomic::ExchAdd64(&m_TotalMem, int64_t(m_Length));
|
||||
#endif
|
||||
}
|
||||
Chunk(Serialiser<SerialiserMode::Writing> &ser, uint16_t chunkType,
|
||||
ChunkAllocator *allocator = NULL);
|
||||
|
||||
byte *GetData() const { return m_Data; }
|
||||
Chunk *Duplicate()
|
||||
{
|
||||
Chunk *ret = new Chunk();
|
||||
ret->m_ChunkAlloced = true;
|
||||
ret->m_Length = m_Length;
|
||||
ret->m_ChunkType = m_ChunkType;
|
||||
|
||||
ret->m_Data = AllocAlignedBuffer(m_Length);
|
||||
ret->m_DataAlloced = true;
|
||||
|
||||
memcpy(ret->m_Data, m_Data, (size_t)m_Length);
|
||||
|
||||
@@ -1526,7 +1554,10 @@ private:
|
||||
|
||||
friend class ScopedChunk;
|
||||
|
||||
uint32_t m_ChunkType;
|
||||
uint16_t m_ChunkType;
|
||||
|
||||
bool m_ChunkAlloced = true;
|
||||
bool m_DataAlloced = true;
|
||||
|
||||
uint32_t m_Length;
|
||||
byte *m_Data;
|
||||
@@ -1542,7 +1573,7 @@ class ScopedChunk
|
||||
public:
|
||||
template <typename ChunkType>
|
||||
ScopedChunk(WriteSerialiser &s, ChunkType i, uint64_t byteLength = 0)
|
||||
: m_Idx(uint32_t(i)), m_Ser(s), m_Ended(false)
|
||||
: m_Idx(uint16_t(i)), m_Ser(s), m_Ended(false)
|
||||
{
|
||||
m_Ser.WriteChunk(m_Idx, byteLength);
|
||||
}
|
||||
@@ -1552,15 +1583,18 @@ public:
|
||||
End();
|
||||
}
|
||||
|
||||
Chunk *Get()
|
||||
Chunk *Get(ChunkAllocator *allocator = NULL)
|
||||
{
|
||||
End();
|
||||
return new Chunk(m_Ser, m_Idx);
|
||||
if(allocator)
|
||||
return new(allocator->AllocChunk()) Chunk(m_Ser, m_Idx, allocator);
|
||||
else
|
||||
return new Chunk(m_Ser, m_Idx);
|
||||
}
|
||||
|
||||
private:
|
||||
WriteSerialiser &m_Ser;
|
||||
uint32_t m_Idx;
|
||||
uint16_t m_Idx;
|
||||
bool m_Ended;
|
||||
|
||||
void End()
|
||||
|
||||
@@ -497,25 +497,35 @@ TEST_CASE("Read/writing large buffers", "[serialiser]")
|
||||
ser.Serialise("dummy"_lit, dummy1);
|
||||
ser.EndChunk();
|
||||
|
||||
Chunk(ser, 1).Write(fileser);
|
||||
Chunk *c;
|
||||
|
||||
c = new Chunk(ser, 1);
|
||||
c->Write(fileser);
|
||||
c->Delete();
|
||||
|
||||
ser.WriteChunk(2);
|
||||
ser.Serialise("buffer"_lit, buffer);
|
||||
ser.EndChunk();
|
||||
|
||||
Chunk(ser, 1).Write(fileser);
|
||||
c = new Chunk(ser, 1);
|
||||
c->Write(fileser);
|
||||
c->Delete();
|
||||
|
||||
ser.WriteChunk(3);
|
||||
ser.Serialise("buffer"_lit, buffer);
|
||||
ser.EndChunk();
|
||||
|
||||
Chunk(ser, 1).Write(fileser);
|
||||
c = new Chunk(ser, 1);
|
||||
c->Write(fileser);
|
||||
c->Delete();
|
||||
|
||||
ser.WriteChunk(4);
|
||||
ser.Serialise("dummy"_lit, dummy2);
|
||||
ser.EndChunk();
|
||||
|
||||
Chunk(ser, 1).Write(fileser);
|
||||
c = new Chunk(ser, 1);
|
||||
c->Write(fileser);
|
||||
c->Delete();
|
||||
}
|
||||
|
||||
for(size_t pass = 0; pass < 2; pass++)
|
||||
@@ -751,7 +761,7 @@ TEST_CASE("Verify multiple chunks can be merged", "[serialiser][chunks]")
|
||||
}
|
||||
|
||||
for(Chunk *c : chunks)
|
||||
delete c;
|
||||
c->Delete();
|
||||
|
||||
// now read the data "dynamically" and ensure it's all correct
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user