mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Serialise DrawInstanced() calls
This commit is contained in:
@@ -304,12 +304,79 @@ void WrappedID3D12GraphicsCommandList::ClearState(ID3D12PipelineState *pPipeline
|
||||
m_pReal->ClearState(Unwrap(pPipelineState));
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_DrawInstanced(UINT VertexCountPerInstance,
|
||||
UINT InstanceCount,
|
||||
UINT StartVertexLocation,
|
||||
UINT StartInstanceLocation)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, CommandList, GetResourceID());
|
||||
SERIALISE_ELEMENT(UINT, vtxCount, VertexCountPerInstance);
|
||||
SERIALISE_ELEMENT(UINT, instCount, InstanceCount);
|
||||
SERIALISE_ELEMENT(UINT, startVtx, StartVertexLocation);
|
||||
SERIALISE_ELEMENT(UINT, startInst, StartInstanceLocation);
|
||||
|
||||
if(m_State < WRITING)
|
||||
m_Cmd->m_LastCmdListID = CommandList;
|
||||
|
||||
D3D12NOTIMP("Serialise_DebugMessages");
|
||||
|
||||
if(m_State == EXECUTING)
|
||||
{
|
||||
if(m_Cmd->ShouldRerecordCmd(CommandList) && m_Cmd->InRerecordRange(CommandList))
|
||||
{
|
||||
ID3D12GraphicsCommandList *list = m_Cmd->RerecordCmdList(CommandList);
|
||||
|
||||
uint32_t eventID = m_Cmd->HandlePreCallback(list);
|
||||
|
||||
Unwrap(list)->DrawInstanced(vtxCount, instCount, startVtx, startInst);
|
||||
|
||||
if(eventID && m_Cmd->m_DrawcallCallback->PostDraw(eventID, list))
|
||||
{
|
||||
Unwrap(list)->DrawInstanced(vtxCount, instCount, startVtx, startInst);
|
||||
m_Cmd->m_DrawcallCallback->PostRedraw(eventID, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
{
|
||||
GetList(CommandList)->DrawInstanced(vtxCount, instCount, startVtx, startInst);
|
||||
|
||||
const string desc = m_pSerialiser->GetDebugStr();
|
||||
|
||||
m_Cmd->AddEvent(DRAW_INST, desc);
|
||||
string name = "DrawInstanced(" + ToStr::Get(vtxCount) + ", " + ToStr::Get(instCount) + ")";
|
||||
|
||||
FetchDrawcall draw;
|
||||
draw.name = name;
|
||||
draw.numIndices = vtxCount;
|
||||
draw.numInstances = instCount;
|
||||
draw.indexOffset = 0;
|
||||
draw.baseVertex = startVtx;
|
||||
draw.instanceOffset = startInst;
|
||||
|
||||
draw.flags |= eDraw_Drawcall | eDraw_Instanced;
|
||||
|
||||
m_Cmd->AddDrawcall(draw, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedID3D12GraphicsCommandList::DrawInstanced(UINT VertexCountPerInstance,
|
||||
UINT InstanceCount, UINT StartVertexLocation,
|
||||
UINT StartInstanceLocation)
|
||||
{
|
||||
m_pReal->DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation,
|
||||
StartInstanceLocation);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(DRAW_INST);
|
||||
Serialise_DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation,
|
||||
StartInstanceLocation);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_DrawIndexedInstanced(UINT IndexCountPerInstance,
|
||||
|
||||
@@ -264,6 +264,7 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
|
||||
|
||||
case RESOURCE_BARRIER: m_ReplayList->Serialise_ResourceBarrier(0, NULL); break;
|
||||
|
||||
case DRAW_INST: m_ReplayList->Serialise_DrawInstanced(0, 0, 0, 0); break;
|
||||
case DRAW_INDEXED_INST: m_ReplayList->Serialise_DrawIndexedInstanced(0, 0, 0, 0, 0); break;
|
||||
case COPY_BUFFER: m_ReplayList->Serialise_CopyBufferRegion(NULL, 0, NULL, 0, 0); break;
|
||||
|
||||
|
||||
@@ -237,6 +237,7 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
|
||||
D3D12_CHUNK_MACRO(RESOURCE_BARRIER, "ID3D12GraphicsCommandList::ResourceBarrier") \
|
||||
\
|
||||
D3D12_CHUNK_MACRO(DRAW_INDEXED_INST, "ID3D12GraphicsCommandList::DrawIndexedInstanced") \
|
||||
D3D12_CHUNK_MACRO(DRAW_INST, "ID3D12GraphicsCommandList::DrawInstanced") \
|
||||
D3D12_CHUNK_MACRO(COPY_BUFFER, "ID3D12GraphicsCommandList::CopyBufferRegion") \
|
||||
\
|
||||
D3D12_CHUNK_MACRO(CLEAR_RTV, "ID3D12GraphicsCommandList::ClearRenderTargetView") \
|
||||
|
||||
Reference in New Issue
Block a user