mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 05:35:48 +00:00
Add serialising of DiscardResource calls
This commit is contained in:
@@ -2825,11 +2825,49 @@ void WrappedID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat(
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_DiscardResource(ID3D12Resource *pResource,
|
||||
const D3D12_DISCARD_REGION *pRegion)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, CommandList, GetResourceID());
|
||||
SERIALISE_ELEMENT(ResourceId, res, GetResID(pResource));
|
||||
SERIALISE_ELEMENT(BOOL, HasRegion, pRegion != NULL);
|
||||
SERIALISE_ELEMENT_OPT(D3D12_DISCARD_REGION, region, *pRegion, HasRegion);
|
||||
|
||||
if(m_State < WRITING)
|
||||
m_Cmd->m_LastCmdListID = CommandList;
|
||||
|
||||
if(m_State == EXECUTING)
|
||||
{
|
||||
pResource = GetResourceManager()->GetLiveAs<ID3D12Resource>(res);
|
||||
|
||||
if(m_Cmd->ShouldRerecordCmd(CommandList) && m_Cmd->InRerecordRange(CommandList))
|
||||
{
|
||||
Unwrap(m_Cmd->RerecordCmdList(CommandList))->DiscardResource(pResource, HasRegion ? ®ion : NULL);
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
{
|
||||
pResource = GetResourceManager()->GetLiveAs<ID3D12Resource>(res);
|
||||
|
||||
GetList(CommandList)->DiscardResource(pResource, HasRegion ? ®ion : NULL);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedID3D12GraphicsCommandList::DiscardResource(ID3D12Resource *pResource,
|
||||
const D3D12_DISCARD_REGION *pRegion)
|
||||
{
|
||||
D3D12NOTIMP(__PRETTY_FUNCTION_SIGNATURE__);
|
||||
m_pReal->DiscardResource(Unwrap(pResource), pRegion);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(DISCARD_RESOURCE);
|
||||
Serialise_DiscardResource(pResource, pRegion);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetResID(pResource), eFrameRef_Write);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion Clears
|
||||
|
||||
@@ -296,6 +296,7 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
|
||||
m_ReplayList->Serialise_ClearUnorderedAccessViewFloat(
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE(), D3D12_CPU_DESCRIPTOR_HANDLE(), NULL, NULL, 0, NULL);
|
||||
break;
|
||||
case DISCARD_RESOURCE: m_ReplayList->Serialise_DiscardResource(NULL, NULL); break;
|
||||
|
||||
case SET_TOPOLOGY:
|
||||
m_ReplayList->Serialise_IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED);
|
||||
|
||||
@@ -1021,6 +1021,17 @@ void Serialiser::Serialise(const char *name, D3D12_TEXTURE_COPY_LOCATION &el)
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_DISCARD_REGION &el)
|
||||
{
|
||||
ScopedContext scope(this, name, "D3D12_DISCARD_REGION", 0, true);
|
||||
|
||||
Serialise("FirstSubresource", el.FirstSubresource);
|
||||
Serialise("NumSubresources", el.NumSubresources);
|
||||
|
||||
SerialiseComplexArray("pRects", (D3D12_RECT *&)el.pRects, el.NumRects);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_SAMPLER_DESC &el)
|
||||
{
|
||||
|
||||
@@ -204,6 +204,8 @@ template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_CLEAR_VALUE &el);
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_TEXTURE_COPY_LOCATION &el);
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_DISCARD_REGION &el);
|
||||
|
||||
struct D3D12Descriptor;
|
||||
template <>
|
||||
@@ -266,6 +268,7 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
|
||||
D3D12_CHUNK_MACRO(CLEAR_DSV, "ID3D12GraphicsCommandList::ClearDepthStencilView") \
|
||||
D3D12_CHUNK_MACRO(CLEAR_UAV_INT, "ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint") \
|
||||
D3D12_CHUNK_MACRO(CLEAR_UAV_FLOAT, "ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat") \
|
||||
D3D12_CHUNK_MACRO(DISCARD_RESOURCE, "ID3D12GraphicsCommandList::DiscardResource") \
|
||||
\
|
||||
D3D12_CHUNK_MACRO(SET_TOPOLOGY, "ID3D12GraphicsCommandList::IASetPrimitiveTopology") \
|
||||
D3D12_CHUNK_MACRO(SET_IBUFFER, "ID3D12GraphicsCommandList::IASetIndexBuffer") \
|
||||
|
||||
Reference in New Issue
Block a user