mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-25 16:06:31 +00:00
Serialise Wait() and SOSetTargets()
This commit is contained in:
@@ -874,11 +874,64 @@ void WrappedID3D12GraphicsCommandList::IASetVertexBuffers(UINT StartSlot, UINT N
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_SOSetTargets(
|
||||
UINT StartSlot, UINT NumViews, const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, CommandList, GetResourceID());
|
||||
SERIALISE_ELEMENT(UINT, start, StartSlot);
|
||||
SERIALISE_ELEMENT(UINT, num, NumViews);
|
||||
SERIALISE_ELEMENT_ARR(D3D12_STREAM_OUTPUT_BUFFER_VIEW, views, pViews, num);
|
||||
|
||||
if(m_State < WRITING)
|
||||
m_Cmd->m_LastCmdListID = CommandList;
|
||||
|
||||
if(m_State == EXECUTING)
|
||||
{
|
||||
if(m_Cmd->ShouldRerecordCmd(CommandList) && m_Cmd->InRerecordRange(CommandList))
|
||||
{
|
||||
Unwrap(m_Cmd->RerecordCmdList(CommandList))->SOSetTargets(start, num, views);
|
||||
|
||||
if(m_Cmd->m_RenderState.streamouts.size() < start + num)
|
||||
m_Cmd->m_RenderState.streamouts.resize(start + num);
|
||||
|
||||
for(UINT i = 0; i < num; i++)
|
||||
{
|
||||
D3D12RenderState::StreamOut &so = m_Cmd->m_RenderState.streamouts[start + i];
|
||||
|
||||
WrappedID3D12Resource::GetResIDFromAddr(views[i].BufferLocation, so.buf, so.offs);
|
||||
|
||||
WrappedID3D12Resource::GetResIDFromAddr(views[i].BufferFilledSizeLocation, so.countbuf,
|
||||
so.countoffs);
|
||||
|
||||
so.size = views[i].SizeInBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
{
|
||||
GetList(CommandList)->SOSetTargets(start, num, views);
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY(views);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedID3D12GraphicsCommandList::SOSetTargets(UINT StartSlot, UINT NumViews,
|
||||
const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews)
|
||||
{
|
||||
D3D12NOTIMP(__PRETTY_FUNCTION_SIGNATURE__);
|
||||
m_pReal->SOSetTargets(StartSlot, NumViews, pViews);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(SET_SOTARGETS);
|
||||
Serialise_SOSetTargets(StartSlot, NumViews, pViews);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
for(UINT i = 0; i < NumViews; i++)
|
||||
m_ListRecord->MarkResourceFrameReferenced(
|
||||
WrappedID3D12Resource::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read);
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_SetPipelineState(ID3D12PipelineState *pPipelineState)
|
||||
|
||||
@@ -463,8 +463,32 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12CommandQueue::Signal(ID3D12Fence *pFence,
|
||||
return m_pReal->Signal(Unwrap(pFence), Value);
|
||||
}
|
||||
|
||||
bool WrappedID3D12CommandQueue::Serialise_Wait(ID3D12Fence *pFence, UINT64 Value)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, Fence, GetResID(pFence));
|
||||
SERIALISE_ELEMENT(UINT64, val, Value);
|
||||
|
||||
if(m_State <= EXECUTING && GetResourceManager()->HasLiveResource(Fence))
|
||||
{
|
||||
// pFence = GetResourceManager()->GetLiveAs<ID3D12Fence>(Fence);
|
||||
|
||||
m_pDevice->GPUSync();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE WrappedID3D12CommandQueue::Wait(ID3D12Fence *pFence, UINT64 Value)
|
||||
{
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(WAIT);
|
||||
Serialise_Wait(pFence, Value);
|
||||
|
||||
m_QueueRecord->AddChunk(scope.Get());
|
||||
GetResourceManager()->MarkResourceFrameReferenced(GetResID(pFence), eFrameRef_Read);
|
||||
}
|
||||
|
||||
return m_pReal->Wait(Unwrap(pFence), Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
|
||||
break;
|
||||
case SET_IBUFFER: m_ReplayList->Serialise_IASetIndexBuffer(NULL); break;
|
||||
case SET_VBUFFERS: m_ReplayList->Serialise_IASetVertexBuffers(0, 0, NULL); break;
|
||||
case SET_SOTARGETS: m_ReplayList->Serialise_SOSetTargets(0, 0, NULL); break;
|
||||
case SET_VIEWPORTS: m_ReplayList->Serialise_RSSetViewports(0, NULL); break;
|
||||
case SET_SCISSORS: m_ReplayList->Serialise_RSSetScissorRects(0, NULL); break;
|
||||
case SET_STENCIL: m_ReplayList->Serialise_OMSetStencilRef(0); break;
|
||||
@@ -356,6 +357,7 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
|
||||
|
||||
case EXECUTE_CMD_LISTS: Serialise_ExecuteCommandLists(0, NULL); break;
|
||||
case SIGNAL: Serialise_Signal(NULL, 0); break;
|
||||
case WAIT: Serialise_Wait(NULL, 0); break;
|
||||
case CONTEXT_CAPTURE_FOOTER:
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, bbid, ResourceId());
|
||||
|
||||
@@ -983,6 +983,49 @@ void Serialiser::Serialise(const char *name, D3D12_INDEX_BUFFER_VIEW &el)
|
||||
Serialise("Format", el.Format);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_STREAM_OUTPUT_BUFFER_VIEW &el)
|
||||
{
|
||||
ScopedContext scope(this, name, "D3D12_STREAM_OUTPUT_BUFFER_VIEW", 0, true);
|
||||
|
||||
D3D12ResourceManager *rm = (D3D12ResourceManager *)GetUserData();
|
||||
|
||||
ResourceId buffer;
|
||||
UINT64 offs = 0;
|
||||
|
||||
if(m_Mode == WRITING)
|
||||
WrappedID3D12Resource::GetResIDFromAddr(el.BufferLocation, buffer, offs);
|
||||
|
||||
Serialise("BufferLocation", buffer);
|
||||
Serialise("BufferLocation_Offset", offs);
|
||||
|
||||
if(m_Mode == READING)
|
||||
{
|
||||
ID3D12Resource *res = rm->GetLiveAs<ID3D12Resource>(buffer);
|
||||
if(res)
|
||||
el.BufferLocation = res->GetGPUVirtualAddress() + offs;
|
||||
else
|
||||
el.BufferLocation = 0;
|
||||
}
|
||||
|
||||
if(m_Mode == WRITING)
|
||||
WrappedID3D12Resource::GetResIDFromAddr(el.BufferFilledSizeLocation, buffer, offs);
|
||||
|
||||
Serialise("BufferFilledSizeLocation", buffer);
|
||||
Serialise("BufferFilledSizeLocation_Offset", offs);
|
||||
|
||||
if(m_Mode == READING)
|
||||
{
|
||||
ID3D12Resource *res = rm->GetLiveAs<ID3D12Resource>(buffer);
|
||||
if(res)
|
||||
el.BufferFilledSizeLocation = res->GetGPUVirtualAddress() + offs;
|
||||
else
|
||||
el.BufferFilledSizeLocation = 0;
|
||||
}
|
||||
|
||||
Serialise("SizeInBytes", el.SizeInBytes);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_CONSTANT_BUFFER_VIEW_DESC &el)
|
||||
{
|
||||
|
||||
@@ -195,6 +195,8 @@ void Serialiser::Serialise(const char *name, D3D12_INDEX_BUFFER_VIEW &el);
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_VERTEX_BUFFER_VIEW &el);
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_STREAM_OUTPUT_BUFFER_VIEW &el);
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_RESOURCE_BARRIER &el);
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, D3D12_HEAP_PROPERTIES &el);
|
||||
@@ -296,6 +298,7 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
|
||||
D3D12_CHUNK_MACRO(SET_TOPOLOGY, "ID3D12GraphicsCommandList::IASetPrimitiveTopology") \
|
||||
D3D12_CHUNK_MACRO(SET_IBUFFER, "ID3D12GraphicsCommandList::IASetIndexBuffer") \
|
||||
D3D12_CHUNK_MACRO(SET_VBUFFERS, "ID3D12GraphicsCommandList::IASetVertexBuffers") \
|
||||
D3D12_CHUNK_MACRO(SET_SOTARGETS, "ID3D12GraphicsCommandList::SOSetTargets") \
|
||||
D3D12_CHUNK_MACRO(SET_VIEWPORTS, "ID3D12GraphicsCommandList::RSSetViewports") \
|
||||
D3D12_CHUNK_MACRO(SET_SCISSORS, "ID3D12GraphicsCommandList::RSSetScissors") \
|
||||
D3D12_CHUNK_MACRO(SET_PIPE, "ID3D12GraphicsCommandList::SetPipelineState") \
|
||||
@@ -335,6 +338,7 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
|
||||
\
|
||||
D3D12_CHUNK_MACRO(EXECUTE_CMD_LISTS, "ID3D12GraphicsCommandQueue::ExecuteCommandLists") \
|
||||
D3D12_CHUNK_MACRO(SIGNAL, "ID3D12GraphicsCommandQueue::Signal") \
|
||||
D3D12_CHUNK_MACRO(WAIT, "ID3D12GraphicsCommandQueue::Wait") \
|
||||
\
|
||||
D3D12_CHUNK_MACRO(NUM_D3D12_CHUNKS, "")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user