mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-15 10:15:48 +00:00
Remove std::vector/std::string use from D3D12 driver
This commit is contained in:
@@ -218,7 +218,7 @@ public:
|
||||
else if(guid == WKPDID_D3DDebugObjectNameW)
|
||||
{
|
||||
rdcwstr wName((const wchar_t *)pData, DataSize / 2);
|
||||
std::string sName = StringFormat::Wide2UTF8(wName);
|
||||
rdcstr sName = StringFormat::Wide2UTF8(wName);
|
||||
m_pDevice->SetName(this, sName.c_str());
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetName(LPCWSTR Name)
|
||||
{
|
||||
std::string utf8 = StringFormat::Wide2UTF8(Name);
|
||||
rdcstr utf8 = StringFormat::Wide2UTF8(Name);
|
||||
m_pDevice->SetName(this, utf8.c_str());
|
||||
|
||||
return m_pList->SetName(Name);
|
||||
|
||||
@@ -57,7 +57,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_AtomicCopyBufferUINT(
|
||||
{
|
||||
if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID))
|
||||
{
|
||||
std::vector<ID3D12Resource *> deps;
|
||||
rdcarray<ID3D12Resource *> deps;
|
||||
deps.resize(Dependencies);
|
||||
for(size_t i = 0; i < deps.size(); i++)
|
||||
deps[i] = Unwrap(ppDependentResources[i]);
|
||||
@@ -70,7 +70,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_AtomicCopyBufferUINT(
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<ID3D12Resource *> deps;
|
||||
rdcarray<ID3D12Resource *> deps;
|
||||
deps.resize(Dependencies);
|
||||
for(size_t i = 0; i < deps.size(); i++)
|
||||
deps[i] = Unwrap(ppDependentResources[i]);
|
||||
@@ -175,7 +175,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_AtomicCopyBufferUINT64(
|
||||
{
|
||||
if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID))
|
||||
{
|
||||
std::vector<ID3D12Resource *> deps;
|
||||
rdcarray<ID3D12Resource *> deps;
|
||||
deps.resize(Dependencies);
|
||||
for(size_t i = 0; i < deps.size(); i++)
|
||||
deps[i] = Unwrap(ppDependentResources[i]);
|
||||
@@ -188,7 +188,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_AtomicCopyBufferUINT64(
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<ID3D12Resource *> deps;
|
||||
rdcarray<ID3D12Resource *> deps;
|
||||
deps.resize(Dependencies);
|
||||
for(size_t i = 0; i < deps.size(); i++)
|
||||
deps[i] = Unwrap(ppDependentResources[i]);
|
||||
@@ -362,12 +362,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetSamplePositions(
|
||||
{
|
||||
D3D12RenderState &state = m_Cmd->m_RenderState;
|
||||
|
||||
std::vector<D3D12_SAMPLE_POSITION> pos(
|
||||
pSamplePositions, pSamplePositions + (NumSamplesPerPixel * NumPixels));
|
||||
|
||||
state.samplePos.NumSamplesPerPixel = NumSamplesPerPixel;
|
||||
state.samplePos.NumPixels = NumPixels;
|
||||
state.samplePos.Positions.swap(pos);
|
||||
state.samplePos.Positions.assign(pSamplePositions, NumSamplesPerPixel * NumPixels);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,12 +376,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetSamplePositions(
|
||||
{
|
||||
D3D12RenderState &state = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state;
|
||||
|
||||
std::vector<D3D12_SAMPLE_POSITION> pos(pSamplePositions,
|
||||
pSamplePositions + (NumSamplesPerPixel * NumPixels));
|
||||
|
||||
state.samplePos.NumSamplesPerPixel = NumSamplesPerPixel;
|
||||
state.samplePos.NumPixels = NumPixels;
|
||||
state.samplePos.Positions.swap(pos);
|
||||
state.samplePos.Positions.assign(pSamplePositions, NumSamplesPerPixel * NumPixels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BeginRenderPass(
|
||||
|
||||
// since CPU handles are consumed in the call, we need to read out and serialise the contents
|
||||
// here.
|
||||
std::vector<D3D12Descriptor> RTVs;
|
||||
rdcarray<D3D12Descriptor> RTVs;
|
||||
D3D12Descriptor DSV;
|
||||
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser,
|
||||
// check for partial execution of this command list
|
||||
for(int p = 0; p < D3D12CommandData::ePartialNum; p++)
|
||||
{
|
||||
const std::vector<uint32_t> &baseEvents = m_Cmd->m_Partial[p].cmdListExecs[BakedCommandList];
|
||||
const rdcarray<uint32_t> &baseEvents = m_Cmd->m_Partial[p].cmdListExecs[BakedCommandList];
|
||||
|
||||
for(auto it = baseEvents.begin(); it != baseEvents.end(); ++it)
|
||||
{
|
||||
@@ -462,7 +462,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ResourceBarrier(
|
||||
{
|
||||
m_Cmd->m_LastCmdListID = GetResourceManager()->GetOriginalID(GetResID(pCommandList));
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> filtered;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> filtered;
|
||||
{
|
||||
filtered.reserve(NumBarriers);
|
||||
|
||||
@@ -593,8 +593,7 @@ void WrappedID3D12GraphicsCommandList::ResourceBarrier(UINT NumBarriers,
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
|
||||
m_ListRecord->cmdInfo->barriers.insert(m_ListRecord->cmdInfo->barriers.end(), pBarriers,
|
||||
pBarriers + NumBarriers);
|
||||
m_ListRecord->cmdInfo->barriers.append(pBarriers, NumBarriers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,7 +957,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetDescriptorHeaps(
|
||||
{
|
||||
if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID))
|
||||
{
|
||||
std::vector<ID3D12DescriptorHeap *> heaps;
|
||||
rdcarray<ID3D12DescriptorHeap *> heaps;
|
||||
heaps.resize(NumDescriptorHeaps);
|
||||
for(size_t i = 0; i < heaps.size(); i++)
|
||||
heaps[i] = Unwrap(ppDescriptorHeaps[i]);
|
||||
@@ -976,7 +975,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetDescriptorHeaps(
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<ID3D12DescriptorHeap *> heaps;
|
||||
rdcarray<ID3D12DescriptorHeap *> heaps;
|
||||
heaps.resize(NumDescriptorHeaps);
|
||||
for(size_t i = 0; i < heaps.size(); i++)
|
||||
heaps[i] = Unwrap(ppDescriptorHeaps[i]);
|
||||
@@ -1336,7 +1335,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_OMSetRenderTargets(
|
||||
SERIALISE_ELEMENT(pCommandList);
|
||||
SERIALISE_ELEMENT(NumRenderTargetDescriptors);
|
||||
|
||||
std::vector<D3D12Descriptor> RTVs;
|
||||
rdcarray<D3D12Descriptor> RTVs;
|
||||
|
||||
if(ser.VersionAtLeast(0x5))
|
||||
{
|
||||
@@ -1348,7 +1347,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_OMSetRenderTargets(
|
||||
{
|
||||
const D3D12Descriptor *descs = GetWrapped(pRenderTargetDescriptors[0]);
|
||||
|
||||
RTVs.insert(RTVs.begin(), descs, descs + NumRenderTargetDescriptors);
|
||||
RTVs.assign(descs, NumRenderTargetDescriptors);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1383,7 +1382,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_OMSetRenderTargets(
|
||||
{
|
||||
const D3D12Descriptor *descs = GetWrapped(pRenderTargetDescriptors[0]);
|
||||
|
||||
RTVs.insert(RTVs.begin(), descs, descs + NumRenderTargetDescriptors);
|
||||
RTVs.assign(descs, NumRenderTargetDescriptors);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1429,7 +1428,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_OMSetRenderTargets(
|
||||
{
|
||||
m_Cmd->m_LastCmdListID = GetResourceManager()->GetOriginalID(GetResID(pCommandList));
|
||||
|
||||
std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> unwrappedRTs;
|
||||
rdcarray<D3D12_CPU_DESCRIPTOR_HANDLE> unwrappedRTs;
|
||||
unwrappedRTs.resize(RTVs.size());
|
||||
for(size_t i = 0; i < RTVs.size(); i++)
|
||||
{
|
||||
@@ -1659,7 +1658,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootDescriptorTable(
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetWrapped(BaseDescriptor)->GetHeapResourceId(),
|
||||
eFrameRef_Read);
|
||||
|
||||
std::vector<D3D12_DESCRIPTOR_RANGE1> &ranges =
|
||||
rdcarray<D3D12_DESCRIPTOR_RANGE1> &ranges =
|
||||
GetWrapped(m_CurCompRootSig)->sig.Parameters[RootParameterIndex].ranges;
|
||||
|
||||
D3D12Descriptor *base = GetWrapped(BaseDescriptor);
|
||||
@@ -1688,7 +1687,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootDescriptorTable(
|
||||
|
||||
if(!RenderDoc::Inst().GetCaptureOptions().refAllResources)
|
||||
{
|
||||
std::vector<D3D12Descriptor *> &descs = m_ListRecord->cmdInfo->boundDescs;
|
||||
rdcarray<D3D12Descriptor *> &descs = m_ListRecord->cmdInfo->boundDescs;
|
||||
|
||||
descs.reserve(descs.size() + num);
|
||||
for(UINT d = 0; d < num; d++)
|
||||
@@ -2223,7 +2222,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable(
|
||||
m_ListRecord->MarkResourceFrameReferenced(GetWrapped(BaseDescriptor)->GetHeapResourceId(),
|
||||
eFrameRef_Read);
|
||||
|
||||
std::vector<D3D12_DESCRIPTOR_RANGE1> &ranges =
|
||||
rdcarray<D3D12_DESCRIPTOR_RANGE1> &ranges =
|
||||
GetWrapped(m_CurGfxRootSig)->sig.Parameters[RootParameterIndex].ranges;
|
||||
|
||||
D3D12Descriptor *base = GetWrapped(BaseDescriptor);
|
||||
@@ -2252,7 +2251,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable(
|
||||
|
||||
if(!RenderDoc::Inst().GetCaptureOptions().refAllResources)
|
||||
{
|
||||
std::vector<D3D12Descriptor *> &descs = m_ListRecord->cmdInfo->boundDescs;
|
||||
rdcarray<D3D12Descriptor *> &descs = m_ListRecord->cmdInfo->boundDescs;
|
||||
|
||||
descs.reserve(descs.size() + num);
|
||||
for(UINT d = 0; d < num; d++)
|
||||
@@ -2848,7 +2847,7 @@ template <typename SerialiserType>
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_SetMarker(SerialiserType &ser, UINT Metadata,
|
||||
const void *pData, UINT Size)
|
||||
{
|
||||
std::string MarkerText = "";
|
||||
rdcstr MarkerText = "";
|
||||
|
||||
if(ser.IsWriting() && pData && Size)
|
||||
MarkerText = DecodeMarkerString(Metadata, pData, Size);
|
||||
@@ -2911,7 +2910,7 @@ template <typename SerialiserType>
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_BeginEvent(SerialiserType &ser, UINT Metadata,
|
||||
const void *pData, UINT Size)
|
||||
{
|
||||
std::string MarkerText = "";
|
||||
rdcstr MarkerText = "";
|
||||
|
||||
if(ser.IsWriting() && pData && Size)
|
||||
MarkerText = DecodeMarkerString(Metadata, pData, Size);
|
||||
@@ -3362,7 +3361,7 @@ void WrappedID3D12GraphicsCommandList::ExecuteBundle(ID3D12GraphicsCommandList *
|
||||
|
||||
CmdListRecordingInfo *dst = m_ListRecord->cmdInfo;
|
||||
CmdListRecordingInfo *src = record->bakedCommands->cmdInfo;
|
||||
dst->boundDescs.insert(dst->boundDescs.end(), src->boundDescs.begin(), src->boundDescs.end());
|
||||
dst->boundDescs.append(src->boundDescs);
|
||||
dst->dirtied.insert(src->dirtied.begin(), src->dirtied.end());
|
||||
|
||||
dst->bundles.push_back(record);
|
||||
@@ -3473,7 +3472,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
|
||||
byte *mapPtr = NULL;
|
||||
exec.argBuf->Map(0, &range, (void **)&mapPtr);
|
||||
|
||||
std::vector<D3D12DrawcallTreeNode> &draws = info.draw->children;
|
||||
rdcarray<D3D12DrawcallTreeNode> &draws = info.draw->children;
|
||||
|
||||
size_t idx = 0;
|
||||
uint32_t eid = exec.baseEvent;
|
||||
@@ -3654,11 +3653,11 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
|
||||
|
||||
if(arg.Constant.RootParameterIndex < state.graphics.sigelems.size())
|
||||
state.graphics.sigelems[arg.Constant.RootParameterIndex].constants.assign(
|
||||
data32, data32 + arg.Constant.Num32BitValuesToSet);
|
||||
data32, arg.Constant.Num32BitValuesToSet);
|
||||
|
||||
if(arg.Constant.RootParameterIndex < state.compute.sigelems.size())
|
||||
state.compute.sigelems[arg.Constant.RootParameterIndex].constants.assign(
|
||||
data32, data32 + arg.Constant.Num32BitValuesToSet);
|
||||
data32, arg.Constant.Num32BitValuesToSet);
|
||||
|
||||
// advance only the EID, since we're still in the same draw
|
||||
eid++;
|
||||
@@ -3796,7 +3795,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
|
||||
|
||||
while(idx < draws.size() && draws[idx].draw.eventId < lastEID)
|
||||
{
|
||||
draws.erase(draws.begin() + idx);
|
||||
draws.erase(idx);
|
||||
shiftDrawID++;
|
||||
}
|
||||
|
||||
@@ -3807,7 +3806,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
|
||||
if(!multidraw && exec.maxCount > 1)
|
||||
{
|
||||
// remove pop event
|
||||
draws.erase(draws.begin() + idx);
|
||||
draws.erase(idx);
|
||||
|
||||
info.ShiftForRemoved(1, 1, idx);
|
||||
}
|
||||
@@ -3869,7 +3868,7 @@ void WrappedID3D12GraphicsCommandList::ReplayExecuteIndirect(ID3D12GraphicsComma
|
||||
|
||||
byte *dataPtr = &data[0];
|
||||
|
||||
std::vector<D3D12RenderState::SignatureElement> &sigelems =
|
||||
rdcarray<D3D12RenderState::SignatureElement> &sigelems =
|
||||
gfx ? m_Cmd->m_RenderState.graphics.sigelems : m_Cmd->m_RenderState.compute.sigelems;
|
||||
|
||||
// while executing, decide where to start and stop. We do this by modifying the max count and
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include "common/wrapped_pool.h"
|
||||
#include "d3d12_commands.h"
|
||||
#include "d3d12_common.h"
|
||||
@@ -116,7 +115,7 @@ class WrappedID3D12CommandQueue : public ID3D12CommandQueue,
|
||||
|
||||
WrappedID3D12DebugCommandQueue m_WrappedDebug;
|
||||
|
||||
std::vector<D3D12ResourceRecord *> m_CmdListRecords;
|
||||
rdcarray<D3D12ResourceRecord *> m_CmdListRecords;
|
||||
|
||||
// D3D12 guarantees that queues are thread-safe
|
||||
Threading::CriticalSection m_Lock;
|
||||
@@ -150,7 +149,7 @@ public:
|
||||
ID3D12CommandQueue *GetReal() { return m_pReal; }
|
||||
D3D12ResourceRecord *GetResourceRecord() { return m_QueueRecord; }
|
||||
WrappedID3D12Device *GetWrappedDevice() { return m_pDevice; }
|
||||
const std::vector<D3D12ResourceRecord *> &GetCmdLists() { return m_CmdListRecords; }
|
||||
const rdcarray<D3D12ResourceRecord *> &GetCmdLists() { return m_CmdListRecords; }
|
||||
D3D12DrawcallTreeNode &GetParentDrawcall() { return m_Cmd.m_ParentDrawcall; }
|
||||
const APIEvent &GetEvent(uint32_t eventId);
|
||||
uint32_t GetMaxEID() { return m_Cmd.m_Events.back().eventId; }
|
||||
@@ -160,7 +159,7 @@ public:
|
||||
bool partial);
|
||||
void SetFrameReader(StreamReader *reader) { m_FrameReader = reader; }
|
||||
D3D12CommandData *GetCommandData() { return &m_Cmd; }
|
||||
const std::vector<EventUsage> &GetUsage(ResourceId id) { return m_Cmd.m_ResourceUses[id]; }
|
||||
const rdcarray<EventUsage> &GetUsage(ResourceId id) { return m_Cmd.m_ResourceUses[id]; }
|
||||
// interface for DXGI
|
||||
virtual IUnknown *GetRealIUnknown() { return GetReal(); }
|
||||
virtual IID GetBackbufferUUID() { return __uuidof(ID3D12Resource); }
|
||||
@@ -248,7 +247,7 @@ public:
|
||||
else if(guid == WKPDID_D3DDebugObjectNameW)
|
||||
{
|
||||
rdcwstr wName((const wchar_t *)pData, DataSize / 2);
|
||||
std::string sName = StringFormat::Wide2UTF8(wName);
|
||||
rdcstr sName = StringFormat::Wide2UTF8(wName);
|
||||
m_pDevice->SetName(this, sName.c_str());
|
||||
}
|
||||
|
||||
@@ -262,7 +261,7 @@ public:
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetName(LPCWSTR Name)
|
||||
{
|
||||
std::string utf8 = StringFormat::Wide2UTF8(Name);
|
||||
rdcstr utf8 = StringFormat::Wide2UTF8(Name);
|
||||
m_pDevice->SetName(this, utf8.c_str());
|
||||
|
||||
return m_pReal->SetName(Name);
|
||||
|
||||
@@ -83,7 +83,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
|
||||
SERIALISE_ELEMENT_ARRAY(ppCommandLists, NumCommandLists);
|
||||
|
||||
{
|
||||
std::vector<DebugMessage> DebugMessages;
|
||||
rdcarray<DebugMessage> DebugMessages;
|
||||
|
||||
if(ser.IsWriting())
|
||||
DebugMessages = m_pDevice->GetDebugMessages();
|
||||
@@ -170,7 +170,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
|
||||
m_pDevice->ApplyBarriers(m_Cmd.m_BakedCmdListInfo[cmd].barriers);
|
||||
}
|
||||
|
||||
std::string basename = StringFormat::Fmt("ExecuteCommandLists(%u)", NumCommandLists);
|
||||
rdcstr basename = StringFormat::Fmt("ExecuteCommandLists(%u)", NumCommandLists);
|
||||
|
||||
for(uint32_t c = 0; c < NumCommandLists; c++)
|
||||
{
|
||||
@@ -197,8 +197,8 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
|
||||
|
||||
for(size_t e = 0; e < cmdListInfo.draw->executedCmds.size(); e++)
|
||||
{
|
||||
std::vector<uint32_t> &submits = m_Cmd.m_Partial[D3D12CommandData::Secondary]
|
||||
.cmdListExecs[cmdListInfo.draw->executedCmds[e]];
|
||||
rdcarray<uint32_t> &submits = m_Cmd.m_Partial[D3D12CommandData::Secondary]
|
||||
.cmdListExecs[cmdListInfo.draw->executedCmds[e]];
|
||||
|
||||
for(size_t s = 0; s < submits.size(); s++)
|
||||
submits[s] += m_Cmd.m_RootEventID;
|
||||
@@ -271,7 +271,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
|
||||
|
||||
uint32_t eid = startEID;
|
||||
|
||||
std::vector<ID3D12CommandList *> rerecordedCmds;
|
||||
rdcarray<ID3D12CommandList *> rerecordedCmds;
|
||||
|
||||
for(uint32_t c = 0; c < NumCommandLists; c++)
|
||||
{
|
||||
@@ -393,7 +393,7 @@ void WrappedID3D12CommandQueue::ExecuteCommandListsInternal(UINT NumCommandLists
|
||||
// any descriptor copies or writes could reference new resources not in the
|
||||
// bound descs list yet. So we take all of those referenced descriptors and
|
||||
// include them to see if we need to flush
|
||||
std::vector<D3D12Descriptor> dynDescRefs;
|
||||
rdcarray<D3D12Descriptor> dynDescRefs;
|
||||
m_pDevice->GetDynamicDescriptorReferences(dynDescRefs);
|
||||
|
||||
for(size_t d = 0; d < dynDescRefs.size(); d++)
|
||||
@@ -475,7 +475,7 @@ void WrappedID3D12CommandQueue::ExecuteCommandListsInternal(UINT NumCommandLists
|
||||
|
||||
if(capframe)
|
||||
{
|
||||
std::vector<MapState> maps = m_pDevice->GetMaps();
|
||||
rdcarray<MapState> maps = m_pDevice->GetMaps();
|
||||
|
||||
for(auto it = maps.begin(); it != maps.end(); ++it)
|
||||
{
|
||||
@@ -548,7 +548,7 @@ template <typename SerialiserType>
|
||||
bool WrappedID3D12CommandQueue::Serialise_SetMarker(SerialiserType &ser, UINT Metadata,
|
||||
const void *pData, UINT Size)
|
||||
{
|
||||
std::string MarkerText = "";
|
||||
rdcstr MarkerText = "";
|
||||
|
||||
if(ser.IsWriting() && pData && Size)
|
||||
MarkerText = DecodeMarkerString(Metadata, pData, Size);
|
||||
@@ -597,7 +597,7 @@ template <typename SerialiserType>
|
||||
bool WrappedID3D12CommandQueue::Serialise_BeginEvent(SerialiserType &ser, UINT Metadata,
|
||||
const void *pData, UINT Size)
|
||||
{
|
||||
std::string MarkerText = "";
|
||||
rdcstr MarkerText = "";
|
||||
|
||||
if(ser.IsWriting() && pData && Size)
|
||||
MarkerText = DecodeMarkerString(Metadata, pData, Size);
|
||||
|
||||
@@ -490,7 +490,7 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu
|
||||
break;
|
||||
case D3D12Chunk::Device_CopyDescriptors:
|
||||
case D3D12Chunk::Device_CopyDescriptorsSimple:
|
||||
ret = m_pDevice->Serialise_DynamicDescriptorCopies(ser, std::vector<DynamicDescriptorCopy>());
|
||||
ret = m_pDevice->Serialise_DynamicDescriptorCopies(ser, rdcarray<DynamicDescriptorCopy>());
|
||||
break;
|
||||
|
||||
case D3D12Chunk::Queue_ExecuteCommandLists:
|
||||
@@ -1234,7 +1234,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::QueryInterface(REFII
|
||||
|
||||
void BakedCmdListInfo::ShiftForRemoved(uint32_t shiftDrawID, uint32_t shiftEID, size_t idx)
|
||||
{
|
||||
std::vector<D3D12DrawcallTreeNode> &draws = draw->children;
|
||||
rdcarray<D3D12DrawcallTreeNode> &draws = draw->children;
|
||||
|
||||
drawCount -= shiftDrawID;
|
||||
eventCount -= shiftEID;
|
||||
@@ -1486,9 +1486,9 @@ void D3D12CommandData::AddEvent()
|
||||
{
|
||||
m_BakedCmdListInfo[m_LastCmdListID].curEvents.push_back(apievent);
|
||||
|
||||
std::vector<DebugMessage> &msgs = m_BakedCmdListInfo[m_LastCmdListID].debugMessages;
|
||||
rdcarray<DebugMessage> &msgs = m_BakedCmdListInfo[m_LastCmdListID].debugMessages;
|
||||
|
||||
msgs.insert(msgs.end(), m_EventMessages.begin(), m_EventMessages.end());
|
||||
msgs.append(m_EventMessages);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1555,7 +1555,7 @@ void D3D12CommandData::AddUsage(const D3D12RenderState &state, D3D12DrawcallTree
|
||||
make_rdcpair(state.streamouts[i].countbuf, EventUsage(e, ResourceUsage::StreamOut)));
|
||||
}
|
||||
|
||||
std::vector<ResourceId> rts = state.GetRTVIDs();
|
||||
rdcarray<ResourceId> rts = state.GetRTVIDs();
|
||||
|
||||
for(size_t i = 0; i < rts.size(); i++)
|
||||
{
|
||||
@@ -1721,7 +1721,7 @@ void D3D12CommandData::AddDrawcall(const DrawcallDescription &d, bool hasEvents,
|
||||
draw.topology = MakePrimitiveTopology(m_BakedCmdListInfo[m_LastCmdListID].state.topo);
|
||||
draw.indexByteWidth = m_BakedCmdListInfo[m_LastCmdListID].state.ibuffer.bytewidth;
|
||||
|
||||
std::vector<ResourceId> rts = m_BakedCmdListInfo[m_LastCmdListID].state.GetRTVIDs();
|
||||
rdcarray<ResourceId> rts = m_BakedCmdListInfo[m_LastCmdListID].state.GetRTVIDs();
|
||||
|
||||
for(size_t i = 0; i < ARRAY_COUNT(draw.outputs); i++)
|
||||
{
|
||||
@@ -1747,9 +1747,9 @@ void D3D12CommandData::AddDrawcall(const DrawcallDescription &d, bool hasEvents,
|
||||
|
||||
if(hasEvents)
|
||||
{
|
||||
std::vector<APIEvent> &srcEvents = m_LastCmdListID != ResourceId()
|
||||
? m_BakedCmdListInfo[m_LastCmdListID].curEvents
|
||||
: m_RootEvents;
|
||||
rdcarray<APIEvent> &srcEvents = m_LastCmdListID != ResourceId()
|
||||
? m_BakedCmdListInfo[m_LastCmdListID].curEvents
|
||||
: m_RootEvents;
|
||||
|
||||
draw.events = srcEvents;
|
||||
srcEvents.clear();
|
||||
@@ -1766,7 +1766,8 @@ void D3D12CommandData::AddDrawcall(const DrawcallDescription &d, bool hasEvents,
|
||||
if(m_LastCmdListID != ResourceId() && addUsage)
|
||||
AddUsage(m_BakedCmdListInfo[m_LastCmdListID].state, node);
|
||||
|
||||
node.children.insert(node.children.begin(), draw.children.begin(), draw.children.end());
|
||||
for(const DrawcallDescription &child : draw.children)
|
||||
node.children.push_back(D3D12DrawcallTreeNode(child));
|
||||
GetDrawcallStack().back()->children.push_back(node);
|
||||
}
|
||||
else
|
||||
@@ -1774,7 +1775,7 @@ void D3D12CommandData::AddDrawcall(const DrawcallDescription &d, bool hasEvents,
|
||||
}
|
||||
|
||||
void D3D12CommandData::InsertDrawsAndRefreshIDs(ResourceId cmd,
|
||||
std::vector<D3D12DrawcallTreeNode> &cmdBufNodes)
|
||||
rdcarray<D3D12DrawcallTreeNode> &cmdBufNodes)
|
||||
{
|
||||
// assign new drawcall IDs
|
||||
for(size_t i = 0; i < cmdBufNodes.size(); i++)
|
||||
@@ -1804,7 +1805,7 @@ void D3D12CommandData::InsertDrawsAndRefreshIDs(ResourceId cmd,
|
||||
|
||||
// insert in sorted location
|
||||
auto drawit = std::lower_bound(m_DrawcallUses.begin(), m_DrawcallUses.end(), use);
|
||||
m_DrawcallUses.insert(drawit, use);
|
||||
m_DrawcallUses.insert(drawit - m_DrawcallUses.begin(), use);
|
||||
|
||||
RDCASSERT(n.children.empty());
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ struct D3D12DrawcallTreeNode
|
||||
D3D12DrawcallTreeNode(const D3D12DrawcallTreeNode &other) { *this = other; }
|
||||
~D3D12DrawcallTreeNode() { SAFE_DELETE(state); }
|
||||
DrawcallDescription draw;
|
||||
std::vector<D3D12DrawcallTreeNode> children;
|
||||
rdcarray<D3D12DrawcallTreeNode> children;
|
||||
|
||||
D3D12RenderState *state = NULL;
|
||||
|
||||
std::vector<rdcpair<ResourceId, EventUsage> > resourceUsage;
|
||||
rdcarray<rdcpair<ResourceId, EventUsage> > resourceUsage;
|
||||
|
||||
std::vector<ResourceId> executedCmds;
|
||||
rdcarray<ResourceId> executedCmds;
|
||||
|
||||
D3D12DrawcallTreeNode &operator=(const DrawcallDescription &d)
|
||||
{
|
||||
@@ -85,9 +85,9 @@ struct D3D12DrawcallTreeNode
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<DrawcallDescription> Bake()
|
||||
rdcarray<DrawcallDescription> Bake()
|
||||
{
|
||||
std::vector<DrawcallDescription> ret;
|
||||
rdcarray<DrawcallDescription> ret;
|
||||
if(children.empty())
|
||||
return ret;
|
||||
|
||||
@@ -188,21 +188,21 @@ struct BakedCmdListInfo
|
||||
UINT realCount = 0;
|
||||
};
|
||||
|
||||
std::vector<ID3D12GraphicsCommandListX *> crackedLists;
|
||||
std::vector<ExecuteData> executeEvents;
|
||||
rdcarray<ID3D12GraphicsCommandListX *> crackedLists;
|
||||
rdcarray<ExecuteData> executeEvents;
|
||||
|
||||
std::vector<APIEvent> curEvents;
|
||||
std::vector<DebugMessage> debugMessages;
|
||||
std::list<D3D12DrawcallTreeNode *> drawStack;
|
||||
rdcarray<APIEvent> curEvents;
|
||||
rdcarray<DebugMessage> debugMessages;
|
||||
rdcarray<D3D12DrawcallTreeNode *> drawStack;
|
||||
|
||||
std::vector<rdcpair<ResourceId, EventUsage> > resourceUsage;
|
||||
rdcarray<rdcpair<ResourceId, EventUsage> > resourceUsage;
|
||||
|
||||
ResourceId allocator;
|
||||
D3D12_COMMAND_LIST_TYPE type;
|
||||
UINT nodeMask;
|
||||
D3D12RenderState state;
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
ResourceId parentList;
|
||||
|
||||
@@ -233,7 +233,7 @@ struct D3D12CommandData
|
||||
|
||||
std::map<ResourceId, ID3D12CommandAllocator *> m_CrackedAllocators;
|
||||
|
||||
std::vector<ID3D12Resource *> m_IndirectBuffers;
|
||||
rdcarray<ID3D12Resource *> m_IndirectBuffers;
|
||||
static const uint64_t m_IndirectSize = 4 * 1024 * 1024;
|
||||
uint64_t m_IndirectOffset;
|
||||
|
||||
@@ -272,7 +272,7 @@ struct D3D12CommandData
|
||||
// However, a single baked command list can be executed multiple times - so we have to have a
|
||||
// list of base events
|
||||
// Map from bakeID -> vector<baseEventID>
|
||||
std::map<ResourceId, std::vector<uint32_t> > cmdListExecs;
|
||||
std::map<ResourceId, rdcarray<uint32_t> > cmdListExecs;
|
||||
|
||||
// This is just the baked ID of the parent command list that's partially replayed
|
||||
// If we are in the middle of a partial replay - allows fast checking in all CmdList chunks,
|
||||
@@ -298,7 +298,7 @@ struct D3D12CommandData
|
||||
// so we just set this command list
|
||||
ID3D12GraphicsCommandListX *m_OutsideCmdList = NULL;
|
||||
|
||||
void InsertDrawsAndRefreshIDs(ResourceId cmd, std::vector<D3D12DrawcallTreeNode> &cmdBufNodes);
|
||||
void InsertDrawsAndRefreshIDs(ResourceId cmd, rdcarray<D3D12DrawcallTreeNode> &cmdBufNodes);
|
||||
|
||||
// this is a list of uint64_t file offset -> uint32_t EIDs of where each
|
||||
// drawcall is used. E.g. the drawcall at offset 873954 is EID 50. If a
|
||||
@@ -322,16 +322,16 @@ struct D3D12CommandData
|
||||
return eventId < o.eventId;
|
||||
}
|
||||
};
|
||||
std::vector<DrawcallUse> m_DrawcallUses;
|
||||
rdcarray<DrawcallUse> m_DrawcallUses;
|
||||
|
||||
std::vector<DebugMessage> m_EventMessages;
|
||||
rdcarray<DebugMessage> m_EventMessages;
|
||||
|
||||
std::map<ResourceId, ID3D12GraphicsCommandListX *> m_RerecordCmds;
|
||||
std::vector<ID3D12GraphicsCommandListX *> m_RerecordCmdList;
|
||||
rdcarray<ID3D12GraphicsCommandListX *> m_RerecordCmdList;
|
||||
|
||||
bool m_AddedDrawcall;
|
||||
|
||||
std::vector<APIEvent> m_RootEvents, m_Events;
|
||||
rdcarray<APIEvent> m_RootEvents, m_Events;
|
||||
|
||||
uint64_t m_CurChunkOffset;
|
||||
SDChunkMetaData m_ChunkMetadata;
|
||||
@@ -343,13 +343,13 @@ struct D3D12CommandData
|
||||
|
||||
SDFile *m_StructuredFile;
|
||||
|
||||
std::map<ResourceId, std::vector<EventUsage> > m_ResourceUses;
|
||||
std::map<ResourceId, rdcarray<EventUsage> > m_ResourceUses;
|
||||
|
||||
D3D12DrawcallTreeNode m_ParentDrawcall;
|
||||
|
||||
std::list<D3D12DrawcallTreeNode *> m_RootDrawcallStack;
|
||||
rdcarray<D3D12DrawcallTreeNode *> m_RootDrawcallStack;
|
||||
|
||||
std::list<D3D12DrawcallTreeNode *> &GetDrawcallStack()
|
||||
rdcarray<D3D12DrawcallTreeNode *> &GetDrawcallStack()
|
||||
{
|
||||
if(m_LastCmdListID != ResourceId())
|
||||
return m_BakedCmdListInfo[m_LastCmdListID].drawStack;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "d3d12_manager.h"
|
||||
#include "d3d12_resources.h"
|
||||
|
||||
D3D12MarkerRegion::D3D12MarkerRegion(ID3D12GraphicsCommandList *l, const std::string &marker)
|
||||
D3D12MarkerRegion::D3D12MarkerRegion(ID3D12GraphicsCommandList *l, const rdcstr &marker)
|
||||
{
|
||||
list = l;
|
||||
queue = NULL;
|
||||
@@ -36,7 +36,7 @@ D3D12MarkerRegion::D3D12MarkerRegion(ID3D12GraphicsCommandList *l, const std::st
|
||||
D3D12MarkerRegion::Begin(list, marker);
|
||||
}
|
||||
|
||||
D3D12MarkerRegion::D3D12MarkerRegion(ID3D12CommandQueue *q, const std::string &marker)
|
||||
D3D12MarkerRegion::D3D12MarkerRegion(ID3D12CommandQueue *q, const rdcstr &marker)
|
||||
{
|
||||
list = NULL;
|
||||
queue = q;
|
||||
@@ -52,7 +52,7 @@ D3D12MarkerRegion::~D3D12MarkerRegion()
|
||||
D3D12MarkerRegion::End(queue);
|
||||
}
|
||||
|
||||
void D3D12MarkerRegion::Begin(ID3D12GraphicsCommandList *list, const std::string &marker)
|
||||
void D3D12MarkerRegion::Begin(ID3D12GraphicsCommandList *list, const rdcstr &marker)
|
||||
{
|
||||
if(list)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ void D3D12MarkerRegion::Begin(ID3D12GraphicsCommandList *list, const std::string
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12MarkerRegion::Begin(ID3D12CommandQueue *queue, const std::string &marker)
|
||||
void D3D12MarkerRegion::Begin(ID3D12CommandQueue *queue, const rdcstr &marker)
|
||||
{
|
||||
if(queue)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ void D3D12MarkerRegion::Begin(ID3D12CommandQueue *queue, const std::string &mark
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12MarkerRegion::Set(ID3D12GraphicsCommandList *list, const std::string &marker)
|
||||
void D3D12MarkerRegion::Set(ID3D12GraphicsCommandList *list, const rdcstr &marker)
|
||||
{
|
||||
if(list)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ void D3D12MarkerRegion::Set(ID3D12GraphicsCommandList *list, const std::string &
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12MarkerRegion::Set(ID3D12CommandQueue *queue, const std::string &marker)
|
||||
void D3D12MarkerRegion::Set(ID3D12CommandQueue *queue, const rdcstr &marker)
|
||||
{
|
||||
if(queue)
|
||||
{
|
||||
@@ -676,7 +676,7 @@ inline void PIX3DecodeStringInfo(const UINT64 BlobData, UINT64 &Alignment, UINT6
|
||||
IsShortcut = (BlobData >> PIXEventsStringIsShortcutBitShift) & PIXEventsStringIsShortcutWriteMask;
|
||||
}
|
||||
|
||||
const UINT64 *PIX3DecodeStringParam(const UINT64 *pData, std::string &DecodedString)
|
||||
const UINT64 *PIX3DecodeStringParam(const UINT64 *pData, rdcstr &DecodedString)
|
||||
{
|
||||
UINT64 alignment;
|
||||
UINT64 copyChunkSize;
|
||||
@@ -690,7 +690,7 @@ const UINT64 *PIX3DecodeStringParam(const UINT64 *pData, std::string &DecodedStr
|
||||
{
|
||||
const char *c = (const char *)pData;
|
||||
UINT formatStringCharCount = UINT(strlen((const char *)pData));
|
||||
DecodedString = std::string(c, c + formatStringCharCount);
|
||||
DecodedString = rdcstr(c, formatStringCharCount);
|
||||
totalStringBytes = formatStringCharCount + 1;
|
||||
}
|
||||
else
|
||||
@@ -708,18 +708,18 @@ const UINT64 *PIX3DecodeStringParam(const UINT64 *pData, std::string &DecodedStr
|
||||
return pData;
|
||||
}
|
||||
|
||||
std::string PIX3SprintfParams(const std::string &Format, const UINT64 *pData)
|
||||
rdcstr PIX3SprintfParams(const rdcstr &Format, const UINT64 *pData)
|
||||
{
|
||||
std::string finalString;
|
||||
std::string formatPart;
|
||||
size_t lastFind = 0;
|
||||
rdcstr finalString;
|
||||
rdcstr formatPart;
|
||||
int32_t lastFind = 0;
|
||||
|
||||
for(size_t found = Format.find_first_of("%"); found != std::string::npos;)
|
||||
for(int32_t found = Format.indexOf('%'); found >= 0;)
|
||||
{
|
||||
finalString += Format.substr(lastFind, found - lastFind);
|
||||
|
||||
size_t endOfFormat = Format.find_first_of("%diufFeEgGxXoscpaAn", found + 1);
|
||||
if(endOfFormat == std::string::npos)
|
||||
int32_t endOfFormat = Format.find_first_of("%diufFeEgGxXoscpaAn", found + 1);
|
||||
if(endOfFormat < 0)
|
||||
{
|
||||
finalString += "<FORMAT_ERROR>";
|
||||
break;
|
||||
@@ -730,7 +730,7 @@ std::string PIX3SprintfParams(const std::string &Format, const UINT64 *pData)
|
||||
// strings
|
||||
if(formatPart.back() == 's')
|
||||
{
|
||||
std::string stringParam;
|
||||
rdcstr stringParam;
|
||||
pData = PIX3DecodeStringParam(pData, stringParam);
|
||||
finalString += stringParam;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ std::string PIX3SprintfParams(const std::string &Format, const UINT64 *pData)
|
||||
}
|
||||
|
||||
lastFind = endOfFormat + 1;
|
||||
found = Format.find_first_of("%", lastFind);
|
||||
found = Format.indexOf('%', lastFind);
|
||||
}
|
||||
|
||||
finalString += Format.substr(lastFind);
|
||||
@@ -753,7 +753,7 @@ std::string PIX3SprintfParams(const std::string &Format, const UINT64 *pData)
|
||||
return finalString;
|
||||
}
|
||||
|
||||
std::string PIX3DecodeEventString(const UINT64 *pData)
|
||||
rdcstr PIX3DecodeEventString(const UINT64 *pData)
|
||||
{
|
||||
// event header
|
||||
UINT64 timestamp;
|
||||
@@ -780,7 +780,7 @@ std::string PIX3DecodeEventString(const UINT64 *pData)
|
||||
++pData;
|
||||
|
||||
// format string
|
||||
std::string formatString;
|
||||
rdcstr formatString;
|
||||
pData = PIX3DecodeStringParam(pData, formatString);
|
||||
|
||||
if(eventType == ePIXEvent_BeginEvent_NoArgs)
|
||||
|
||||
@@ -40,16 +40,16 @@ using ID3D12GraphicsCommandListX = ID3D12GraphicsCommandList5;
|
||||
// replay only class for handling marker regions
|
||||
struct D3D12MarkerRegion
|
||||
{
|
||||
D3D12MarkerRegion(ID3D12GraphicsCommandList *list, const std::string &marker);
|
||||
D3D12MarkerRegion(ID3D12CommandQueue *queue, const std::string &marker);
|
||||
D3D12MarkerRegion(ID3D12GraphicsCommandList *list, const rdcstr &marker);
|
||||
D3D12MarkerRegion(ID3D12CommandQueue *queue, const rdcstr &marker);
|
||||
~D3D12MarkerRegion();
|
||||
|
||||
static void Set(ID3D12GraphicsCommandList *list, const std::string &marker);
|
||||
static void Set(ID3D12CommandQueue *queue, const std::string &marker);
|
||||
static void Set(ID3D12GraphicsCommandList *list, const rdcstr &marker);
|
||||
static void Set(ID3D12CommandQueue *queue, const rdcstr &marker);
|
||||
|
||||
static void Begin(ID3D12GraphicsCommandList *list, const std::string &marker);
|
||||
static void Begin(ID3D12GraphicsCommandList *list, const rdcstr &marker);
|
||||
static void End(ID3D12GraphicsCommandList *list);
|
||||
static void Begin(ID3D12CommandQueue *queue, const std::string &marker);
|
||||
static void Begin(ID3D12CommandQueue *queue, const rdcstr &marker);
|
||||
static void End(ID3D12CommandQueue *queue);
|
||||
|
||||
ID3D12GraphicsCommandList *list = NULL;
|
||||
@@ -59,7 +59,7 @@ struct D3D12MarkerRegion
|
||||
bool EnableD3D12DebugLayer(PFN_D3D12_GET_DEBUG_INTERFACE getDebugInterface = NULL);
|
||||
HRESULT EnumAdapterByLuid(IDXGIFactory1 *factory, LUID luid, IDXGIAdapter **pAdapter);
|
||||
|
||||
inline void SetObjName(ID3D12Object *obj, const std::string &utf8name)
|
||||
inline void SetObjName(ID3D12Object *obj, const rdcstr &utf8name)
|
||||
{
|
||||
obj->SetName(StringFormat::UTF82Wide(utf8name).c_str());
|
||||
}
|
||||
@@ -68,11 +68,11 @@ inline void SetObjName(ID3D12Object *obj, const std::string &utf8name)
|
||||
#define PIX_EVENT_ANSI_VERSION 1
|
||||
#define PIX_EVENT_PIX3BLOB_VERSION 2
|
||||
|
||||
std::string PIX3DecodeEventString(const UINT64 *pData);
|
||||
rdcstr PIX3DecodeEventString(const UINT64 *pData);
|
||||
|
||||
inline std::string DecodeMarkerString(UINT Metadata, const void *pData, UINT Size)
|
||||
inline rdcstr DecodeMarkerString(UINT Metadata, const void *pData, UINT Size)
|
||||
{
|
||||
std::string MarkerText = "";
|
||||
rdcstr MarkerText = "";
|
||||
|
||||
// There may be a space appended to the marker string - see D3D12MarkerRegion::Begin
|
||||
// If we encounter this extra space (or a null terminator), remove it.
|
||||
@@ -86,7 +86,7 @@ inline std::string DecodeMarkerString(UINT Metadata, const void *pData, UINT Siz
|
||||
else if(Metadata == PIX_EVENT_ANSI_VERSION)
|
||||
{
|
||||
const char *c = (const char *)pData;
|
||||
MarkerText = std::string(c, c + Size);
|
||||
MarkerText = rdcstr(c, Size);
|
||||
if(!MarkerText.empty() && (MarkerText.back() == ' ' || MarkerText.back() == 0))
|
||||
MarkerText.pop_back();
|
||||
}
|
||||
@@ -315,7 +315,7 @@ struct D3D12RootSignatureParameter : D3D12_ROOT_PARAMETER1
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<D3D12_DESCRIPTOR_RANGE1> ranges;
|
||||
rdcarray<D3D12_DESCRIPTOR_RANGE1> ranges;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(D3D12RootSignatureParameter);
|
||||
@@ -326,8 +326,8 @@ struct D3D12RootSignature
|
||||
uint32_t dwordLength = 0;
|
||||
|
||||
D3D12_ROOT_SIGNATURE_FLAGS Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
|
||||
std::vector<D3D12RootSignatureParameter> Parameters;
|
||||
std::vector<D3D12_STATIC_SAMPLER_DESC> StaticSamplers;
|
||||
rdcarray<D3D12RootSignatureParameter> Parameters;
|
||||
rdcarray<D3D12_STATIC_SAMPLER_DESC> StaticSamplers;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(D3D12RootSignature);
|
||||
@@ -337,7 +337,7 @@ struct D3D12CommandSignature
|
||||
bool graphics = true;
|
||||
UINT numDraws = 0;
|
||||
UINT ByteStride = 0;
|
||||
std::vector<D3D12_INDIRECT_ARGUMENT_DESC> arguments;
|
||||
rdcarray<D3D12_INDIRECT_ARGUMENT_DESC> arguments;
|
||||
};
|
||||
|
||||
#define IMPLEMENT_IUNKNOWN_WITH_REFCOUNTER_CUSTOMQUERY \
|
||||
@@ -413,6 +413,11 @@ DECLARE_REFLECTION_STRUCT(D3D12BufferLocation);
|
||||
DECLARE_REFLECTION_STRUCT(D3D12_CPU_DESCRIPTOR_HANDLE);
|
||||
DECLARE_REFLECTION_STRUCT(D3D12_GPU_DESCRIPTOR_HANDLE);
|
||||
|
||||
inline bool operator==(const D3D12_CPU_DESCRIPTOR_HANDLE &l, const D3D12_CPU_DESCRIPTOR_HANDLE &r)
|
||||
{
|
||||
return l.ptr == r.ptr;
|
||||
}
|
||||
|
||||
// expanded version of D3D12_GRAPHICS_PIPELINE_STATE_DESC / D3D12_COMPUTE_PIPELINE_STATE_DESC with
|
||||
// all subobjects. No enums suitable to make this a stream though.
|
||||
struct D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC
|
||||
|
||||
@@ -340,11 +340,11 @@ rdcarray<CounterResult> D3D12Replay::FetchCountersAMD(const rdcarray<GPUCounter>
|
||||
search.eventId = m_pAMDDrawCallback->m_AliasEvents[i].first;
|
||||
|
||||
// find the result we're aliasing
|
||||
auto it = std::find(ret.begin(), ret.end(), search);
|
||||
if(it != ret.end())
|
||||
int32_t idx = ret.indexOf(search);
|
||||
if(idx >= 0)
|
||||
{
|
||||
// duplicate the result and append
|
||||
CounterResult aliased = *it;
|
||||
CounterResult aliased = ret[idx];
|
||||
aliased.eventId = m_pAMDDrawCallback->m_AliasEvents[i].second;
|
||||
ret.push_back(aliased);
|
||||
}
|
||||
@@ -669,11 +669,11 @@ rdcarray<CounterResult> D3D12Replay::FetchCounters(const rdcarray<GPUCounter> &c
|
||||
search.eventId = cb.m_AliasEvents[i].first;
|
||||
|
||||
// find the result we're aliasing
|
||||
auto it = std::find(ret.begin(), ret.end(), search);
|
||||
if(it != ret.end())
|
||||
int32_t idx = ret.indexOf(search);
|
||||
if(idx >= 0)
|
||||
{
|
||||
// duplicate the result and append
|
||||
CounterResult aliased = *it;
|
||||
CounterResult aliased = ret[idx];
|
||||
aliased.eventId = cb.m_AliasEvents[i].second;
|
||||
ret.push_back(aliased);
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
|
||||
}
|
||||
|
||||
{
|
||||
std::string meshhlsl = GetEmbeddedResource(mesh_hlsl);
|
||||
rdcstr meshhlsl = GetEmbeddedResource(mesh_hlsl);
|
||||
|
||||
shaderCache->GetShaderBlob(meshhlsl.c_str(), "RENDERDOC_MeshVS", D3DCOMPILE_WARNINGS_ARE_ERRORS,
|
||||
"vs_5_0", &m_MeshVS);
|
||||
@@ -267,14 +267,14 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
|
||||
}
|
||||
|
||||
{
|
||||
std::string hlsl = GetEmbeddedResource(misc_hlsl);
|
||||
rdcstr hlsl = GetEmbeddedResource(misc_hlsl);
|
||||
|
||||
shaderCache->GetShaderBlob(hlsl.c_str(), "RENDERDOC_FullscreenVS",
|
||||
D3DCOMPILE_WARNINGS_ARE_ERRORS, "vs_5_0", &m_FullscreenVS);
|
||||
}
|
||||
|
||||
{
|
||||
std::string multisamplehlsl = GetEmbeddedResource(multisample_hlsl);
|
||||
rdcstr multisamplehlsl = GetEmbeddedResource(multisample_hlsl);
|
||||
|
||||
shaderCache->GetShaderBlob(multisamplehlsl.c_str(), "RENDERDOC_CopyMSToArray",
|
||||
D3DCOMPILE_WARNINGS_ARE_ERRORS, "ps_5_0", &m_IntMS2Array);
|
||||
@@ -828,7 +828,7 @@ void D3D12Replay::GeneralMisc::Init(WrappedID3D12Device *device, D3D12DebugManag
|
||||
}
|
||||
|
||||
{
|
||||
std::string hlsl = GetEmbeddedResource(misc_hlsl);
|
||||
rdcstr hlsl = GetEmbeddedResource(misc_hlsl);
|
||||
|
||||
ID3DBlob *FullscreenVS = NULL;
|
||||
ID3DBlob *CheckerboardPS = NULL;
|
||||
@@ -961,7 +961,7 @@ void D3D12Replay::TextureRendering::Init(WrappedID3D12Device *device, D3D12Debug
|
||||
}
|
||||
|
||||
{
|
||||
std::string hlsl = GetEmbeddedResource(texdisplay_hlsl);
|
||||
rdcstr hlsl = GetEmbeddedResource(texdisplay_hlsl);
|
||||
|
||||
ID3DBlob *TexDisplayPS = NULL;
|
||||
|
||||
@@ -1124,7 +1124,7 @@ void D3D12Replay::OverlayRendering::Init(WrappedID3D12Device *device, D3D12Debug
|
||||
shaderCache->SetCaching(true);
|
||||
|
||||
{
|
||||
std::string meshhlsl = GetEmbeddedResource(mesh_hlsl);
|
||||
rdcstr meshhlsl = GetEmbeddedResource(mesh_hlsl);
|
||||
|
||||
shaderCache->GetShaderBlob(meshhlsl.c_str(), "RENDERDOC_TriangleSizeGS",
|
||||
D3DCOMPILE_WARNINGS_ARE_ERRORS, "gs_5_0", &TriangleSizeGS);
|
||||
@@ -1134,7 +1134,7 @@ void D3D12Replay::OverlayRendering::Init(WrappedID3D12Device *device, D3D12Debug
|
||||
shaderCache->GetShaderBlob(meshhlsl.c_str(), "RENDERDOC_MeshVS", D3DCOMPILE_WARNINGS_ARE_ERRORS,
|
||||
"vs_5_0", &MeshVS);
|
||||
|
||||
std::string hlsl = GetEmbeddedResource(quadoverdraw_hlsl);
|
||||
rdcstr hlsl = GetEmbeddedResource(quadoverdraw_hlsl);
|
||||
|
||||
shaderCache->GetShaderBlob(hlsl.c_str(), "RENDERDOC_QuadOverdrawPS",
|
||||
D3DCOMPILE_WARNINGS_ARE_ERRORS, "ps_5_0", &QuadOverdrawWritePS);
|
||||
@@ -1155,7 +1155,7 @@ void D3D12Replay::OverlayRendering::Init(WrappedID3D12Device *device, D3D12Debug
|
||||
}
|
||||
|
||||
{
|
||||
std::string hlsl = GetEmbeddedResource(misc_hlsl);
|
||||
rdcstr hlsl = GetEmbeddedResource(misc_hlsl);
|
||||
|
||||
ID3DBlob *FullscreenVS = NULL;
|
||||
shaderCache->GetShaderBlob(hlsl.c_str(), "RENDERDOC_FullscreenVS",
|
||||
@@ -1247,7 +1247,7 @@ void D3D12Replay::VertexPicking::Init(WrappedID3D12Device *device, D3D12DebugMan
|
||||
}
|
||||
|
||||
{
|
||||
std::string meshhlsl = GetEmbeddedResource(mesh_hlsl);
|
||||
rdcstr meshhlsl = GetEmbeddedResource(mesh_hlsl);
|
||||
|
||||
ID3DBlob *meshPickCS;
|
||||
|
||||
@@ -1420,7 +1420,7 @@ void D3D12Replay::HistogramMinMax::Init(WrappedID3D12Device *device, D3D12DebugM
|
||||
}
|
||||
|
||||
{
|
||||
std::string histogramhlsl = GetEmbeddedResource(histogram_hlsl);
|
||||
rdcstr histogramhlsl = GetEmbeddedResource(histogram_hlsl);
|
||||
|
||||
D3D12_COMPUTE_PIPELINE_STATE_DESC compPipeDesc = {};
|
||||
|
||||
@@ -1439,9 +1439,9 @@ void D3D12Replay::HistogramMinMax::Init(WrappedID3D12Device *device, D3D12DebugM
|
||||
ID3DBlob *result = NULL;
|
||||
ID3DBlob *histogram = NULL;
|
||||
|
||||
std::string hlsl = std::string("#define SHADER_RESTYPE ") + ToStr(t) + "\n";
|
||||
hlsl += std::string("#define UINT_TEX ") + (i == 1 ? "1" : "0") + "\n";
|
||||
hlsl += std::string("#define SINT_TEX ") + (i == 2 ? "1" : "0") + "\n";
|
||||
rdcstr hlsl = rdcstr("#define SHADER_RESTYPE ") + ToStr(t) + "\n";
|
||||
hlsl += rdcstr("#define UINT_TEX ") + (i == 1 ? "1" : "0") + "\n";
|
||||
hlsl += rdcstr("#define SINT_TEX ") + (i == 2 ? "1" : "0") + "\n";
|
||||
hlsl += histogramhlsl;
|
||||
|
||||
shaderCache->GetShaderBlob(hlsl.c_str(), "RENDERDOC_TileMinMaxCS",
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE GetUAVClearHandle(CBVUAVSRVSlot slot);
|
||||
|
||||
void PrepareTextureSampling(ID3D12Resource *resource, CompType typeCast, int &resType,
|
||||
std::vector<D3D12_RESOURCE_BARRIER> &barriers);
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> &barriers);
|
||||
|
||||
MeshDisplayPipelines CacheMeshDisplayPipelines(const MeshFormat &primary,
|
||||
const MeshFormat &secondary);
|
||||
|
||||
@@ -47,13 +47,7 @@ std::map<ID3D12Device *, WrappedID3D12Device *> WrappedID3D12Device::m_DeviceWra
|
||||
|
||||
void WrappedID3D12Device::RemoveQueue(WrappedID3D12CommandQueue *queue)
|
||||
{
|
||||
auto it = std::remove_if(m_Queues.begin(), m_Queues.end(),
|
||||
[queue](const WrappedID3D12CommandQueue *q) { return q == queue; });
|
||||
|
||||
if(it != m_Queues.end())
|
||||
m_Queues.erase(it);
|
||||
else
|
||||
RDCERR("Unknown wrapped queue %p being remvoed", queue);
|
||||
m_Queues.removeOne(queue);
|
||||
}
|
||||
|
||||
rdcstr WrappedID3D12Device::GetChunkName(uint32_t idx)
|
||||
@@ -294,7 +288,7 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
if(realDevice)
|
||||
{
|
||||
m_ResourceList = new std::map<ResourceId, WrappedID3D12Resource1 *>();
|
||||
m_PipelineList = new std::vector<WrappedID3D12PipelineState *>();
|
||||
m_PipelineList = new rdcarray<WrappedID3D12PipelineState *>();
|
||||
}
|
||||
|
||||
m_FrameCaptureRecord = NULL;
|
||||
@@ -337,7 +331,7 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
m_InitParams.AdapterDesc = desc;
|
||||
|
||||
GPUVendor vendor = GPUVendorFromPCIVendor(desc.VendorId);
|
||||
std::string descString = GetDriverVersion(desc);
|
||||
rdcstr descString = GetDriverVersion(desc);
|
||||
|
||||
RDCLOG("New D3D12 device created: %s / %s", ToStr(vendor).c_str(), descString.c_str());
|
||||
|
||||
@@ -955,7 +949,7 @@ void WrappedID3D12Device::FirstFrame(IDXGISwapper *swapper)
|
||||
}
|
||||
}
|
||||
|
||||
void WrappedID3D12Device::ApplyBarriers(std::vector<D3D12_RESOURCE_BARRIER> &barriers)
|
||||
void WrappedID3D12Device::ApplyBarriers(rdcarray<D3D12_RESOURCE_BARRIER> &barriers)
|
||||
{
|
||||
SCOPED_LOCK(m_ResourceStatesLock);
|
||||
GetResourceManager()->ApplyBarriers(barriers, m_ResourceStates);
|
||||
@@ -1076,7 +1070,7 @@ bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(SerialiserType &ser, IDX
|
||||
|
||||
SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()];
|
||||
|
||||
states.resize(1, D3D12_RESOURCE_STATE_PRESENT);
|
||||
states = {D3D12_RESOURCE_STATE_PRESENT};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,7 +1132,7 @@ IUnknown *WrappedID3D12Device::WrapSwapchainBuffer(IDXGISwapper *swapper, DXGI_F
|
||||
SCOPED_LOCK(m_ResourceStatesLock);
|
||||
SubresourceStateVector &states = m_ResourceStates[id];
|
||||
|
||||
states.resize(1, D3D12_RESOURCE_STATE_PRESENT);
|
||||
states = {D3D12_RESOURCE_STATE_PRESENT};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1215,21 +1209,19 @@ void WrappedID3D12Device::Unmap(ID3D12Resource *Resource, UINT Subresource, byte
|
||||
const D3D12_RANGE *pWrittenRange)
|
||||
{
|
||||
MapState map = {};
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_MapsLock);
|
||||
for(auto it = m_Maps.begin(); it != m_Maps.end(); ++it)
|
||||
{
|
||||
if(it->res == Resource && it->subres == Subresource)
|
||||
{
|
||||
map = *it;
|
||||
m_Maps.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
map.res = Resource;
|
||||
map.subres = Subresource;
|
||||
|
||||
if(map.res == NULL)
|
||||
return;
|
||||
int32_t idx = m_Maps.indexOf(map);
|
||||
|
||||
if(idx < 0)
|
||||
return;
|
||||
|
||||
map = m_Maps.takeAt(idx);
|
||||
}
|
||||
|
||||
bool capframe = false;
|
||||
{
|
||||
@@ -1592,7 +1584,7 @@ HRESULT WrappedID3D12Device::Present(ID3D12GraphicsCommandList *pOverlayCommandL
|
||||
list->OMSetRenderTargets(1, &rtv, FALSE, NULL);
|
||||
|
||||
int flags = activeWindow ? RenderDoc::eOverlay_ActiveWindow : 0;
|
||||
std::string overlayText =
|
||||
rdcstr overlayText =
|
||||
RenderDoc::Inst().GetOverlayText(RDCDriver::D3D12, m_FrameCounter, flags);
|
||||
|
||||
if(m_InvalidPSO)
|
||||
@@ -1717,7 +1709,7 @@ bool WrappedID3D12Device::Serialise_CaptureScope(SerialiserType &ser)
|
||||
template <typename SerialiserType>
|
||||
bool WrappedID3D12Device::Serialise_BeginCaptureFrame(SerialiserType &ser)
|
||||
{
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_ResourceStatesLock); // not needed on replay, but harmless also
|
||||
@@ -1870,7 +1862,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
if(swapper != NULL)
|
||||
backbuffer = (ID3D12Resource *)swapper->GetBackbuffers()[swapper->GetLastPresentedBuffer()];
|
||||
|
||||
std::vector<WrappedID3D12CommandQueue *> queues;
|
||||
rdcarray<WrappedID3D12CommandQueue *> queues;
|
||||
|
||||
// transition back to IDLE and readback initial states atomically
|
||||
{
|
||||
@@ -2080,7 +2072,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
{
|
||||
WrappedID3D12CommandQueue *q = *it;
|
||||
|
||||
const std::vector<D3D12ResourceRecord *> &cmdListRecords = q->GetCmdLists();
|
||||
const rdcarray<D3D12ResourceRecord *> &cmdListRecords = q->GetCmdLists();
|
||||
|
||||
RDCDEBUG("Flushing %u command list records from queue %llu", (uint32_t)cmdListRecords.size(),
|
||||
q->GetResourceID());
|
||||
@@ -2150,7 +2142,7 @@ bool WrappedID3D12Device::DiscardFrameCapture(void *dev, void *wnd)
|
||||
|
||||
m_CapturedFrames.pop_back();
|
||||
|
||||
std::vector<WrappedID3D12CommandQueue *> queues;
|
||||
rdcarray<WrappedID3D12CommandQueue *> queues;
|
||||
|
||||
// transition back to IDLE and readback initial states atomically
|
||||
{
|
||||
@@ -2269,7 +2261,7 @@ HRESULT WrappedID3D12Device::CreatePipeState(D3D12_EXPANDED_PIPELINE_STATE_STREA
|
||||
}
|
||||
|
||||
void WrappedID3D12Device::AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src,
|
||||
std::string d)
|
||||
rdcstr d)
|
||||
{
|
||||
D3D12CommandData &cmd = *m_Queue->GetCommandData();
|
||||
|
||||
@@ -2305,9 +2297,9 @@ void WrappedID3D12Device::AddDebugMessage(const DebugMessage &msg)
|
||||
m_DebugMessages.push_back(msg);
|
||||
}
|
||||
|
||||
std::vector<DebugMessage> WrappedID3D12Device::GetDebugMessages()
|
||||
rdcarray<DebugMessage> WrappedID3D12Device::GetDebugMessages()
|
||||
{
|
||||
std::vector<DebugMessage> ret;
|
||||
rdcarray<DebugMessage> ret;
|
||||
|
||||
if(IsActiveReplaying(m_State))
|
||||
{
|
||||
@@ -2392,7 +2384,7 @@ std::vector<DebugMessage> WrappedID3D12Device::GetDebugMessages()
|
||||
}
|
||||
|
||||
msg.messageID = (uint32_t)message->ID;
|
||||
msg.description = std::string(message->pDescription);
|
||||
msg.description = rdcstr(message->pDescription);
|
||||
|
||||
// during capture add all messages. Otherwise only add this message if it's different to the
|
||||
// last one - due to our replay with real and cracked lists we get many duplicated messages
|
||||
@@ -2418,8 +2410,8 @@ std::vector<DebugMessage> WrappedID3D12Device::GetDebugMessages()
|
||||
|
||||
void WrappedID3D12Device::FlushPendingDescriptorWrites()
|
||||
{
|
||||
std::vector<DynamicDescriptorWrite> writes;
|
||||
std::vector<DynamicDescriptorCopy> copies;
|
||||
rdcarray<DynamicDescriptorWrite> writes;
|
||||
rdcarray<DynamicDescriptorCopy> copies;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
@@ -2653,13 +2645,11 @@ void WrappedID3D12Device::FreeRTV(D3D12_CPU_DESCRIPTOR_HANDLE handle)
|
||||
if(handle.ptr == 0)
|
||||
return;
|
||||
|
||||
auto it =
|
||||
std::find_if(m_UsedRTVs.begin(), m_UsedRTVs.end(),
|
||||
[handle](const D3D12_CPU_DESCRIPTOR_HANDLE a) { return a.ptr == handle.ptr; });
|
||||
int32_t idx = m_UsedRTVs.indexOf(handle);
|
||||
|
||||
if(it != m_UsedRTVs.end())
|
||||
if(idx >= 0)
|
||||
{
|
||||
m_UsedRTVs.erase(it);
|
||||
m_UsedRTVs.erase(idx);
|
||||
m_FreeRTVs.push_back(handle);
|
||||
}
|
||||
else
|
||||
@@ -2888,15 +2878,7 @@ void WrappedID3D12Device::ExecuteList(ID3D12GraphicsCommandListX *list,
|
||||
|
||||
void WrappedID3D12Device::MarkListExecuted(ID3D12GraphicsCommandListX *list)
|
||||
{
|
||||
for(auto it = m_InternalCmds.pendingcmds.begin(); it != m_InternalCmds.pendingcmds.end(); ++it)
|
||||
{
|
||||
if(list == *it)
|
||||
{
|
||||
m_InternalCmds.pendingcmds.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_InternalCmds.pendingcmds.removeOne(list);
|
||||
m_InternalCmds.submittedcmds.push_back(list);
|
||||
}
|
||||
|
||||
@@ -2906,7 +2888,7 @@ void WrappedID3D12Device::ExecuteLists(WrappedID3D12CommandQueue *queue, bool In
|
||||
if(m_InternalCmds.pendingcmds.empty())
|
||||
return;
|
||||
|
||||
std::vector<ID3D12CommandList *> cmds;
|
||||
rdcarray<ID3D12CommandList *> cmds;
|
||||
cmds.resize(m_InternalCmds.pendingcmds.size());
|
||||
for(size_t i = 0; i < cmds.size(); i++)
|
||||
cmds[i] = m_InternalCmds.pendingcmds[i];
|
||||
@@ -2916,9 +2898,7 @@ void WrappedID3D12Device::ExecuteLists(WrappedID3D12CommandQueue *queue, bool In
|
||||
|
||||
queue->ExecuteCommandListsInternal((UINT)cmds.size(), &cmds[0], InFrameCaptureBoundary, false);
|
||||
|
||||
m_InternalCmds.submittedcmds.insert(m_InternalCmds.submittedcmds.end(),
|
||||
m_InternalCmds.pendingcmds.begin(),
|
||||
m_InternalCmds.pendingcmds.end());
|
||||
m_InternalCmds.submittedcmds.append(m_InternalCmds.pendingcmds);
|
||||
m_InternalCmds.pendingcmds.clear();
|
||||
}
|
||||
|
||||
@@ -2929,9 +2909,7 @@ void WrappedID3D12Device::FlushLists(bool forceSync, ID3D12CommandQueue *queue)
|
||||
GPUSync(queue);
|
||||
|
||||
if(!m_InternalCmds.submittedcmds.empty())
|
||||
m_InternalCmds.freecmds.insert(m_InternalCmds.freecmds.end(),
|
||||
m_InternalCmds.submittedcmds.begin(),
|
||||
m_InternalCmds.submittedcmds.end());
|
||||
m_InternalCmds.freecmds.append(m_InternalCmds.submittedcmds);
|
||||
m_InternalCmds.submittedcmds.clear();
|
||||
|
||||
if(m_InternalCmds.pendingcmds.empty())
|
||||
@@ -3199,7 +3177,7 @@ ReplayStatus WrappedID3D12Device::ReadLogInitialisation(RDCFile *rdc, bool store
|
||||
|
||||
if(!IsStructuredExporting(m_State))
|
||||
{
|
||||
std::vector<DebugMessage> savedDebugMessages;
|
||||
rdcarray<DebugMessage> savedDebugMessages;
|
||||
|
||||
// save any debug messages we built up
|
||||
savedDebugMessages.swap(m_DebugMessages);
|
||||
|
||||
@@ -358,8 +358,8 @@ private:
|
||||
ID3D12DeviceDownlevel *m_pDownlevel;
|
||||
|
||||
// list of all queues being captured
|
||||
std::vector<WrappedID3D12CommandQueue *> m_Queues;
|
||||
std::vector<ID3D12Fence *> m_QueueFences;
|
||||
rdcarray<WrappedID3D12CommandQueue *> m_Queues;
|
||||
rdcarray<ID3D12Fence *> m_QueueFences;
|
||||
|
||||
// the queue we use for all internal work, the first DIRECT queue
|
||||
WrappedID3D12CommandQueue *m_Queue;
|
||||
@@ -375,13 +375,13 @@ private:
|
||||
WrappedDRED m_DRED;
|
||||
WrappedDREDSettings m_DREDSettings;
|
||||
|
||||
std::vector<ID3D12CommandAllocator *> m_CommandAllocators;
|
||||
rdcarray<ID3D12CommandAllocator *> m_CommandAllocators;
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE AllocRTV();
|
||||
void FreeRTV(D3D12_CPU_DESCRIPTOR_HANDLE handle);
|
||||
|
||||
std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> m_FreeRTVs;
|
||||
std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> m_UsedRTVs;
|
||||
rdcarray<D3D12_CPU_DESCRIPTOR_HANDLE> m_FreeRTVs;
|
||||
rdcarray<D3D12_CPU_DESCRIPTOR_HANDLE> m_UsedRTVs;
|
||||
|
||||
void CreateInternalResources();
|
||||
void DestroyInternalResources();
|
||||
@@ -401,7 +401,7 @@ private:
|
||||
std::map<uint64_t, ID3D12Resource *> m_UploadBuffers;
|
||||
|
||||
Threading::CriticalSection m_MapsLock;
|
||||
std::vector<MapState> m_Maps;
|
||||
rdcarray<MapState> m_Maps;
|
||||
|
||||
bool ProcessChunk(ReadSerialiser &ser, D3D12Chunk context);
|
||||
|
||||
@@ -413,7 +413,7 @@ private:
|
||||
uint64_t threadSerialiserTLSSlot;
|
||||
|
||||
Threading::CriticalSection m_ThreadSerialisersLock;
|
||||
std::vector<WriteSerialiser *> m_ThreadSerialisers;
|
||||
rdcarray<WriteSerialiser *> m_ThreadSerialisers;
|
||||
|
||||
uint64_t tempMemoryTLSSlot;
|
||||
struct TempMem
|
||||
@@ -423,15 +423,15 @@ private:
|
||||
size_t size;
|
||||
};
|
||||
Threading::CriticalSection m_ThreadTempMemLock;
|
||||
std::vector<TempMem *> m_ThreadTempMem;
|
||||
rdcarray<TempMem *> m_ThreadTempMem;
|
||||
|
||||
std::vector<DebugMessage> m_DebugMessages;
|
||||
rdcarray<DebugMessage> m_DebugMessages;
|
||||
|
||||
SDFile *m_StructuredFile = NULL;
|
||||
SDFile m_StoredStructuredData;
|
||||
|
||||
uint32_t m_FrameCounter = 0;
|
||||
std::vector<FrameDescription> m_CapturedFrames;
|
||||
rdcarray<FrameDescription> m_CapturedFrames;
|
||||
rdcarray<DrawcallDescription *> m_Drawcalls;
|
||||
|
||||
ReplayStatus m_FailedReplayStatus = ReplayStatus::APIReplayFailed;
|
||||
@@ -459,9 +459,9 @@ private:
|
||||
D3D12ResourceRecord *m_DeviceRecord;
|
||||
|
||||
Threading::CriticalSection m_DynDescLock;
|
||||
std::vector<DynamicDescriptorCopy> m_DynamicDescriptorCopies;
|
||||
std::vector<DynamicDescriptorWrite> m_DynamicDescriptorWrites;
|
||||
std::vector<D3D12Descriptor> m_DynamicDescriptorRefs;
|
||||
rdcarray<DynamicDescriptorCopy> m_DynamicDescriptorCopies;
|
||||
rdcarray<DynamicDescriptorWrite> m_DynamicDescriptorWrites;
|
||||
rdcarray<D3D12Descriptor> m_DynamicDescriptorRefs;
|
||||
|
||||
GPUAddressRangeTracker m_GPUAddresses;
|
||||
|
||||
@@ -474,11 +474,11 @@ private:
|
||||
|
||||
std::set<ResourceId> m_Cubemaps;
|
||||
|
||||
std::map<ResourceId, std::string> m_ResourceNames;
|
||||
std::map<ResourceId, rdcstr> m_ResourceNames;
|
||||
|
||||
// only valid on replay
|
||||
std::map<ResourceId, WrappedID3D12Resource1 *> *m_ResourceList = NULL;
|
||||
std::vector<WrappedID3D12PipelineState *> *m_PipelineList = NULL;
|
||||
rdcarray<WrappedID3D12PipelineState *> *m_PipelineList = NULL;
|
||||
|
||||
struct SwapPresentInfo
|
||||
{
|
||||
@@ -531,7 +531,7 @@ public:
|
||||
|
||||
// only valid on replay
|
||||
std::map<ResourceId, WrappedID3D12Resource1 *> &GetResourceList() { return *m_ResourceList; }
|
||||
std::vector<WrappedID3D12PipelineState *> &GetPipelineList() { return *m_PipelineList; }
|
||||
rdcarray<WrappedID3D12PipelineState *> &GetPipelineList() { return *m_PipelineList; }
|
||||
////////////////////////////////////////////////////////////////
|
||||
// non wrapping interface
|
||||
|
||||
@@ -551,9 +551,9 @@ public:
|
||||
const DrawcallDescription *GetDrawcall(uint32_t eventId);
|
||||
|
||||
ResourceId GetFrameCaptureResourceId() { return m_FrameCaptureRecord->GetResourceID(); }
|
||||
void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, std::string d);
|
||||
void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, rdcstr d);
|
||||
void AddDebugMessage(const DebugMessage &msg);
|
||||
std::vector<DebugMessage> GetDebugMessages();
|
||||
rdcarray<DebugMessage> GetDebugMessages();
|
||||
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
void AddResource(ResourceId id, ResourceType type, const char *defaultNamePrefix);
|
||||
@@ -562,8 +562,8 @@ public:
|
||||
void AddResourceCurChunk(ResourceDescription &descr);
|
||||
void AddResourceCurChunk(ResourceId id);
|
||||
|
||||
const std::string &GetResourceName(ResourceId id) { return m_ResourceNames[id]; }
|
||||
std::vector<D3D12_RESOURCE_STATES> &GetSubresourceStates(ResourceId id)
|
||||
const rdcstr &GetResourceName(ResourceId id) { return m_ResourceNames[id]; }
|
||||
rdcarray<D3D12_RESOURCE_STATES> &GetSubresourceStates(ResourceId id)
|
||||
{
|
||||
return m_ResourceStates[id];
|
||||
}
|
||||
@@ -585,9 +585,9 @@ public:
|
||||
D3D12Replay *GetReplay() { return m_Replay; }
|
||||
WrappedID3D12CommandQueue *GetQueue() { return m_Queue; }
|
||||
ID3D12CommandAllocator *GetAlloc() { return m_Alloc; }
|
||||
void ApplyBarriers(std::vector<D3D12_RESOURCE_BARRIER> &barriers);
|
||||
void ApplyBarriers(rdcarray<D3D12_RESOURCE_BARRIER> &barriers);
|
||||
|
||||
void GetDynamicDescriptorReferences(std::vector<D3D12Descriptor> &refs)
|
||||
void GetDynamicDescriptorReferences(rdcarray<D3D12Descriptor> &refs)
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorRefs.swap(refs);
|
||||
@@ -616,11 +616,11 @@ public:
|
||||
submittedcmds.clear();
|
||||
}
|
||||
|
||||
std::vector<ID3D12GraphicsCommandListX *> freecmds;
|
||||
rdcarray<ID3D12GraphicsCommandListX *> freecmds;
|
||||
// -> GetNextCmd() ->
|
||||
std::vector<ID3D12GraphicsCommandListX *> pendingcmds;
|
||||
rdcarray<ID3D12GraphicsCommandListX *> pendingcmds;
|
||||
// -> ExecuteLists() ->
|
||||
std::vector<ID3D12GraphicsCommandListX *> submittedcmds;
|
||||
rdcarray<ID3D12GraphicsCommandListX *> submittedcmds;
|
||||
// -> FlushLists()--------back to freecmds--------^
|
||||
} m_InternalCmds;
|
||||
|
||||
@@ -663,7 +663,7 @@ public:
|
||||
bool Serialise_DynamicDescriptorWrite(SerialiserType &ser, const DynamicDescriptorWrite *write);
|
||||
template <typename SerialiserType>
|
||||
bool Serialise_DynamicDescriptorCopies(SerialiserType &ser,
|
||||
const std::vector<DynamicDescriptorCopy> &DescriptorCopies);
|
||||
const rdcarray<DynamicDescriptorCopy> &DescriptorCopies);
|
||||
|
||||
ReplayStatus ReadLogInitialisation(RDCFile *rdc, bool storeStructuredBuffers);
|
||||
void ReplayLog(uint32_t startEventID, uint32_t endEventID, ReplayLogType replayType);
|
||||
@@ -786,9 +786,9 @@ public:
|
||||
UINT Subresource, const D3D12_BOX *pDstBox,
|
||||
const void *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
|
||||
|
||||
std::vector<MapState> GetMaps()
|
||||
rdcarray<MapState> GetMaps()
|
||||
{
|
||||
std::vector<MapState> ret;
|
||||
rdcarray<MapState> ret;
|
||||
{
|
||||
SCOPED_LOCK(m_MapsLock);
|
||||
ret = m_Maps;
|
||||
|
||||
@@ -1346,7 +1346,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource(
|
||||
GetResourceManager()->AddLiveResource(pResource, ret);
|
||||
|
||||
SubresourceStateVector &states = m_ResourceStates[GetResID(ret)];
|
||||
states.resize(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
states.fill(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
|
||||
ResourceType type = ResourceType::Texture;
|
||||
const char *prefix = "Texture";
|
||||
@@ -1461,7 +1461,7 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES
|
||||
SCOPED_LOCK(m_ResourceStatesLock);
|
||||
SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()];
|
||||
|
||||
states.resize(GetNumSubresources(m_pDevice, pDesc), InitialResourceState);
|
||||
states.fill(GetNumSubresources(m_pDevice, pDesc), InitialResourceState);
|
||||
}
|
||||
|
||||
*ppvResource = (ID3D12Resource *)wrapped;
|
||||
@@ -1624,7 +1624,7 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource(
|
||||
GetResourceManager()->AddLiveResource(pResource, ret);
|
||||
|
||||
SubresourceStateVector &states = m_ResourceStates[GetResID(ret)];
|
||||
states.resize(GetNumSubresources(m_pDevice, &Descriptor), InitialState);
|
||||
states.fill(GetNumSubresources(m_pDevice, &Descriptor), InitialState);
|
||||
}
|
||||
|
||||
ResourceType type = ResourceType::Texture;
|
||||
@@ -1736,7 +1736,7 @@ HRESULT WrappedID3D12Device::CreatePlacedResource(ID3D12Heap *pHeap, UINT64 Heap
|
||||
SCOPED_LOCK(m_ResourceStatesLock);
|
||||
SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()];
|
||||
|
||||
states.resize(GetNumSubresources(m_pDevice, pDesc), InitialState);
|
||||
states.fill(GetNumSubresources(m_pDevice, pDesc), InitialState);
|
||||
}
|
||||
|
||||
*ppvResource = (ID3D12Resource *)wrapped;
|
||||
@@ -1962,8 +1962,7 @@ bool WrappedID3D12Device::Serialise_CreateCommandSignature(SerialiserType &ser,
|
||||
WrappedID3D12CommandSignature *wrapped = new WrappedID3D12CommandSignature(ret, this);
|
||||
|
||||
wrapped->sig.ByteStride = Descriptor.ByteStride;
|
||||
wrapped->sig.arguments.insert(wrapped->sig.arguments.begin(), Descriptor.pArgumentDescs,
|
||||
Descriptor.pArgumentDescs + Descriptor.NumArgumentDescs);
|
||||
wrapped->sig.arguments.assign(Descriptor.pArgumentDescs, Descriptor.NumArgumentDescs);
|
||||
|
||||
wrapped->sig.graphics = true;
|
||||
wrapped->sig.numDraws = 0;
|
||||
@@ -2063,7 +2062,7 @@ HRESULT WrappedID3D12Device::CreateSharedHandle(ID3D12DeviceChild *pObject,
|
||||
|
||||
template <typename SerialiserType>
|
||||
bool WrappedID3D12Device::Serialise_DynamicDescriptorCopies(
|
||||
SerialiserType &ser, const std::vector<DynamicDescriptorCopy> &DescriptorCopies)
|
||||
SerialiserType &ser, const rdcarray<DynamicDescriptorCopy> &DescriptorCopies)
|
||||
{
|
||||
SERIALISE_ELEMENT(DescriptorCopies);
|
||||
|
||||
@@ -2107,7 +2106,7 @@ void WrappedID3D12Device::CopyDescriptors(
|
||||
D3D12Descriptor *src = GetWrapped(pSrcDescriptorRangeStarts[0]);
|
||||
D3D12Descriptor *dst = GetWrapped(pDestDescriptorRangeStarts[0]);
|
||||
|
||||
std::vector<DynamicDescriptorCopy> copies;
|
||||
rdcarray<DynamicDescriptorCopy> copies;
|
||||
|
||||
bool capframe = false;
|
||||
|
||||
@@ -2188,7 +2187,7 @@ void WrappedID3D12Device::CopyDescriptors(
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorCopies.insert(m_DynamicDescriptorCopies.end(), copies.begin(), copies.end());
|
||||
m_DynamicDescriptorCopies.append(copies);
|
||||
for(size_t i = 0; i < copies.size(); i++)
|
||||
{
|
||||
copies[i].src->GetHeap()->AddRef();
|
||||
@@ -2255,14 +2254,14 @@ void WrappedID3D12Device::CopyDescriptorsSimple(UINT NumDescriptors,
|
||||
GetResourceManager()->MarkResourceFrameReferenced(desc->GetHeapResourceId(), eFrameRef_Read);
|
||||
}
|
||||
|
||||
std::vector<DynamicDescriptorCopy> copies;
|
||||
rdcarray<DynamicDescriptorCopy> copies;
|
||||
copies.reserve(NumDescriptors);
|
||||
for(UINT i = 0; i < NumDescriptors; i++)
|
||||
copies.push_back(DynamicDescriptorCopy(&dst[i], &src[i], DescriptorHeapsType));
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorCopies.insert(m_DynamicDescriptorCopies.end(), copies.begin(), copies.end());
|
||||
m_DynamicDescriptorCopies.append(copies);
|
||||
for(size_t i = 0; i < copies.size(); i++)
|
||||
{
|
||||
copies[i].src->GetHeap()->AddRef();
|
||||
@@ -2385,7 +2384,7 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE
|
||||
GetResourceManager()->AddLiveResource(resourceId, ret);
|
||||
|
||||
SubresourceStateVector &states = m_ResourceStates[GetResID(ret)];
|
||||
states.resize(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
states.fill(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
|
||||
ResourceType type = ResourceType::Texture;
|
||||
const char *prefix = "Texture";
|
||||
@@ -2557,7 +2556,7 @@ HRESULT WrappedID3D12Device::OpenSharedHandleInternal(D3D12Chunk chunkType, REFI
|
||||
SCOPED_LOCK(m_ResourceStatesLock);
|
||||
SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()];
|
||||
|
||||
states.resize(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
states.fill(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2821,6 +2820,6 @@ INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreateCommandSignatur
|
||||
ID3D12RootSignature *pRootSignature, REFIID riid,
|
||||
void **ppvCommandSignature);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, DynamicDescriptorCopies,
|
||||
const std::vector<DynamicDescriptorCopy> &DescriptorCopies);
|
||||
const rdcarray<DynamicDescriptorCopy> &DescriptorCopies);
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, OpenSharedHandle, HANDLE NTHandle,
|
||||
REFIID riid, void **ppvObj);
|
||||
|
||||
@@ -270,7 +270,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource1(
|
||||
GetResourceManager()->AddLiveResource(pResource, ret);
|
||||
|
||||
SubresourceStateVector &states = m_ResourceStates[GetResID(ret)];
|
||||
states.resize(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
states.fill(GetNumSubresources(m_pDevice, &desc), InitialResourceState);
|
||||
|
||||
ResourceType type = ResourceType::Texture;
|
||||
const char *prefix = "Texture";
|
||||
@@ -375,7 +375,7 @@ HRESULT WrappedID3D12Device::CreateCommittedResource1(
|
||||
SCOPED_LOCK(m_ResourceStatesLock);
|
||||
SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()];
|
||||
|
||||
states.resize(GetNumSubresources(m_pDevice, pDesc), InitialResourceState);
|
||||
states.fill(GetNumSubresources(m_pDevice, pDesc), InitialResourceState);
|
||||
}
|
||||
|
||||
*ppvResource = (ID3D12Resource *)wrapped;
|
||||
|
||||
@@ -107,8 +107,7 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
|
||||
if(nonresident)
|
||||
m_Device->MakeResident(1, &pageable);
|
||||
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states =
|
||||
m_Device->GetSubresourceStates(GetResID(res));
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states = m_Device->GetSubresourceStates(GetResID(res));
|
||||
RDCASSERT(states.size() == 1);
|
||||
|
||||
D3D12_RESOURCE_BARRIER barrier;
|
||||
@@ -212,11 +211,10 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
|
||||
|
||||
ID3D12GraphicsCommandList *list = Unwrap(m_Device->GetInitialStateList());
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
{
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states =
|
||||
m_Device->GetSubresourceStates(GetResID(r));
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states = m_Device->GetSubresourceStates(GetResID(r));
|
||||
|
||||
barriers.reserve(states.size());
|
||||
|
||||
@@ -927,9 +925,9 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live,
|
||||
|
||||
ID3D12GraphicsCommandList *list = Unwrap(m_Device->GetInitialStateList());
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states =
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states =
|
||||
m_Device->GetSubresourceStates(GetResID(live));
|
||||
|
||||
barriers.reserve(states.size());
|
||||
|
||||
@@ -649,7 +649,7 @@ D3D12Descriptor *DescriptorFromPortableHandle(D3D12ResourceManager *manager, Por
|
||||
#define BARRIER_ASSERT(...)
|
||||
#endif
|
||||
|
||||
void D3D12ResourceManager::ApplyBarriers(std::vector<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
void D3D12ResourceManager::ApplyBarriers(rdcarray<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
std::map<ResourceId, SubresourceStateVector> &states)
|
||||
{
|
||||
for(size_t b = 0; b < barriers.size(); b++)
|
||||
@@ -683,7 +683,7 @@ void D3D12ResourceManager::ApplyBarriers(std::vector<D3D12_RESOURCE_BARRIER> &ba
|
||||
|
||||
template <typename SerialiserType>
|
||||
void D3D12ResourceManager::SerialiseResourceStates(SerialiserType &ser,
|
||||
std::vector<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
std::map<ResourceId, SubresourceStateVector> &states)
|
||||
{
|
||||
SERIALISE_ELEMENT_LOCAL(NumMems, (uint32_t)states.size());
|
||||
@@ -720,22 +720,18 @@ void D3D12ResourceManager::SerialiseResourceStates(SerialiserType &ser,
|
||||
}
|
||||
|
||||
// erase any do-nothing barriers
|
||||
for(auto it = barriers.begin(); it != barriers.end();)
|
||||
{
|
||||
if(it->Transition.StateBefore == it->Transition.StateAfter)
|
||||
it = barriers.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
barriers.removeIf([](const D3D12_RESOURCE_BARRIER &barrier) {
|
||||
return barrier.Transition.StateBefore == barrier.Transition.StateAfter;
|
||||
});
|
||||
|
||||
ApplyBarriers(barriers, states);
|
||||
}
|
||||
|
||||
template void D3D12ResourceManager::SerialiseResourceStates(
|
||||
ReadSerialiser &ser, std::vector<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
ReadSerialiser &ser, rdcarray<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
std::map<ResourceId, SubresourceStateVector> &states);
|
||||
template void D3D12ResourceManager::SerialiseResourceStates(
|
||||
WriteSerialiser &ser, std::vector<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
WriteSerialiser &ser, rdcarray<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
std::map<ResourceId, SubresourceStateVector> &states);
|
||||
|
||||
void D3D12ResourceManager::SetInternalResource(ID3D12DeviceChild *res)
|
||||
@@ -766,26 +762,26 @@ void GPUAddressRangeTracker::AddTo(const GPUAddressRange &range)
|
||||
SCOPED_WRITELOCK(addressLock);
|
||||
auto it = std::lower_bound(addresses.begin(), addresses.end(), range.start);
|
||||
|
||||
addresses.insert(it, range);
|
||||
addresses.insert(it - addresses.begin(), range);
|
||||
}
|
||||
|
||||
void GPUAddressRangeTracker::RemoveFrom(const GPUAddressRange &range)
|
||||
{
|
||||
{
|
||||
SCOPED_WRITELOCK(addressLock);
|
||||
auto it = std::lower_bound(addresses.begin(), addresses.end(), range.start);
|
||||
size_t i = std::lower_bound(addresses.begin(), addresses.end(), range.start) - addresses.begin();
|
||||
|
||||
// there might be multiple buffers with the same range start, find the exact range for this
|
||||
// buffer
|
||||
while(it != addresses.end() && it->start == range.start)
|
||||
while(i < addresses.size() && addresses[i].start == range.start)
|
||||
{
|
||||
if(it->id == range.id)
|
||||
if(addresses[i].id == range.id)
|
||||
{
|
||||
addresses.erase(it);
|
||||
addresses.erase(i);
|
||||
return;
|
||||
}
|
||||
|
||||
++it;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ struct D3D12ResourceRecord;
|
||||
|
||||
struct CmdListRecordingInfo
|
||||
{
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
// a list of all resources dirtied by this command list
|
||||
std::set<ResourceId> dirtied;
|
||||
@@ -430,10 +430,10 @@ struct CmdListRecordingInfo
|
||||
// expand a bit more to contain duplicates and then deal with it during frame
|
||||
// capture, than to constantly be deduplicating during record (e.g. with a
|
||||
// set or sorted vector).
|
||||
std::vector<D3D12Descriptor *> boundDescs;
|
||||
rdcarray<D3D12Descriptor *> boundDescs;
|
||||
|
||||
// bundles executed
|
||||
std::vector<D3D12ResourceRecord *> bundles;
|
||||
rdcarray<D3D12ResourceRecord *> bundles;
|
||||
};
|
||||
|
||||
class WrappedID3D12Resource1;
|
||||
@@ -459,7 +459,7 @@ struct GPUAddressRangeTracker
|
||||
GPUAddressRangeTracker(const GPUAddressRangeTracker &);
|
||||
GPUAddressRangeTracker &operator=(const GPUAddressRangeTracker &);
|
||||
|
||||
std::vector<GPUAddressRange> addresses;
|
||||
rdcarray<GPUAddressRange> addresses;
|
||||
Threading::RWLock addressLock;
|
||||
|
||||
void AddTo(const GPUAddressRange &range);
|
||||
@@ -472,6 +472,8 @@ struct MapState
|
||||
ID3D12Resource *res;
|
||||
UINT subres;
|
||||
UINT64 totalSize;
|
||||
|
||||
bool operator==(const MapState &o) { return res == o.res && subres == o.subres; }
|
||||
};
|
||||
|
||||
struct D3D12ResourceRecord : public ResourceRecord
|
||||
@@ -524,7 +526,7 @@ struct D3D12ResourceRecord : public ResourceRecord
|
||||
Threading::CriticalSection m_MapLock;
|
||||
};
|
||||
|
||||
typedef std::vector<D3D12_RESOURCE_STATES> SubresourceStateVector;
|
||||
typedef rdcarray<D3D12_RESOURCE_STATES> SubresourceStateVector;
|
||||
|
||||
struct D3D12InitialContents
|
||||
{
|
||||
@@ -638,11 +640,11 @@ public:
|
||||
return (T *)GetCurrentResource(id);
|
||||
}
|
||||
|
||||
void ApplyBarriers(std::vector<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
void ApplyBarriers(rdcarray<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
std::map<ResourceId, SubresourceStateVector> &states);
|
||||
|
||||
template <typename SerialiserType>
|
||||
void SerialiseResourceStates(SerialiserType &ser, std::vector<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
void SerialiseResourceStates(SerialiserType &ser, rdcarray<D3D12_RESOURCE_BARRIER> &barriers,
|
||||
std::map<ResourceId, SubresourceStateVector> &states);
|
||||
|
||||
template <typename SerialiserType>
|
||||
|
||||
@@ -214,7 +214,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, CompType typeCast, Float
|
||||
|
||||
D3D12_RESOURCE_DESC resourceDesc = resource->GetDesc();
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
int resType = 0;
|
||||
GetDebugManager()->PrepareTextureSampling(resource, typeCast, resType, barriers);
|
||||
|
||||
@@ -305,10 +305,10 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, CompType typeCast, Float
|
||||
|
||||
ID3D12GraphicsCommandList *list = m_pDevice->GetNewList();
|
||||
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states =
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states =
|
||||
m_pDevice->GetSubresourceStates(GetResID(realDepth));
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> depthBarriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> depthBarriers;
|
||||
depthBarriers.reserve(states.size());
|
||||
for(size_t i = 0; i < states.size(); i++)
|
||||
{
|
||||
@@ -659,7 +659,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, CompType typeCast, Float
|
||||
list->Close();
|
||||
list = NULL;
|
||||
|
||||
std::vector<D3D12Descriptor> rts = rs.rts;
|
||||
rdcarray<D3D12Descriptor> rts = rs.rts;
|
||||
|
||||
if(overlay == DebugOverlay::ClearBeforePass)
|
||||
m_pDevice->ReplayLog(0, events[0], eReplay_WithoutDraw);
|
||||
|
||||
@@ -249,7 +249,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<D3D12_SO_DECLARATION_ENTRY> sodecls;
|
||||
rdcarray<D3D12_SO_DECLARATION_ENTRY> sodecls;
|
||||
|
||||
UINT stride = 0;
|
||||
int posidx = -1;
|
||||
@@ -290,8 +290,8 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
if(posidx > 0)
|
||||
{
|
||||
D3D12_SO_DECLARATION_ENTRY pos = sodecls[posidx];
|
||||
sodecls.erase(sodecls.begin() + posidx);
|
||||
sodecls.insert(sodecls.begin(), pos);
|
||||
sodecls.erase(posidx);
|
||||
sodecls.insert(0, pos);
|
||||
}
|
||||
|
||||
// set up stream output entries and buffers
|
||||
@@ -399,7 +399,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
GetBufferData(rs.ibuffer.buf, rs.ibuffer.offs + drawcall->indexOffset * rs.ibuffer.bytewidth,
|
||||
RDCMIN(drawcall->numIndices * rs.ibuffer.bytewidth, rs.ibuffer.size), idxdata);
|
||||
|
||||
std::vector<uint32_t> indices;
|
||||
rdcarray<uint32_t> indices;
|
||||
|
||||
uint16_t *idx16 = (uint16_t *)&idxdata[0];
|
||||
uint32_t *idx32 = (uint32_t *)&idxdata[0];
|
||||
@@ -430,13 +430,13 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
if(it != indices.end() && *it == i32)
|
||||
continue;
|
||||
|
||||
indices.insert(it, i32);
|
||||
indices.insert(it - indices.begin(), i32);
|
||||
}
|
||||
|
||||
// if we read out of bounds, we'll also have a 0 index being referenced
|
||||
// (as 0 is read). Don't insert 0 if we already have 0 though
|
||||
if(numIndices < drawcall->numIndices && (indices.empty() || indices[0] != 0))
|
||||
indices.insert(indices.begin(), 0);
|
||||
indices.insert(0, 0);
|
||||
|
||||
// An index buffer could be something like: 500, 501, 502, 501, 503, 502
|
||||
// in which case we can't use the existing index buffer without filling 499 slots of vertex
|
||||
@@ -817,8 +817,8 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
if(posidx > 0)
|
||||
{
|
||||
D3D12_SO_DECLARATION_ENTRY pos = sodecls[posidx];
|
||||
sodecls.erase(sodecls.begin() + posidx);
|
||||
sodecls.insert(sodecls.begin(), pos);
|
||||
sodecls.erase(posidx);
|
||||
sodecls.insert(0, pos);
|
||||
}
|
||||
|
||||
// enable the other shader stages again
|
||||
@@ -1137,7 +1137,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
uint64_t *counters = (uint64_t *)byteData;
|
||||
|
||||
uint64_t numBytesWritten = 0;
|
||||
std::vector<D3D12PostVSData::InstData> instData;
|
||||
rdcarray<D3D12PostVSData::InstData> instData;
|
||||
if(drawcall->numInstances > 1)
|
||||
{
|
||||
uint64_t prevByteCount = 0;
|
||||
|
||||
@@ -796,7 +796,7 @@ void D3D12Replay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secon
|
||||
|
||||
if(!inactiveVertices.empty())
|
||||
{
|
||||
std::vector<FloatVector> inactiveVB;
|
||||
rdcarray<FloatVector> inactiveVB;
|
||||
inactiveVB.reserve(inactiveVertices.size() * 4);
|
||||
|
||||
for(size_t i = 0; i < inactiveVertices.size(); i++)
|
||||
|
||||
@@ -116,7 +116,7 @@ D3D12TextRenderer::D3D12TextRenderer(WrappedID3D12Device *wrapper)
|
||||
|
||||
rm->SetInternalResource(Tex);
|
||||
|
||||
std::string font = GetEmbeddedResource(sourcecodepro_ttf);
|
||||
rdcstr font = GetEmbeddedResource(sourcecodepro_ttf);
|
||||
byte *ttfdata = (byte *)font.c_str();
|
||||
|
||||
const int firstChar = int(' ') + 1;
|
||||
@@ -288,7 +288,7 @@ D3D12TextRenderer::D3D12TextRenderer(WrappedID3D12Device *wrapper)
|
||||
|
||||
ConstRingIdx = 0;
|
||||
|
||||
std::vector<D3D12_ROOT_PARAMETER1> rootSig;
|
||||
rdcarray<D3D12_ROOT_PARAMETER1> rootSig;
|
||||
D3D12_ROOT_PARAMETER1 param = {};
|
||||
|
||||
// Constants
|
||||
@@ -356,7 +356,7 @@ D3D12TextRenderer::D3D12TextRenderer(WrappedID3D12Device *wrapper)
|
||||
|
||||
SAFE_RELEASE(root);
|
||||
|
||||
std::string hlsl = GetEmbeddedResource(text_hlsl);
|
||||
rdcstr hlsl = GetEmbeddedResource(text_hlsl);
|
||||
|
||||
ID3DBlob *TextVS = NULL;
|
||||
ID3DBlob *TextPS = NULL;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompType typeCast,
|
||||
int &resType,
|
||||
std::vector<D3D12_RESOURCE_BARRIER> &barriers)
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> &barriers)
|
||||
{
|
||||
int srvOffset = 0;
|
||||
|
||||
@@ -169,8 +169,7 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
|
||||
}
|
||||
|
||||
// transition resource to D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states =
|
||||
m_pDevice->GetSubresourceStates(GetResID(resource));
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(GetResID(resource));
|
||||
|
||||
barriers.reserve(states.size());
|
||||
for(size_t i = 0; i < states.size(); i++)
|
||||
@@ -459,7 +458,7 @@ bool D3D12Replay::RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, Texture
|
||||
pixelData.Slice = float(
|
||||
RDCCLAMP(cfg.subresource.slice, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1)) + 0.001f);
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
int resType = 0;
|
||||
GetDebugManager()->PrepareTextureSampling(resource, cfg.typeCast, resType, barriers);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ void D3D12Replay::Initialise(IDXGIFactory1 *factory)
|
||||
|
||||
m_DriverInfo.vendor = GPUVendorFromPCIVendor(desc.VendorId);
|
||||
|
||||
std::string descString = GetDriverVersion(desc);
|
||||
rdcstr descString = GetDriverVersion(desc);
|
||||
descString.resize(RDCMIN(descString.size(), ARRAY_COUNT(m_DriverInfo.version) - 1));
|
||||
memcpy(m_DriverInfo.version, descString.c_str(), descString.size());
|
||||
|
||||
@@ -347,7 +347,7 @@ BufferDescription D3D12Replay::GetBuffer(ResourceId id)
|
||||
|
||||
ret.creationFlags = BufferCategory::NoFlags;
|
||||
|
||||
const std::vector<EventUsage> &usage = m_pDevice->GetQueue()->GetUsage(id);
|
||||
const rdcarray<EventUsage> &usage = m_pDevice->GetQueue()->GetUsage(id);
|
||||
|
||||
for(size_t i = 0; i < usage.size(); i++)
|
||||
{
|
||||
@@ -560,13 +560,13 @@ rdcstr D3D12Replay::DisassembleShader(ResourceId pipeline, const ShaderReflectio
|
||||
}
|
||||
else
|
||||
return "; Unknown error fetching disassembly, invalid string returned\n\n\n" +
|
||||
std::string(data, data + size);
|
||||
rdcstr((char *)data, size);
|
||||
|
||||
std::string contents;
|
||||
rdcstr contents;
|
||||
|
||||
// decode the <shader><comment> tags
|
||||
if(!strncmp((char *)iter, "<shader", 7))
|
||||
contents = std::string((char *)iter, (char *)iter + strlen((char *)iter));
|
||||
contents = (char *)iter;
|
||||
else if(!wcsncmp((wchar_t *)iter, L"<shader", 7))
|
||||
contents = StringFormat::Wide2UTF8((wchar_t *)iter);
|
||||
|
||||
@@ -585,9 +585,9 @@ rdcstr D3D12Replay::DisassembleShader(ResourceId pipeline, const ShaderReflectio
|
||||
default: return "; Unknown shader stage in shader reflection\n";
|
||||
}
|
||||
|
||||
size_t idx = contents.find(search);
|
||||
int32_t idx = contents.find(search);
|
||||
|
||||
if(idx == std::string::npos)
|
||||
if(idx < 0)
|
||||
return "; Couldn't find disassembly for given shader stage in returned string\n\n\n" + contents;
|
||||
|
||||
idx += 11; // stage=".S">
|
||||
@@ -602,9 +602,9 @@ rdcstr D3D12Replay::DisassembleShader(ResourceId pipeline, const ShaderReflectio
|
||||
|
||||
idx += 10; // <![CDATA[\n
|
||||
|
||||
size_t end = contents.find("]]></comment>", idx);
|
||||
int32_t end = contents.find("]]></comment>", idx);
|
||||
|
||||
if(end == std::string::npos)
|
||||
if(end < 0)
|
||||
return "; Unknown error fetching disassembly, invalid string returned\n\n\n" + contents;
|
||||
|
||||
return contents.substr(idx, end - idx);
|
||||
@@ -1895,7 +1895,7 @@ uint32_t D3D12Replay::PickVertex(uint32_t eventId, int32_t width, int32_t height
|
||||
bytebuf idxs;
|
||||
GetBufferData(cfg.position.indexResourceId, cfg.position.indexByteOffset, 0, idxs);
|
||||
|
||||
std::vector<uint32_t> outidxs;
|
||||
rdcarray<uint32_t> outidxs;
|
||||
outidxs.resize(cfg.position.numIndices);
|
||||
|
||||
uint16_t *idxs16 = (uint16_t *)&idxs[0];
|
||||
@@ -2033,7 +2033,7 @@ uint32_t D3D12Replay::PickVertex(uint32_t eventId, int32_t width, int32_t height
|
||||
m_pDevice->CreateShaderResourceView(NULL, &sdesc, GetDebugManager()->GetCPUHandle(PICK_VB_SRV));
|
||||
}
|
||||
|
||||
std::vector<FloatVector> vbData;
|
||||
rdcarray<FloatVector> vbData;
|
||||
vbData.resize(maxIndex + 1);
|
||||
|
||||
byte *data = &oldData[0];
|
||||
@@ -2300,7 +2300,7 @@ bool D3D12Replay::GetMinMax(ResourceId texid, const Subresource &sub, CompType t
|
||||
int blocksY = (int)ceil(cdata.HistogramTextureResolution.y /
|
||||
float(HGRAM_PIXELS_PER_TILE * HGRAM_TILES_PER_BLOCK));
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
int resType = 0;
|
||||
GetDebugManager()->PrepareTextureSampling(resource, typeCast, resType, barriers);
|
||||
|
||||
@@ -2496,7 +2496,7 @@ bool D3D12Replay::GetHistogram(ResourceId texid, const Subresource &sub, CompTyp
|
||||
int tilesY = (int)ceil(cdata.HistogramTextureResolution.y /
|
||||
float(HGRAM_PIXELS_PER_TILE * HGRAM_TILES_PER_BLOCK));
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
int resType = 0;
|
||||
GetDebugManager()->PrepareTextureSampling(resource, typeCast, resType, barriers);
|
||||
|
||||
@@ -2724,7 +2724,7 @@ void D3D12Replay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, r
|
||||
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
|
||||
|
||||
WrappedID3D12RootSignature *sig = NULL;
|
||||
const std::vector<D3D12RenderState::SignatureElement> *sigElems = NULL;
|
||||
const rdcarray<D3D12RenderState::SignatureElement> *sigElems = NULL;
|
||||
|
||||
if(refl.stage == ShaderStage::Compute && rs.compute.rootsig != ResourceId())
|
||||
{
|
||||
@@ -2806,7 +2806,7 @@ void D3D12Replay::BuildShader(ShaderEncoding sourceEncoding, const bytebuf &sour
|
||||
return;
|
||||
}
|
||||
|
||||
std::string hlsl;
|
||||
rdcstr hlsl;
|
||||
hlsl.assign((const char *)source.data(), source.size());
|
||||
|
||||
ID3DBlob *blob = NULL;
|
||||
@@ -2875,7 +2875,7 @@ void D3D12Replay::RefreshDerivedReplacements()
|
||||
|
||||
// we defer deletes of old replaced resources since it will invalidate elements in the vector
|
||||
// we're iterating
|
||||
std::vector<ID3D12PipelineState *> deletequeue;
|
||||
rdcarray<ID3D12PipelineState *> deletequeue;
|
||||
|
||||
for(WrappedID3D12PipelineState *pipe : m_pDevice->GetPipelineList())
|
||||
{
|
||||
@@ -3196,9 +3196,9 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
list = m_pDevice->GetNewList();
|
||||
|
||||
// put source texture into resolve source state
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(tex);
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(tex);
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
barriers.reserve(states.size());
|
||||
for(size_t i = 0; i < states.size(); i++)
|
||||
{
|
||||
@@ -3264,9 +3264,9 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
list = m_pDevice->GetNewList();
|
||||
|
||||
// put source texture into shader read state
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(tex);
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(tex);
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
barriers.reserve(states.size());
|
||||
for(size_t i = 0; i < states.size(); i++)
|
||||
{
|
||||
@@ -3324,12 +3324,12 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
if(list == NULL)
|
||||
list = m_pDevice->GetNewList();
|
||||
|
||||
std::vector<D3D12_RESOURCE_BARRIER> barriers;
|
||||
rdcarray<D3D12_RESOURCE_BARRIER> barriers;
|
||||
|
||||
// if we have no tmpImage, we're copying directly from the real image
|
||||
if(tmpTexture == NULL)
|
||||
{
|
||||
const std::vector<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(tex);
|
||||
const rdcarray<D3D12_RESOURCE_STATES> &states = m_pDevice->GetSubresourceStates(tex);
|
||||
barriers.reserve(states.size());
|
||||
for(size_t i = 0; i < states.size(); i++)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ void WrappedID3D12Shader::TryReplaceOriginalByteCode()
|
||||
{
|
||||
if(!DXBC::DXBCContainer::CheckForDebugInfo((const void *)&m_Bytecode[0], m_Bytecode.size()))
|
||||
{
|
||||
std::string originalPath = m_DebugInfoPath;
|
||||
rdcstr originalPath = m_DebugInfoPath;
|
||||
|
||||
if(originalPath.empty())
|
||||
originalPath =
|
||||
@@ -59,7 +59,7 @@ void WrappedID3D12Shader::TryReplaceOriginalByteCode()
|
||||
|
||||
size_t numSearchPaths = m_DebugInfoSearchPaths ? m_DebugInfoSearchPaths->size() : 0;
|
||||
|
||||
std::string foundPath;
|
||||
rdcstr foundPath;
|
||||
|
||||
// while we haven't found a file, keep trying through the search paths. For i==0
|
||||
// check the path on its own, in case it's an absolute path.
|
||||
@@ -73,7 +73,7 @@ void WrappedID3D12Shader::TryReplaceOriginalByteCode()
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string &searchPath = (*m_DebugInfoSearchPaths)[i - 1];
|
||||
const rdcstr &searchPath = (*m_DebugInfoSearchPaths)[i - 1];
|
||||
foundPath = searchPath + "/" + originalPath;
|
||||
originalShaderFile = FileIO::fopen(foundPath.c_str(), "rb");
|
||||
}
|
||||
@@ -88,7 +88,7 @@ void WrappedID3D12Shader::TryReplaceOriginalByteCode()
|
||||
|
||||
if(lz4 || originalShaderSize >= m_Bytecode.size())
|
||||
{
|
||||
std::vector<byte> originalBytecode;
|
||||
rdcarray<byte> originalBytecode;
|
||||
|
||||
originalBytecode.resize((size_t)originalShaderSize);
|
||||
FileIO::fread(&originalBytecode[0], sizeof(byte), (size_t)originalShaderSize,
|
||||
@@ -96,7 +96,7 @@ void WrappedID3D12Shader::TryReplaceOriginalByteCode()
|
||||
|
||||
if(lz4)
|
||||
{
|
||||
std::vector<byte> decompressed;
|
||||
rdcarray<byte> decompressed;
|
||||
|
||||
// first try decompressing to 1MB flat
|
||||
decompressed.resize(100 * 1024);
|
||||
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
else if(guid == WKPDID_D3DDebugObjectNameW)
|
||||
{
|
||||
rdcwstr wName((const wchar_t *)pData, DataSize / 2);
|
||||
std::string sName = StringFormat::Wide2UTF8(wName);
|
||||
rdcstr sName = StringFormat::Wide2UTF8(wName);
|
||||
m_pDevice->SetName(this, sName.c_str());
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public:
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetName(LPCWSTR Name)
|
||||
{
|
||||
std::string utf8 = Name ? StringFormat::Wide2UTF8(Name) : "";
|
||||
rdcstr utf8 = Name ? StringFormat::Wide2UTF8(Name) : "";
|
||||
m_pDevice->SetName(this, utf8.c_str());
|
||||
|
||||
if(!m_pReal)
|
||||
@@ -682,8 +682,7 @@ public:
|
||||
ShaderEntry(const D3D12_SHADER_BYTECODE &byteCode, WrappedID3D12Device *device)
|
||||
: WrappedDeviceChild12(NULL, device), m_Key(byteCode)
|
||||
{
|
||||
const byte *code = (const byte *)byteCode.pShaderBytecode;
|
||||
m_Bytecode.assign(code, code + byteCode.BytecodeLength);
|
||||
m_Bytecode.assign((const byte *)byteCode.pShaderBytecode, byteCode.BytecodeLength);
|
||||
m_DebugInfoSearchPaths = NULL;
|
||||
m_DXBCFile = NULL;
|
||||
|
||||
@@ -736,7 +735,7 @@ public:
|
||||
}
|
||||
|
||||
DXBCKey GetKey() { return m_Key; }
|
||||
void SetDebugInfoPath(std::vector<std::string> *searchPaths, const std::string &path)
|
||||
void SetDebugInfoPath(rdcarray<rdcstr> *searchPaths, const rdcstr &path)
|
||||
{
|
||||
m_DebugInfoSearchPaths = searchPaths;
|
||||
m_DebugInfoPath = path;
|
||||
@@ -784,10 +783,10 @@ public:
|
||||
|
||||
DXBCKey m_Key;
|
||||
|
||||
std::string m_DebugInfoPath;
|
||||
std::vector<std::string> *m_DebugInfoSearchPaths;
|
||||
rdcstr m_DebugInfoPath;
|
||||
rdcarray<rdcstr> *m_DebugInfoSearchPaths;
|
||||
|
||||
std::vector<byte> m_Bytecode;
|
||||
rdcarray<byte> m_Bytecode;
|
||||
|
||||
bool m_Built;
|
||||
DXBC::DXBCContainer *m_DXBCFile;
|
||||
@@ -817,8 +816,7 @@ public:
|
||||
virtual ~WrappedID3D12PipelineState()
|
||||
{
|
||||
if(IsReplayMode(m_pDevice->GetState()))
|
||||
m_pDevice->GetPipelineList().erase(std::find(m_pDevice->GetPipelineList().begin(),
|
||||
m_pDevice->GetPipelineList().end(), this));
|
||||
m_pDevice->GetPipelineList().removeOne(this);
|
||||
|
||||
Shutdown();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ rdcstr DoStringise(const D3D12ComponentMapping &el)
|
||||
{
|
||||
RDCCOMPILE_ASSERT(sizeof(D3D12ComponentMapping) == sizeof(uint32_t), "Enum isn't uint sized");
|
||||
|
||||
std::string ret;
|
||||
rdcstr ret;
|
||||
|
||||
// value should always be <= 5, see D3D12_SHADER_COMPONENT_MAPPING
|
||||
const char mapping[] = {'R', 'G', 'B', 'A', '0', '1', '?', '!'};
|
||||
|
||||
@@ -80,13 +80,13 @@ struct D3D12BlobShaderCallbacks
|
||||
|
||||
struct EmbeddedD3D12Includer : public ID3DInclude
|
||||
{
|
||||
std::string texsample = GetEmbeddedResource(hlsl_texsample_h);
|
||||
std::string cbuffers = GetEmbeddedResource(hlsl_cbuffers_h);
|
||||
rdcstr texsample = GetEmbeddedResource(hlsl_texsample_h);
|
||||
rdcstr cbuffers = GetEmbeddedResource(hlsl_cbuffers_h);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Open(D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName,
|
||||
LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) override
|
||||
{
|
||||
std::string *str;
|
||||
rdcstr *str;
|
||||
|
||||
if(!strcmp(pFileName, "hlsl_texsample.h"))
|
||||
str = &texsample;
|
||||
@@ -128,9 +128,9 @@ D3D12ShaderCache::~D3D12ShaderCache()
|
||||
}
|
||||
}
|
||||
|
||||
std::string D3D12ShaderCache::GetShaderBlob(const char *source, const char *entry,
|
||||
const uint32_t compileFlags, const char *profile,
|
||||
ID3DBlob **srcblob)
|
||||
rdcstr D3D12ShaderCache::GetShaderBlob(const char *source, const char *entry,
|
||||
const uint32_t compileFlags, const char *profile,
|
||||
ID3DBlob **srcblob)
|
||||
{
|
||||
EmbeddedD3D12Includer includer;
|
||||
|
||||
@@ -172,13 +172,13 @@ std::string D3D12ShaderCache::GetShaderBlob(const char *source, const char *entr
|
||||
hr = compileFunc(source, strlen(source), entry, NULL, &includer, entry, profile, flags, 0,
|
||||
&byteBlob, &errBlob);
|
||||
|
||||
std::string errors = "";
|
||||
rdcstr errors = "";
|
||||
|
||||
if(errBlob)
|
||||
{
|
||||
errors = (char *)errBlob->GetBufferPointer();
|
||||
|
||||
std::string logerror = errors;
|
||||
rdcstr logerror = errors;
|
||||
if(logerror.length() > 1024)
|
||||
logerror = logerror.substr(0, 1024) + "...";
|
||||
|
||||
@@ -270,8 +270,7 @@ D3D12RootSignature D3D12ShaderCache::GetRootSig(const void *data, size_t dataSiz
|
||||
|
||||
if(desc->NumStaticSamplers > 0)
|
||||
{
|
||||
ret.StaticSamplers.assign(desc->pStaticSamplers,
|
||||
desc->pStaticSamplers + desc->NumStaticSamplers);
|
||||
ret.StaticSamplers.assign(desc->pStaticSamplers, desc->NumStaticSamplers);
|
||||
|
||||
for(size_t i = 0; i < ret.StaticSamplers.size(); i++)
|
||||
ret.maxSpaceIndex = RDCMAX(ret.maxSpaceIndex, ret.StaticSamplers[i].RegisterSpace + 1);
|
||||
@@ -329,7 +328,7 @@ D3D12RootSignature D3D12ShaderCache::GetRootSig(const void *data, size_t dataSiz
|
||||
|
||||
if(desc->NumStaticSamplers > 0)
|
||||
{
|
||||
ret.StaticSamplers.assign(desc->pStaticSamplers, desc->pStaticSamplers + desc->NumStaticSamplers);
|
||||
ret.StaticSamplers.assign(desc->pStaticSamplers, desc->NumStaticSamplers);
|
||||
|
||||
for(size_t i = 0; i < ret.StaticSamplers.size(); i++)
|
||||
ret.maxSpaceIndex = RDCMAX(ret.maxSpaceIndex, ret.StaticSamplers[i].RegisterSpace + 1);
|
||||
@@ -340,7 +339,7 @@ D3D12RootSignature D3D12ShaderCache::GetRootSig(const void *data, size_t dataSiz
|
||||
return ret;
|
||||
}
|
||||
|
||||
ID3DBlob *D3D12ShaderCache::MakeRootSig(const std::vector<D3D12_ROOT_PARAMETER1> ¶ms,
|
||||
ID3DBlob *D3D12ShaderCache::MakeRootSig(const rdcarray<D3D12_ROOT_PARAMETER1> ¶ms,
|
||||
D3D12_ROOT_SIGNATURE_FLAGS Flags, UINT NumStaticSamplers,
|
||||
const D3D12_STATIC_SAMPLER_DESC *StaticSamplers)
|
||||
{
|
||||
@@ -368,7 +367,7 @@ ID3DBlob *D3D12ShaderCache::MakeRootSig(const std::vector<D3D12_ROOT_PARAMETER1>
|
||||
desc.pStaticSamplers = StaticSamplers;
|
||||
desc.NumParameters = (UINT)params.size();
|
||||
|
||||
std::vector<D3D12_ROOT_PARAMETER> params_1_0;
|
||||
rdcarray<D3D12_ROOT_PARAMETER> params_1_0;
|
||||
params_1_0.resize(params.size());
|
||||
for(size_t i = 0; i < params.size(); i++)
|
||||
{
|
||||
@@ -426,9 +425,9 @@ ID3DBlob *D3D12ShaderCache::MakeRootSig(const std::vector<D3D12_ROOT_PARAMETER1>
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
std::string errors = (char *)errBlob->GetBufferPointer();
|
||||
rdcstr errors = (char *)errBlob->GetBufferPointer();
|
||||
|
||||
std::string logerror = errors;
|
||||
rdcstr logerror = errors;
|
||||
if(logerror.length() > 1024)
|
||||
logerror = logerror.substr(0, 1024) + "...";
|
||||
|
||||
@@ -460,9 +459,9 @@ ID3DBlob *D3D12ShaderCache::MakeRootSig(const std::vector<D3D12_ROOT_PARAMETER1>
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
std::string errors = (char *)errBlob->GetBufferPointer();
|
||||
rdcstr errors = (char *)errBlob->GetBufferPointer();
|
||||
|
||||
std::string logerror = errors;
|
||||
rdcstr logerror = errors;
|
||||
if(logerror.length() > 1024)
|
||||
logerror = logerror.substr(0, 1024) + "...";
|
||||
|
||||
@@ -480,7 +479,7 @@ ID3DBlob *D3D12ShaderCache::MakeRootSig(const std::vector<D3D12_ROOT_PARAMETER1>
|
||||
|
||||
ID3DBlob *D3D12ShaderCache::MakeRootSig(const D3D12RootSignature &rootsig)
|
||||
{
|
||||
std::vector<D3D12_ROOT_PARAMETER1> params;
|
||||
rdcarray<D3D12_ROOT_PARAMETER1> params;
|
||||
params.resize(rootsig.Parameters.size());
|
||||
for(size_t i = 0; i < params.size(); i++)
|
||||
params[i] = rootsig.Parameters[i];
|
||||
@@ -492,7 +491,7 @@ ID3DBlob *D3D12ShaderCache::MakeRootSig(const D3D12RootSignature &rootsig)
|
||||
ID3DBlob *D3D12ShaderCache::MakeFixedColShader(float overlayConsts[4])
|
||||
{
|
||||
ID3DBlob *ret = NULL;
|
||||
std::string hlsl =
|
||||
rdcstr hlsl =
|
||||
StringFormat::Fmt("float4 main() : SV_Target0 { return float4(%f, %f, %f, %f); }\n",
|
||||
overlayConsts[0], overlayConsts[1], overlayConsts[2], overlayConsts[3]);
|
||||
GetShaderBlob(hlsl.c_str(), "main", D3DCOMPILE_WARNINGS_ARE_ERRORS, "ps_5_0", &ret);
|
||||
|
||||
@@ -38,11 +38,11 @@ public:
|
||||
D3D12ShaderCache();
|
||||
~D3D12ShaderCache();
|
||||
|
||||
std::string GetShaderBlob(const char *source, const char *entry, const uint32_t compileFlags,
|
||||
const char *profile, ID3DBlob **srcblob);
|
||||
rdcstr GetShaderBlob(const char *source, const char *entry, const uint32_t compileFlags,
|
||||
const char *profile, ID3DBlob **srcblob);
|
||||
|
||||
D3D12RootSignature GetRootSig(const void *data, size_t dataSize);
|
||||
ID3DBlob *MakeRootSig(const std::vector<D3D12_ROOT_PARAMETER1> ¶ms,
|
||||
ID3DBlob *MakeRootSig(const rdcarray<D3D12_ROOT_PARAMETER1> ¶ms,
|
||||
D3D12_ROOT_SIGNATURE_FLAGS Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE,
|
||||
UINT NumStaticSamplers = 0,
|
||||
const D3D12_STATIC_SAMPLER_DESC *StaticSamplers = NULL);
|
||||
|
||||
@@ -136,7 +136,7 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
|
||||
D3D12MarkerRegion region(m_pDevice->GetQueue()->GetReal(), "CalculateSampleGather");
|
||||
|
||||
std::string funcRet = "";
|
||||
rdcstr funcRet = "";
|
||||
DXGI_FORMAT retFmt = DXGI_FORMAT_UNKNOWN;
|
||||
|
||||
if(opcode == OPCODE_SAMPLE_C || opcode == OPCODE_SAMPLE_C_LZ || opcode == OPCODE_GATHER4_C ||
|
||||
@@ -146,13 +146,13 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
funcRet = "float4";
|
||||
}
|
||||
|
||||
std::string samplerDecl = "";
|
||||
rdcstr samplerDecl = "";
|
||||
if(samplerData.mode == SAMPLER_MODE_DEFAULT)
|
||||
samplerDecl = "SamplerState s";
|
||||
else if(samplerData.mode == SAMPLER_MODE_COMPARISON)
|
||||
samplerDecl = "SamplerComparisonState s";
|
||||
|
||||
std::string textureDecl = "";
|
||||
rdcstr textureDecl = "";
|
||||
int texdim = 2;
|
||||
int offsetDim = 2;
|
||||
bool useOffsets = true;
|
||||
@@ -385,17 +385,17 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
StringFormat::snprintf(buf3, 255, formats[offsetDim + texdimOffs - 1][ddyType], ddyCalc.value.i.x,
|
||||
ddyCalc.value.i.y, ddyCalc.value.i.z, ddyCalc.value.i.w);
|
||||
|
||||
std::string texcoords = buf;
|
||||
std::string ddx = buf2;
|
||||
std::string ddy = buf3;
|
||||
rdcstr texcoords = buf;
|
||||
rdcstr ddx = buf2;
|
||||
rdcstr ddy = buf3;
|
||||
|
||||
if(opcode == OPCODE_LD_MS)
|
||||
{
|
||||
StringFormat::snprintf(buf, 255, formats[0][1], multisampleIndex);
|
||||
}
|
||||
|
||||
std::string sampleIdx = buf;
|
||||
std::string offsets = "";
|
||||
rdcstr sampleIdx = buf;
|
||||
rdcstr offsets = "";
|
||||
|
||||
if(useOffsets)
|
||||
{
|
||||
@@ -412,13 +412,13 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
}
|
||||
|
||||
char elems[] = "xyzw";
|
||||
std::string strSwizzle = ".";
|
||||
rdcstr strSwizzle = ".";
|
||||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
strSwizzle += elems[swizzle[i]];
|
||||
}
|
||||
|
||||
std::string strGatherChannel;
|
||||
rdcstr strGatherChannel;
|
||||
switch(gatherChannel)
|
||||
{
|
||||
case ShaderDebug::GatherChannel::Red: strGatherChannel = "Red"; break;
|
||||
@@ -427,11 +427,11 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
case ShaderDebug::GatherChannel::Alpha: strGatherChannel = "Alpha"; break;
|
||||
}
|
||||
|
||||
std::string vsProgram = "float4 main(uint id : SV_VertexID) : SV_Position {\n";
|
||||
rdcstr vsProgram = "float4 main(uint id : SV_VertexID) : SV_Position {\n";
|
||||
vsProgram += "return float4((id == 2) ? 3.0f : -1.0f, (id == 0) ? -3.0f : 1.0f, 0.5, 1.0);\n";
|
||||
vsProgram += "}";
|
||||
|
||||
std::string sampleProgram;
|
||||
rdcstr sampleProgram;
|
||||
|
||||
UINT texSlot = resourceData.slot;
|
||||
UINT sampSlot = samplerData.slot;
|
||||
@@ -460,7 +460,7 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
// these operations need derivatives but have no hlsl function to call to provide them, so
|
||||
// we fake it in the vertex shader
|
||||
|
||||
std::string uvDim = "1";
|
||||
rdcstr uvDim = "1";
|
||||
uvDim[0] += char(texdim + texdimOffs - 1);
|
||||
|
||||
vsProgram = "void main(uint id : SV_VertexID, out float4 pos : SV_Position, out float" + uvDim +
|
||||
@@ -471,19 +471,19 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
|
||||
uv.value.f.x + ddyCalc.value.f.x * 2.0f, uv.value.f.y + ddyCalc.value.f.y * 2.0f,
|
||||
uv.value.f.z + ddyCalc.value.f.z * 2.0f, uv.value.f.w + ddyCalc.value.f.w * 2.0f);
|
||||
|
||||
vsProgram += "if(id == 0) uv = " + std::string(buf) + ";\n";
|
||||
vsProgram += "if(id == 0) uv = " + rdcstr(buf) + ";\n";
|
||||
|
||||
StringFormat::snprintf(buf, 255, formats[texdim + texdimOffs - 1][texcoordType], uv.value.f.x,
|
||||
uv.value.f.y, uv.value.f.z, uv.value.f.w);
|
||||
|
||||
vsProgram += "if(id == 1) uv = " + std::string(buf) + ";\n";
|
||||
vsProgram += "if(id == 1) uv = " + rdcstr(buf) + ";\n";
|
||||
|
||||
StringFormat::snprintf(
|
||||
buf, 255, formats[texdim + texdimOffs - 1][texcoordType],
|
||||
uv.value.f.x + ddxCalc.value.f.x * 2.0f, uv.value.f.y + ddxCalc.value.f.y * 2.0f,
|
||||
uv.value.f.z + ddxCalc.value.f.z * 2.0f, uv.value.f.w + ddxCalc.value.f.w * 2.0f);
|
||||
|
||||
vsProgram += "if(id == 2) uv = " + std::string(buf) + ";\n";
|
||||
vsProgram += "if(id == 2) uv = " + rdcstr(buf) + ";\n";
|
||||
|
||||
vsProgram += "pos = float4((id == 2) ? 3.0f : -1.0f, (id == 0) ? -3.0f : 1.0f, 0.5, 1.0);\n";
|
||||
vsProgram += "}";
|
||||
@@ -1052,10 +1052,10 @@ ShaderDebugTrace D3D12Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
prevDxbc = vs->GetDXBC();
|
||||
}
|
||||
|
||||
std::vector<PSInputElement> initialValues;
|
||||
std::vector<std::string> floatInputs;
|
||||
std::vector<std::string> inputVarNames;
|
||||
std::string extractHlsl;
|
||||
rdcarray<PSInputElement> initialValues;
|
||||
rdcarray<rdcstr> floatInputs;
|
||||
rdcarray<rdcstr> inputVarNames;
|
||||
rdcstr extractHlsl;
|
||||
int structureStride = 0;
|
||||
|
||||
ShaderDebug::GatherPSInputDataForInitialValues(*dxbc->GetReflection(), *prevDxbc->GetReflection(),
|
||||
@@ -1125,7 +1125,7 @@ void ExtractInputsPS(PSInput IN, float4 debug_pixelPos : SV_Position, uint prim
|
||||
|
||||
for(size_t i = 0; i < floatInputs.size(); i++)
|
||||
{
|
||||
const std::string &name = floatInputs[i];
|
||||
const rdcstr &name = floatInputs[i];
|
||||
extractHlsl += " PSInitialBuffer[idx].INddx." + name + " = ddx(IN." + name + ");\n";
|
||||
extractHlsl += " PSInitialBuffer[idx].INddy." + name + " = ddy(IN." + name + ");\n";
|
||||
extractHlsl += " PSInitialBuffer[idx].INddxfine." + name + " = ddx_fine(IN." + name + ");\n";
|
||||
@@ -1501,7 +1501,7 @@ void ExtractInputsPS(PSInput IN, float4 debug_pixelPos : SV_Position, uint prim
|
||||
ApplyAllDerivatives(global, traces, destIdx, initialValues, (float *)data);
|
||||
}
|
||||
|
||||
std::vector<ShaderDebugState> states;
|
||||
rdcarray<ShaderDebugState> states;
|
||||
|
||||
if(dxbc->GetDebugInfo())
|
||||
dxbc->GetDebugInfo()->GetLocals(0, dxbc->GetDXBCByteCode()->GetInstruction(0).offset,
|
||||
|
||||
@@ -55,9 +55,9 @@ D3D12RenderState &D3D12RenderState::operator=(const D3D12RenderState &o)
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<ResourceId> D3D12RenderState::GetRTVIDs() const
|
||||
rdcarray<ResourceId> D3D12RenderState::GetRTVIDs() const
|
||||
{
|
||||
std::vector<ResourceId> ret;
|
||||
rdcarray<ResourceId> ret;
|
||||
|
||||
for(UINT i = 0; i < rts.size(); i++)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ void D3D12RenderState::ApplyState(WrappedID3D12Device *dev, ID3D12GraphicsComman
|
||||
|
||||
void D3D12RenderState::ApplyDescriptorHeaps(ID3D12GraphicsCommandListX *cmd) const
|
||||
{
|
||||
std::vector<ID3D12DescriptorHeap *> descHeaps;
|
||||
rdcarray<ID3D12DescriptorHeap *> descHeaps;
|
||||
descHeaps.resize(heaps.size());
|
||||
|
||||
for(size_t i = 0; i < heaps.size(); i++)
|
||||
@@ -194,8 +194,7 @@ void D3D12RenderState::ApplyComputeRootElements(ID3D12GraphicsCommandListX *cmd)
|
||||
{
|
||||
// just don't set tables that aren't in the descriptor heaps, since it's invalid and can crash
|
||||
// and is probably just from stale bindings that aren't going to be used
|
||||
if(compute.sigelems[i].type != eRootTable ||
|
||||
std::find(heaps.begin(), heaps.end(), compute.sigelems[i].id) != heaps.end())
|
||||
if(compute.sigelems[i].type != eRootTable || heaps.contains(compute.sigelems[i].id))
|
||||
{
|
||||
compute.sigelems[i].SetToCompute(GetResourceManager(), cmd, (UINT)i);
|
||||
}
|
||||
@@ -213,8 +212,7 @@ void D3D12RenderState::ApplyGraphicsRootElements(ID3D12GraphicsCommandListX *cmd
|
||||
{
|
||||
// just don't set tables that aren't in the descriptor heaps, since it's invalid and can crash
|
||||
// and is probably just from stale bindings that aren't going to be used
|
||||
if(graphics.sigelems[i].type != eRootTable ||
|
||||
std::find(heaps.begin(), heaps.end(), graphics.sigelems[i].id) != heaps.end())
|
||||
if(graphics.sigelems[i].type != eRootTable || heaps.contains(graphics.sigelems[i].id))
|
||||
{
|
||||
graphics.sigelems[i].SetToGraphics(GetResourceManager(), cmd, (UINT)i);
|
||||
}
|
||||
|
||||
@@ -51,20 +51,20 @@ struct D3D12RenderState
|
||||
void ApplyComputeRootElements(ID3D12GraphicsCommandListX *cmd) const;
|
||||
void ApplyGraphicsRootElements(ID3D12GraphicsCommandListX *cmd) const;
|
||||
|
||||
std::vector<D3D12_VIEWPORT> views;
|
||||
std::vector<D3D12_RECT> scissors;
|
||||
rdcarray<D3D12_VIEWPORT> views;
|
||||
rdcarray<D3D12_RECT> scissors;
|
||||
|
||||
// these are D3D12Descriptor copies since the values of the descriptors are read during
|
||||
// OMSetRenderTargets and may not exist anywhere after that if they are immediately overwritten.
|
||||
std::vector<D3D12Descriptor> rts;
|
||||
rdcarray<D3D12Descriptor> rts;
|
||||
D3D12Descriptor dsv;
|
||||
|
||||
bool renderpass = false;
|
||||
std::vector<D3D12_RENDER_PASS_RENDER_TARGET_DESC> rpRTs;
|
||||
rdcarray<D3D12_RENDER_PASS_RENDER_TARGET_DESC> rpRTs;
|
||||
D3D12_RENDER_PASS_DEPTH_STENCIL_DESC rpDSV;
|
||||
D3D12_RENDER_PASS_FLAGS rpFlags;
|
||||
|
||||
std::vector<ResourceId> GetRTVIDs() const;
|
||||
rdcarray<ResourceId> GetRTVIDs() const;
|
||||
ResourceId GetDSVID() const;
|
||||
|
||||
ResourceId shadingRateImage;
|
||||
@@ -150,10 +150,10 @@ struct D3D12RenderState
|
||||
|
||||
ResourceId id;
|
||||
UINT64 offset;
|
||||
std::vector<UINT> constants;
|
||||
rdcarray<UINT> constants;
|
||||
};
|
||||
|
||||
std::vector<ResourceId> heaps;
|
||||
rdcarray<ResourceId> heaps;
|
||||
|
||||
struct StreamOut
|
||||
{
|
||||
@@ -164,13 +164,13 @@ struct D3D12RenderState
|
||||
ResourceId countbuf;
|
||||
UINT64 countoffs;
|
||||
};
|
||||
std::vector<StreamOut> streamouts;
|
||||
rdcarray<StreamOut> streamouts;
|
||||
|
||||
struct RootSignature
|
||||
{
|
||||
ResourceId rootsig;
|
||||
|
||||
std::vector<SignatureElement> sigelems;
|
||||
rdcarray<SignatureElement> sigelems;
|
||||
} compute, graphics;
|
||||
|
||||
ResourceId pipe;
|
||||
@@ -180,7 +180,7 @@ struct D3D12RenderState
|
||||
struct SamplePositions
|
||||
{
|
||||
UINT NumSamplesPerPixel, NumPixels;
|
||||
std::vector<D3D12_SAMPLE_POSITION> Positions;
|
||||
rdcarray<D3D12_SAMPLE_POSITION> Positions;
|
||||
} samplePos;
|
||||
|
||||
D3D12_PRIMITIVE_TOPOLOGY topo = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
|
||||
@@ -204,7 +204,7 @@ struct D3D12RenderState
|
||||
UINT stride;
|
||||
UINT size;
|
||||
};
|
||||
std::vector<VertBuffer> vbuffers;
|
||||
rdcarray<VertBuffer> vbuffers;
|
||||
|
||||
D3D12ResourceManager *GetResourceManager() const { return m_ResourceManager; }
|
||||
D3D12ResourceManager *m_ResourceManager = NULL;
|
||||
|
||||
Reference in New Issue
Block a user