mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Remove D3D lock, instead use thread-local serialisers
This commit is contained in:
@@ -347,8 +347,12 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
|
||||
m_ReplayList->Serialise_SetComputeRootUnorderedAccessView(0, D3D12_GPU_VIRTUAL_ADDRESS());
|
||||
break;
|
||||
|
||||
case DYN_DESC_WRITE: m_pDevice->Serialise_DynamicDescriptorWrite(NULL); break;
|
||||
case DYN_DESC_COPIES: m_pDevice->Serialise_DynamicDescriptorCopies(NULL); break;
|
||||
case DYN_DESC_WRITE:
|
||||
m_pDevice->Serialise_DynamicDescriptorWrite(m_pDevice->GetMainSerialiser(), NULL);
|
||||
break;
|
||||
case DYN_DESC_COPIES:
|
||||
m_pDevice->Serialise_DynamicDescriptorCopies(m_pDevice->GetMainSerialiser(), NULL);
|
||||
break;
|
||||
|
||||
case EXECUTE_CMD_LISTS: Serialise_ExecuteCommandLists(0, NULL); break;
|
||||
case SIGNAL: Serialise_Signal(NULL, 0); break;
|
||||
|
||||
@@ -33,6 +33,13 @@
|
||||
#include "d3d12_command_queue.h"
|
||||
#include "d3d12_resources.h"
|
||||
|
||||
// use locally cached serialiser, per-thread
|
||||
#undef GET_SERIALISER
|
||||
#define GET_SERIALISER localSerialiser
|
||||
|
||||
// must be at the start of any function that serialises
|
||||
#define CACHE_THREAD_SERIALISER() Serialiser *localSerialiser = GetThreadSerialiser();
|
||||
|
||||
WRAPPED_POOL_INST(WrappedID3D12Device);
|
||||
|
||||
const char *D3D12ChunkNames[] = {
|
||||
@@ -49,6 +56,8 @@ D3D12InitParams::D3D12InitParams()
|
||||
|
||||
ReplayCreateStatus D3D12InitParams::Serialise()
|
||||
{
|
||||
Serialiser *localSerialiser = GetSerialiser();
|
||||
|
||||
SERIALISE_ELEMENT(uint32_t, ver, D3D12_SERIALISE_VERSION);
|
||||
SerialiseVersion = ver;
|
||||
|
||||
@@ -58,7 +67,7 @@ ReplayCreateStatus D3D12InitParams::Serialise()
|
||||
return eReplayCreate_APIIncompatibleVersion;
|
||||
}
|
||||
|
||||
m_pSerialiser->Serialise("MinimumFeatureLevel", MinimumFeatureLevel);
|
||||
localSerialiser->Serialise("MinimumFeatureLevel", MinimumFeatureLevel);
|
||||
|
||||
return eReplayCreate_Success;
|
||||
}
|
||||
@@ -181,6 +190,8 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
|
||||
m_AppControlledCapture = false;
|
||||
|
||||
threadSerialiserTLSSlot = Threading::AllocateTLSSlot();
|
||||
|
||||
m_FrameCounter = 0;
|
||||
|
||||
m_HeaderChunk = NULL;
|
||||
@@ -327,6 +338,9 @@ WrappedID3D12Device::~WrappedID3D12Device()
|
||||
|
||||
SAFE_DELETE(m_pSerialiser);
|
||||
|
||||
for(size_t i = 0; i < m_ThreadSerialisers.size(); i++)
|
||||
delete m_ThreadSerialisers[i];
|
||||
|
||||
if(RenderDoc::Inst().GetCrashHandler())
|
||||
RenderDoc::Inst().GetCrashHandler()->UnregisterMemoryRegion(this);
|
||||
}
|
||||
@@ -526,7 +540,8 @@ void WrappedID3D12Device::ReleaseSwapchainResources(WrappedIDXGISwapChain3 *swap
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(WrappedIDXGISwapChain3 *swap,
|
||||
bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(Serialiser *localSerialiser,
|
||||
WrappedIDXGISwapChain3 *swap,
|
||||
DXGI_SWAP_CHAIN_DESC *swapDesc, UINT buffer,
|
||||
IUnknown *realSurface)
|
||||
{
|
||||
@@ -621,11 +636,11 @@ IUnknown *WrappedID3D12Device::WrapSwapchainBuffer(WrappedIDXGISwapChain3 *swap,
|
||||
|
||||
wrapped->SetResourceRecord(record);
|
||||
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_SWAP_BUFFER);
|
||||
|
||||
Serialise_WrapSwapchainBuffer(swap, swapDesc, buffer, pRes);
|
||||
Serialise_WrapSwapchainBuffer(localSerialiser, swap, swapDesc, buffer, pRes);
|
||||
|
||||
record->AddChunk(scope.Get());
|
||||
|
||||
@@ -763,7 +778,8 @@ HRESULT WrappedID3D12Device::Present(WrappedIDXGISwapChain3 *swap, UINT SyncInte
|
||||
void WrappedID3D12Device::Serialise_CaptureScope(uint64_t offset)
|
||||
{
|
||||
uint32_t FrameNumber = m_FrameCounter;
|
||||
m_pSerialiser->Serialise("FrameNumber", FrameNumber);
|
||||
// must use main serialiser here to match resource manager below
|
||||
GetMainSerialiser()->Serialise("FrameNumber", FrameNumber);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
@@ -813,12 +829,15 @@ bool WrappedID3D12Device::Serialise_BeginCaptureFrame(bool applyInitialState)
|
||||
|
||||
void WrappedID3D12Device::EndCaptureFrame(ID3D12Resource *presentImage)
|
||||
{
|
||||
// must use main serialiser here to match resource manager
|
||||
Serialiser *localSerialiser = GetMainSerialiser();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CONTEXT_CAPTURE_FOOTER);
|
||||
|
||||
SERIALISE_ELEMENT(ResourceId, bbid, GetResID(presentImage));
|
||||
|
||||
bool HasCallstack = RenderDoc::Inst().GetCaptureOptions().CaptureCallstacks != 0;
|
||||
m_pSerialiser->Serialise("HasCallstack", HasCallstack);
|
||||
localSerialiser->Serialise("HasCallstack", HasCallstack);
|
||||
|
||||
if(HasCallstack)
|
||||
{
|
||||
@@ -829,7 +848,7 @@ void WrappedID3D12Device::EndCaptureFrame(ID3D12Resource *presentImage)
|
||||
size_t numLevels = call->NumLevels();
|
||||
uint64_t *stack = (uint64_t *)call->GetAddrs();
|
||||
|
||||
m_pSerialiser->SerialisePODArray("callstack", stack, numLevels);
|
||||
localSerialiser->SerialisePODArray("callstack", stack, numLevels);
|
||||
|
||||
delete call;
|
||||
}
|
||||
@@ -869,6 +888,9 @@ void WrappedID3D12Device::StartFrameCapture(void *dev, void *wnd)
|
||||
m_FrameCaptureRecord->DeleteChunks();
|
||||
|
||||
{
|
||||
// must use main serialiser here to match resource manager
|
||||
Serialiser *localSerialiser = GetMainSerialiser();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CONTEXT_CAPTURE_HEADER);
|
||||
|
||||
Serialise_BeginCaptureFrame(false);
|
||||
@@ -1147,6 +1169,8 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
m_FrameCounter, &m_InitParams, jpgbuf, len, thwidth, thheight);
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DEVICE_INIT);
|
||||
|
||||
m_pFileSerialiser->Insert(scope.Get(true));
|
||||
@@ -1161,6 +1185,8 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
RDCDEBUG("Creating Capture Scope");
|
||||
|
||||
{
|
||||
Serialiser *localSerialiser = GetMainSerialiser();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CAPTURE_SCOPE);
|
||||
|
||||
Serialise_CaptureScope(0);
|
||||
@@ -1228,7 +1254,8 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_ReleaseResource(ID3D12DeviceChild *res)
|
||||
bool WrappedID3D12Device::Serialise_ReleaseResource(Serialiser *localSerialiser,
|
||||
ID3D12DeviceChild *res)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1260,7 +1287,7 @@ void WrappedID3D12Device::FlushPendingDescriptorWrites()
|
||||
std::vector<DynamicDescriptorCopy> copies;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
writes.swap(m_DynamicDescriptorWrites);
|
||||
copies.swap(m_DynamicDescriptorCopies);
|
||||
}
|
||||
@@ -1272,11 +1299,12 @@ void WrappedID3D12Device::FlushPendingDescriptorWrites()
|
||||
copies[i].dst->CopyFrom(*copies[i].src);
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_SetShaderDebugPath(ID3D12DeviceChild *res, const char *p)
|
||||
bool WrappedID3D12Device::Serialise_SetShaderDebugPath(Serialiser *localSerialiser,
|
||||
ID3D12DeviceChild *res, const char *p)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, resource, GetResID(res));
|
||||
string debugPath = p ? p : "";
|
||||
m_pSerialiser->Serialise("debugPath", debugPath);
|
||||
localSerialiser->Serialise("debugPath", debugPath);
|
||||
|
||||
if(m_State < WRITING && GetResourceManager()->HasLiveResource(resource))
|
||||
{
|
||||
@@ -1300,8 +1328,10 @@ HRESULT WrappedID3D12Device::SetShaderDebugPath(ID3D12DeviceChild *res, const ch
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(SET_SHADER_DEBUG_PATH);
|
||||
Serialise_SetShaderDebugPath(res, path);
|
||||
Serialise_SetShaderDebugPath(localSerialiser, res, path);
|
||||
record->AddChunk(scope.Get());
|
||||
}
|
||||
|
||||
@@ -1311,11 +1341,12 @@ HRESULT WrappedID3D12Device::SetShaderDebugPath(ID3D12DeviceChild *res, const ch
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_SetResourceName(ID3D12DeviceChild *res, const char *nm)
|
||||
bool WrappedID3D12Device::Serialise_SetResourceName(Serialiser *localSerialiser,
|
||||
ID3D12DeviceChild *res, const char *nm)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, resource, GetResID(res));
|
||||
string name = nm ? nm : "";
|
||||
m_pSerialiser->Serialise("name", name);
|
||||
localSerialiser->Serialise("name", name);
|
||||
|
||||
if(m_State < WRITING && GetResourceManager()->HasLiveResource(resource))
|
||||
{
|
||||
@@ -1341,11 +1372,12 @@ void WrappedID3D12Device::SetResourceName(ID3D12DeviceChild *res, const char *na
|
||||
if(record == NULL)
|
||||
record = m_DeviceRecord;
|
||||
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(SET_RESOURCE_NAME);
|
||||
|
||||
Serialise_SetResourceName(res, name);
|
||||
Serialise_SetResourceName(localSerialiser, res, name);
|
||||
|
||||
// don't serialise many SetResourceName chunks to the
|
||||
// object record, but we can't afford to drop any.
|
||||
@@ -1370,6 +1402,35 @@ void WrappedID3D12Device::SetResourceName(ID3D12DeviceChild *res, const char *na
|
||||
}
|
||||
}
|
||||
|
||||
Serialiser *WrappedID3D12Device::GetThreadSerialiser()
|
||||
{
|
||||
Serialiser *ser = (Serialiser *)Threading::GetTLSValue(threadSerialiserTLSSlot);
|
||||
if(ser)
|
||||
return ser;
|
||||
|
||||
// slow path, but rare
|
||||
|
||||
#if defined(RELEASE)
|
||||
const bool debugSerialiser = false;
|
||||
#else
|
||||
const bool debugSerialiser = true;
|
||||
#endif
|
||||
|
||||
ser = new Serialiser(NULL, Serialiser::WRITING, debugSerialiser);
|
||||
ser->SetUserData(m_ResourceManager);
|
||||
|
||||
ser->SetChunkNameLookup(&GetChunkName);
|
||||
|
||||
Threading::SetTLSValue(threadSerialiserTLSSlot, (void *)ser);
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_ThreadSerialisersLock);
|
||||
m_ThreadSerialisers.push_back(ser);
|
||||
}
|
||||
|
||||
return ser;
|
||||
}
|
||||
|
||||
void WrappedID3D12Device::CreateInternalResources()
|
||||
{
|
||||
CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator),
|
||||
@@ -1502,33 +1563,55 @@ void WrappedID3D12Device::ProcessChunk(uint64_t offset, D3D12ChunkType context)
|
||||
case DEVICE_INIT: { break;
|
||||
}
|
||||
|
||||
case CREATE_COMMAND_QUEUE: Serialise_CreateCommandQueue(NULL, IID(), NULL); break;
|
||||
case CREATE_COMMAND_QUEUE:
|
||||
Serialise_CreateCommandQueue(GetMainSerialiser(), NULL, IID(), NULL);
|
||||
break;
|
||||
case CREATE_COMMAND_ALLOCATOR:
|
||||
Serialise_CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID(), NULL);
|
||||
Serialise_CreateCommandAllocator(GetMainSerialiser(), D3D12_COMMAND_LIST_TYPE_DIRECT, IID(),
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case CREATE_GRAPHICS_PIPE: Serialise_CreateGraphicsPipelineState(NULL, IID(), NULL); break;
|
||||
case CREATE_COMPUTE_PIPE: Serialise_CreateComputePipelineState(NULL, IID(), NULL); break;
|
||||
case CREATE_DESCRIPTOR_HEAP: Serialise_CreateDescriptorHeap(NULL, IID(), NULL); break;
|
||||
case CREATE_ROOT_SIG: Serialise_CreateRootSignature(0, NULL, 0, IID(), NULL); break;
|
||||
case CREATE_COMMAND_SIG: Serialise_CreateCommandSignature(NULL, NULL, IID(), NULL); break;
|
||||
case CREATE_GRAPHICS_PIPE:
|
||||
Serialise_CreateGraphicsPipelineState(GetMainSerialiser(), NULL, IID(), NULL);
|
||||
break;
|
||||
case CREATE_COMPUTE_PIPE:
|
||||
Serialise_CreateComputePipelineState(GetMainSerialiser(), NULL, IID(), NULL);
|
||||
break;
|
||||
case CREATE_DESCRIPTOR_HEAP:
|
||||
Serialise_CreateDescriptorHeap(GetMainSerialiser(), NULL, IID(), NULL);
|
||||
break;
|
||||
case CREATE_ROOT_SIG:
|
||||
Serialise_CreateRootSignature(GetMainSerialiser(), 0, NULL, 0, IID(), NULL);
|
||||
break;
|
||||
case CREATE_COMMAND_SIG:
|
||||
Serialise_CreateCommandSignature(GetMainSerialiser(), NULL, NULL, IID(), NULL);
|
||||
break;
|
||||
|
||||
case CREATE_HEAP: Serialise_CreateHeap(NULL, IID(), NULL); break;
|
||||
case CREATE_HEAP: Serialise_CreateHeap(GetMainSerialiser(), NULL, IID(), NULL); break;
|
||||
case CREATE_COMMITTED_RESOURCE:
|
||||
Serialise_CreateCommittedResource(NULL, D3D12_HEAP_FLAG_NONE, NULL,
|
||||
Serialise_CreateCommittedResource(GetMainSerialiser(), NULL, D3D12_HEAP_FLAG_NONE, NULL,
|
||||
D3D12_RESOURCE_STATE_COMMON, NULL, IID(), NULL);
|
||||
break;
|
||||
case CREATE_PLACED_RESOURCE:
|
||||
Serialise_CreatePlacedResource(NULL, 0, NULL, D3D12_RESOURCE_STATE_COMMON, NULL, IID(), NULL);
|
||||
Serialise_CreatePlacedResource(GetMainSerialiser(), NULL, 0, NULL,
|
||||
D3D12_RESOURCE_STATE_COMMON, NULL, IID(), NULL);
|
||||
break;
|
||||
|
||||
case CREATE_QUERY_HEAP: Serialise_CreateQueryHeap(NULL, IID(), NULL); break;
|
||||
case CREATE_FENCE: Serialise_CreateFence(0, D3D12_FENCE_FLAG_NONE, IID(), NULL); break;
|
||||
case CREATE_QUERY_HEAP:
|
||||
Serialise_CreateQueryHeap(GetMainSerialiser(), NULL, IID(), NULL);
|
||||
break;
|
||||
case CREATE_FENCE:
|
||||
Serialise_CreateFence(GetMainSerialiser(), 0, D3D12_FENCE_FLAG_NONE, IID(), NULL);
|
||||
break;
|
||||
|
||||
case SET_RESOURCE_NAME: Serialise_SetResourceName(0x0, ""); break;
|
||||
case SET_SHADER_DEBUG_PATH: Serialise_SetShaderDebugPath(NULL, NULL); break;
|
||||
case RELEASE_RESOURCE: Serialise_ReleaseResource(0x0); break;
|
||||
case CREATE_SWAP_BUFFER: Serialise_WrapSwapchainBuffer(NULL, NULL, 0, NULL); break;
|
||||
case SET_RESOURCE_NAME: Serialise_SetResourceName(GetMainSerialiser(), 0x0, ""); break;
|
||||
case SET_SHADER_DEBUG_PATH:
|
||||
Serialise_SetShaderDebugPath(GetMainSerialiser(), NULL, NULL);
|
||||
break;
|
||||
case RELEASE_RESOURCE: Serialise_ReleaseResource(GetMainSerialiser(), 0x0); break;
|
||||
case CREATE_SWAP_BUFFER:
|
||||
Serialise_WrapSwapchainBuffer(GetMainSerialiser(), NULL, NULL, 0, NULL);
|
||||
break;
|
||||
case CAPTURE_SCOPE: Serialise_CaptureScope(offset); break;
|
||||
default:
|
||||
// ignore system chunks
|
||||
|
||||
@@ -214,6 +214,10 @@ struct DummyID3D12DebugDevice : public ID3D12DebugDevice
|
||||
|
||||
class WrappedID3D12CommandQueue;
|
||||
|
||||
#define IMPLEMENT_FUNCTION_THREAD_SERIALISED(ret, func, ...) \
|
||||
ret func(__VA_ARGS__); \
|
||||
bool CONCAT(Serialise_, func(Serialiser *localSerialiser, __VA_ARGS__));
|
||||
|
||||
class WrappedID3D12Device : public IFrameCapturer, public ID3DDevice, public ID3D12Device
|
||||
{
|
||||
private:
|
||||
@@ -245,6 +249,13 @@ private:
|
||||
RefCounter12<ID3D12Device> m_SoftRefCounter;
|
||||
bool m_Alive;
|
||||
|
||||
uint64_t threadSerialiserTLSSlot;
|
||||
|
||||
Threading::CriticalSection m_ThreadSerialisersLock;
|
||||
vector<Serialiser *> m_ThreadSerialisers;
|
||||
|
||||
Serialiser *GetThreadSerialiser();
|
||||
|
||||
uint32_t m_FrameCounter;
|
||||
vector<FetchFrameInfo> m_CapturedFrames;
|
||||
FetchFrameRecord m_FrameRecord;
|
||||
@@ -259,16 +270,13 @@ private:
|
||||
D3D12InitParams m_InitParams;
|
||||
ID3D12InfoQueue *m_pInfoQueue;
|
||||
|
||||
// ensure all calls in via the D3D wrapped interface are thread safe
|
||||
// protects wrapped resource creation and serialiser access
|
||||
Threading::CriticalSection m_D3DLock;
|
||||
|
||||
D3D12ResourceRecord *m_FrameCaptureRecord;
|
||||
Chunk *m_HeaderChunk;
|
||||
|
||||
ResourceId m_ResourceID;
|
||||
D3D12ResourceRecord *m_DeviceRecord;
|
||||
|
||||
Threading::CriticalSection m_DynDescLock;
|
||||
std::vector<DynamicDescriptorCopy> m_DynamicDescriptorCopies;
|
||||
std::vector<DynamicDescriptorWrite> m_DynamicDescriptorWrites;
|
||||
|
||||
@@ -317,7 +325,7 @@ public:
|
||||
static const char *GetChunkName(uint32_t idx);
|
||||
D3D12ResourceManager *GetResourceManager() { return m_ResourceManager; }
|
||||
D3D12DebugManager *GetDebugManager() { return m_DebugManager; }
|
||||
Serialiser *GetSerialiser() { return m_pSerialiser; }
|
||||
Serialiser *GetMainSerialiser() { return m_pSerialiser; }
|
||||
ResourceId GetResourceID() { return m_ResourceID; }
|
||||
Threading::CriticalSection &GetCapTransitionLock() { return m_CapTransitionLock; }
|
||||
void ReleaseSwapchainResources(IDXGISwapChain *swap, IUnknown **backbuffers, int numBackbuffers);
|
||||
@@ -367,8 +375,10 @@ public:
|
||||
|
||||
bool Serialise_BeginCaptureFrame(bool applyInitialState);
|
||||
|
||||
bool Serialise_DynamicDescriptorWrite(const DynamicDescriptorWrite *write);
|
||||
bool Serialise_DynamicDescriptorCopies(const std::vector<DynamicDescriptorCopy> *copies);
|
||||
bool Serialise_DynamicDescriptorWrite(Serialiser *localSerialiser,
|
||||
const DynamicDescriptorWrite *write);
|
||||
bool Serialise_DynamicDescriptorCopies(Serialiser *localSerialiser,
|
||||
const std::vector<DynamicDescriptorCopy> *copies);
|
||||
|
||||
void ReadLogInitialisation();
|
||||
void ReplayLog(uint32_t startEventID, uint32_t endEventID, ReplayLogType replayType);
|
||||
@@ -379,9 +389,9 @@ public:
|
||||
virtual IID GetDeviceUUID() { return __uuidof(ID3D12Device); }
|
||||
virtual IUnknown *GetDeviceInterface() { return (ID3D12Device *)this; }
|
||||
// Swap Chain
|
||||
IMPLEMENT_FUNCTION_SERIALISED(IUnknown *, WrapSwapchainBuffer(WrappedIDXGISwapChain3 *swap,
|
||||
DXGI_SWAP_CHAIN_DESC *desc,
|
||||
UINT buffer, IUnknown *realSurface));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(IUnknown *, WrapSwapchainBuffer,
|
||||
WrappedIDXGISwapChain3 *swap, DXGI_SWAP_CHAIN_DESC *desc,
|
||||
UINT buffer, IUnknown *realSurface);
|
||||
HRESULT Present(WrappedIDXGISwapChain3 *swap, UINT SyncInterval, UINT Flags);
|
||||
|
||||
void NewSwapchainBuffer(IUnknown *backbuffer) {}
|
||||
@@ -398,10 +408,11 @@ public:
|
||||
void CheckForDeath();
|
||||
|
||||
// Resource
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, SetResourceName(ID3D12DeviceChild *res, const char *name));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(HRESULT,
|
||||
SetShaderDebugPath(ID3D12DeviceChild *res, const char *name));
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, ReleaseResource(ID3D12DeviceChild *res));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(void, SetResourceName, ID3D12DeviceChild *res,
|
||||
const char *name);
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(HRESULT, SetShaderDebugPath, ID3D12DeviceChild *res,
|
||||
const char *name);
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(void, ReleaseResource, ID3D12DeviceChild *res);
|
||||
|
||||
//////////////////////////////
|
||||
// implement IUnknown
|
||||
@@ -426,172 +437,170 @@ public:
|
||||
|
||||
//////////////////////////////
|
||||
// implement ID3D12Device
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetNodeCount());
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetNodeCount, );
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *pDesc,
|
||||
REFIID riid, void **ppCommandQueue));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommandQueue,
|
||||
const D3D12_COMMAND_QUEUE_DESC *pDesc, REFIID riid,
|
||||
void **ppCommandQueue);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type, REFIID riid,
|
||||
void **ppCommandAllocator));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommandAllocator,
|
||||
D3D12_COMMAND_LIST_TYPE type, REFIID riid,
|
||||
void **ppCommandAllocator);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(
|
||||
virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateGraphicsPipelineState(const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, REFIID riid,
|
||||
void **ppPipelineState));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateGraphicsPipelineState,
|
||||
const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, REFIID riid,
|
||||
void **ppPipelineState);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateComputePipelineState(const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc,
|
||||
REFIID riid, void **ppPipelineState));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateComputePipelineState,
|
||||
const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, REFIID riid,
|
||||
void **ppPipelineState);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST_TYPE type,
|
||||
ID3D12CommandAllocator *pCommandAllocator,
|
||||
ID3D12PipelineState *pInitialState, REFIID riid,
|
||||
void **ppCommandList));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommandList,
|
||||
UINT nodeMask, D3D12_COMMAND_LIST_TYPE type,
|
||||
ID3D12CommandAllocator *pCommandAllocator,
|
||||
ID3D12PipelineState *pInitialState, REFIID riid,
|
||||
void **ppCommandList);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CheckFeatureSupport(D3D12_FEATURE Feature, void *pFeatureSupportData,
|
||||
UINT FeatureSupportDataSize));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckFeatureSupport,
|
||||
D3D12_FEATURE Feature, void *pFeatureSupportData,
|
||||
UINT FeatureSupportDataSize);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateDescriptorHeap(const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc,
|
||||
REFIID riid, void **ppvHeap));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDescriptorHeap,
|
||||
const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc,
|
||||
REFIID riid, void **ppvHeap);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(
|
||||
virtual UINT STDMETHODCALLTYPE,
|
||||
GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual UINT STDMETHODCALLTYPE,
|
||||
GetDescriptorHandleIncrementSize,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateRootSignature(UINT nodeMask, const void *pBlobWithRootSignature,
|
||||
SIZE_T blobLengthInBytes, REFIID riid,
|
||||
void **ppvRootSignature));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRootSignature,
|
||||
UINT nodeMask, const void *pBlobWithRootSignature,
|
||||
SIZE_T blobLengthInBytes, REFIID riid,
|
||||
void **ppvRootSignature);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE,
|
||||
CreateConstantBufferView(const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateConstantBufferView,
|
||||
const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE,
|
||||
CreateShaderResourceView(ID3D12Resource *pResource,
|
||||
const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateShaderResourceView,
|
||||
ID3D12Resource *pResource,
|
||||
const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(
|
||||
virtual void STDMETHODCALLTYPE,
|
||||
CreateUnorderedAccessView(ID3D12Resource *pResource, ID3D12Resource *pCounterResource,
|
||||
const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateUnorderedAccessView,
|
||||
ID3D12Resource *pResource, ID3D12Resource *pCounterResource,
|
||||
const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE,
|
||||
CreateRenderTargetView(ID3D12Resource *pResource,
|
||||
const D3D12_RENDER_TARGET_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateRenderTargetView,
|
||||
ID3D12Resource *pResource,
|
||||
const D3D12_RENDER_TARGET_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE,
|
||||
CreateDepthStencilView(ID3D12Resource *pResource,
|
||||
const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateDepthStencilView,
|
||||
ID3D12Resource *pResource,
|
||||
const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE,
|
||||
CreateSampler(const D3D12_SAMPLER_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CreateSampler,
|
||||
const D3D12_SAMPLER_DESC *pDesc,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(
|
||||
virtual void STDMETHODCALLTYPE,
|
||||
CopyDescriptors(UINT NumDestDescriptorRanges,
|
||||
const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts,
|
||||
const UINT *pDestDescriptorRangeSizes, UINT NumSrcDescriptorRanges,
|
||||
const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts,
|
||||
const UINT *pSrcDescriptorRangeSizes,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CopyDescriptors,
|
||||
UINT NumDestDescriptorRanges,
|
||||
const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts,
|
||||
const UINT *pDestDescriptorRangeSizes,
|
||||
UINT NumSrcDescriptorRanges,
|
||||
const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts,
|
||||
const UINT *pSrcDescriptorRangeSizes,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(
|
||||
virtual void STDMETHODCALLTYPE,
|
||||
CopyDescriptorsSimple(UINT NumDescriptors, D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, CopyDescriptorsSimple,
|
||||
UINT NumDescriptors,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart,
|
||||
D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE,
|
||||
GetResourceAllocationInfo(UINT visibleMask, UINT numResourceDescs,
|
||||
const D3D12_RESOURCE_DESC *pResourceDescs));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE,
|
||||
GetResourceAllocationInfo, UINT visibleMask,
|
||||
UINT numResourceDescs,
|
||||
const D3D12_RESOURCE_DESC *pResourceDescs);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual D3D12_HEAP_PROPERTIES STDMETHODCALLTYPE,
|
||||
GetCustomHeapProperties(UINT nodeMask, D3D12_HEAP_TYPE heapType));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual D3D12_HEAP_PROPERTIES STDMETHODCALLTYPE,
|
||||
GetCustomHeapProperties, UINT nodeMask,
|
||||
D3D12_HEAP_TYPE heapType);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateCommittedResource(const D3D12_HEAP_PROPERTIES *pHeapProperties,
|
||||
D3D12_HEAP_FLAGS HeapFlags,
|
||||
const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialResourceState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
REFIID riidResource, void **ppvResource));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommittedResource,
|
||||
const D3D12_HEAP_PROPERTIES *pHeapProperties,
|
||||
D3D12_HEAP_FLAGS HeapFlags, const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialResourceState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
REFIID riidResource, void **ppvResource);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateHeap(const D3D12_HEAP_DESC *pDesc, REFIID riid, void **ppvHeap));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateHeap,
|
||||
const D3D12_HEAP_DESC *pDesc, REFIID riid, void **ppvHeap);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreatePlacedResource(ID3D12Heap *pHeap, UINT64 HeapOffset,
|
||||
const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
REFIID riid, void **ppvResource));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreatePlacedResource,
|
||||
ID3D12Heap *pHeap, UINT64 HeapOffset,
|
||||
const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid,
|
||||
void **ppvResource);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateReservedResource(const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
REFIID riid, void **ppvResource));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateReservedResource,
|
||||
const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid,
|
||||
void **ppvResource);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateSharedHandle(ID3D12DeviceChild *pObject,
|
||||
const SECURITY_ATTRIBUTES *pAttributes,
|
||||
DWORD Access, LPCWSTR Name, HANDLE *pHandle));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateSharedHandle,
|
||||
ID3D12DeviceChild *pObject,
|
||||
const SECURITY_ATTRIBUTES *pAttributes, DWORD Access,
|
||||
LPCWSTR Name, HANDLE *pHandle);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
OpenSharedHandle(HANDLE NTHandle, REFIID riid, void **ppvObj));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedHandle,
|
||||
HANDLE NTHandle, REFIID riid, void **ppvObj);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
OpenSharedHandleByName(LPCWSTR Name, DWORD Access, HANDLE *pNTHandle));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedHandleByName,
|
||||
LPCWSTR Name, DWORD Access, HANDLE *pNTHandle);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
MakeResident(UINT NumObjects, ID3D12Pageable *const *ppObjects));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, MakeResident,
|
||||
UINT NumObjects, ID3D12Pageable *const *ppObjects);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
Evict(UINT NumObjects, ID3D12Pageable *const *ppObjects));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, Evict, UINT NumObjects,
|
||||
ID3D12Pageable *const *ppObjects);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS Flags,
|
||||
REFIID riid, void **ppFence));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateFence,
|
||||
UINT64 InitialValue, D3D12_FENCE_FLAGS Flags, REFIID riid,
|
||||
void **ppFence);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetDeviceRemovedReason());
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetDeviceRemovedReason, );
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE,
|
||||
GetCopyableFootprints(const D3D12_RESOURCE_DESC *pResourceDesc,
|
||||
UINT FirstSubresource, UINT NumSubresources,
|
||||
UINT64 BaseOffset,
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts,
|
||||
UINT *pNumRows, UINT64 *pRowSizeInBytes,
|
||||
UINT64 *pTotalBytes));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, GetCopyableFootprints,
|
||||
const D3D12_RESOURCE_DESC *pResourceDesc,
|
||||
UINT FirstSubresource, UINT NumSubresources, UINT64 BaseOffset,
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, UINT *pNumRows,
|
||||
UINT64 *pRowSizeInBytes, UINT64 *pTotalBytes);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc, REFIID riid,
|
||||
void **ppvHeap));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateQueryHeap,
|
||||
const D3D12_QUERY_HEAP_DESC *pDesc, REFIID riid,
|
||||
void **ppvHeap);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetStablePowerState(BOOL Enable));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetStablePowerState,
|
||||
BOOL Enable);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE,
|
||||
CreateCommandSignature(const D3D12_COMMAND_SIGNATURE_DESC *pDesc,
|
||||
ID3D12RootSignature *pRootSignature,
|
||||
REFIID riid, void **ppvCommandSignature));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommandSignature,
|
||||
const D3D12_COMMAND_SIGNATURE_DESC *pDesc,
|
||||
ID3D12RootSignature *pRootSignature, REFIID riid,
|
||||
void **ppvCommandSignature);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(
|
||||
virtual void STDMETHODCALLTYPE,
|
||||
GetResourceTiling(ID3D12Resource *pTiledResource, UINT *pNumTilesForEntireResource,
|
||||
D3D12_PACKED_MIP_INFO *pPackedMipDesc,
|
||||
D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips,
|
||||
UINT *pNumSubresourceTilings, UINT FirstSubresourceTilingToGet,
|
||||
D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips));
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual void STDMETHODCALLTYPE, GetResourceTiling,
|
||||
ID3D12Resource *pTiledResource,
|
||||
UINT *pNumTilesForEntireResource,
|
||||
D3D12_PACKED_MIP_INFO *pPackedMipDesc,
|
||||
D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips,
|
||||
UINT *pNumSubresourceTilings, UINT FirstSubresourceTilingToGet,
|
||||
D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips);
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(virtual LUID STDMETHODCALLTYPE, GetAdapterLuid());
|
||||
};
|
||||
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual LUID STDMETHODCALLTYPE, GetAdapterLuid);
|
||||
};
|
||||
|
||||
@@ -27,7 +27,15 @@
|
||||
#include "d3d12_command_queue.h"
|
||||
#include "d3d12_resources.h"
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *pDesc,
|
||||
// use locally cached serialiser, per-thread
|
||||
#undef GET_SERIALISER
|
||||
#define GET_SERIALISER localSerialiser
|
||||
|
||||
// must be at the start of any function that serialises
|
||||
#define CACHE_THREAD_SERIALISER() Serialiser *localSerialiser = GetThreadSerialiser();
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateCommandQueue(Serialiser *localSerialiser,
|
||||
const D3D12_COMMAND_QUEUE_DESC *pDesc,
|
||||
REFIID riid, void **ppCommandQueue)
|
||||
{
|
||||
SERIALISE_ELEMENT_PTR(D3D12_COMMAND_QUEUE_DESC, Descriptor, pDesc);
|
||||
@@ -79,15 +87,15 @@ HRESULT WrappedID3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12CommandQueue *wrapped =
|
||||
new WrappedID3D12CommandQueue(real, this, m_pSerialiser, m_State);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_COMMAND_QUEUE);
|
||||
Serialise_CreateCommandQueue(pDesc, riid, (void **)&wrapped);
|
||||
Serialise_CreateCommandQueue(localSerialiser, pDesc, riid, (void **)&wrapped);
|
||||
|
||||
m_DeviceRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -112,7 +120,8 @@ HRESULT WrappedID3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type,
|
||||
bool WrappedID3D12Device::Serialise_CreateCommandAllocator(Serialiser *localSerialiser,
|
||||
D3D12_COMMAND_LIST_TYPE type,
|
||||
REFIID riid, void **ppCommandAllocator)
|
||||
{
|
||||
SERIALISE_ELEMENT(D3D12_COMMAND_LIST_TYPE, ListType, type);
|
||||
@@ -154,14 +163,14 @@ HRESULT WrappedID3D12Device::CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12CommandAllocator *wrapped = new WrappedID3D12CommandAllocator(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_COMMAND_ALLOCATOR);
|
||||
Serialise_CreateCommandAllocator(type, riid, (void **)&wrapped);
|
||||
Serialise_CreateCommandAllocator(localSerialiser, type, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_CommandAllocator;
|
||||
@@ -219,7 +228,8 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateGraphicsPipelineState(
|
||||
const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, REFIID riid, void **ppPipelineState)
|
||||
Serialiser *localSerialiser, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, REFIID riid,
|
||||
void **ppPipelineState)
|
||||
{
|
||||
SERIALISE_ELEMENT_PTR(D3D12_GRAPHICS_PIPELINE_STATE_DESC, Descriptor, pDesc);
|
||||
SERIALISE_ELEMENT(IID, guid, riid);
|
||||
@@ -280,14 +290,14 @@ HRESULT WrappedID3D12Device::CreateGraphicsPipelineState(const D3D12_GRAPHICS_PI
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12PipelineState *wrapped = new WrappedID3D12PipelineState(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_GRAPHICS_PIPE);
|
||||
Serialise_CreateGraphicsPipelineState(pDesc, riid, (void **)&wrapped);
|
||||
Serialise_CreateGraphicsPipelineState(localSerialiser, pDesc, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_PipelineState;
|
||||
@@ -310,7 +320,8 @@ HRESULT WrappedID3D12Device::CreateGraphicsPipelineState(const D3D12_GRAPHICS_PI
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateComputePipelineState(
|
||||
const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, REFIID riid, void **ppPipelineState)
|
||||
Serialiser *localSerialiser, const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, REFIID riid,
|
||||
void **ppPipelineState)
|
||||
{
|
||||
SERIALISE_ELEMENT_PTR(D3D12_COMPUTE_PIPELINE_STATE_DESC, Descriptor, pDesc);
|
||||
SERIALISE_ELEMENT(IID, guid, riid);
|
||||
@@ -360,14 +371,14 @@ HRESULT WrappedID3D12Device::CreateComputePipelineState(const D3D12_COMPUTE_PIPE
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12PipelineState *wrapped = new WrappedID3D12PipelineState(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_COMPUTE_PIPE);
|
||||
Serialise_CreateComputePipelineState(pDesc, riid, (void **)&wrapped);
|
||||
Serialise_CreateComputePipelineState(localSerialiser, pDesc, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_PipelineState;
|
||||
@@ -390,7 +401,8 @@ HRESULT WrappedID3D12Device::CreateComputePipelineState(const D3D12_COMPUTE_PIPE
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateDescriptorHeap(
|
||||
const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, REFIID riid, void **ppvHeap)
|
||||
Serialiser *localSerialiser, const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, REFIID riid,
|
||||
void **ppvHeap)
|
||||
{
|
||||
SERIALISE_ELEMENT_PTR(D3D12_DESCRIPTOR_HEAP_DESC, Descriptor, pDescriptorHeapDesc);
|
||||
SERIALISE_ELEMENT(IID, guid, riid);
|
||||
@@ -430,15 +442,15 @@ HRESULT WrappedID3D12Device::CreateDescriptorHeap(const D3D12_DESCRIPTOR_HEAP_DE
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12DescriptorHeap *wrapped =
|
||||
new WrappedID3D12DescriptorHeap(real, this, *pDescriptorHeapDesc);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_DESCRIPTOR_HEAP);
|
||||
Serialise_CreateDescriptorHeap(pDescriptorHeapDesc, riid, (void **)&wrapped);
|
||||
Serialise_CreateDescriptorHeap(localSerialiser, pDescriptorHeapDesc, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_DescriptorHeap;
|
||||
@@ -466,7 +478,7 @@ HRESULT WrappedID3D12Device::CreateDescriptorHeap(const D3D12_DESCRIPTOR_HEAP_DE
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateRootSignature(UINT nodeMask,
|
||||
bool WrappedID3D12Device::Serialise_CreateRootSignature(Serialiser *localSerialiser, UINT nodeMask,
|
||||
const void *pBlobWithRootSignature,
|
||||
SIZE_T blobLengthInBytes, REFIID riid,
|
||||
void **ppvRootSignature)
|
||||
@@ -519,8 +531,6 @@ HRESULT WrappedID3D12Device::CreateRootSignature(UINT nodeMask, const void *pBlo
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
// duplicate signatures can be returned, if Create is called with a previous equivalent blob
|
||||
if(GetResourceManager()->HasWrapper(real))
|
||||
{
|
||||
@@ -535,9 +545,11 @@ HRESULT WrappedID3D12Device::CreateRootSignature(UINT nodeMask, const void *pBlo
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_ROOT_SIG);
|
||||
Serialise_CreateRootSignature(nodeMask, pBlobWithRootSignature, blobLengthInBytes, riid,
|
||||
(void **)&wrapped);
|
||||
Serialise_CreateRootSignature(localSerialiser, nodeMask, pBlobWithRootSignature,
|
||||
blobLengthInBytes, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_RootSignature;
|
||||
@@ -559,7 +571,8 @@ HRESULT WrappedID3D12Device::CreateRootSignature(UINT nodeMask, const void *pBlo
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_DynamicDescriptorWrite(const DynamicDescriptorWrite *write)
|
||||
bool WrappedID3D12Device::Serialise_DynamicDescriptorWrite(Serialiser *localSerialiser,
|
||||
const DynamicDescriptorWrite *write)
|
||||
{
|
||||
SERIALISE_ELEMENT(D3D12Descriptor, desc, write->desc);
|
||||
SERIALISE_ELEMENT(PortableHandle, dst, ToPortableHandle(write->dest));
|
||||
@@ -591,18 +604,21 @@ void WrappedID3D12Device::CreateConstantBufferView(const D3D12_CONSTANT_BUFFER_V
|
||||
// assume descriptors are volatile
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
DynamicDescriptorWrite write;
|
||||
write.desc.samp.heap = NULL;
|
||||
write.desc.samp.idx = 0;
|
||||
write.desc.Init(pDesc);
|
||||
write.dest = GetWrapped(DestDescriptor);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_WRITE);
|
||||
Serialise_DynamicDescriptorWrite(&write);
|
||||
Serialise_DynamicDescriptorWrite(localSerialiser, &write);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -624,18 +640,21 @@ void WrappedID3D12Device::CreateShaderResourceView(ID3D12Resource *pResource,
|
||||
// assume descriptors are volatile
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
DynamicDescriptorWrite write;
|
||||
write.desc.samp.heap = NULL;
|
||||
write.desc.samp.idx = 0;
|
||||
write.desc.Init(pResource, pDesc);
|
||||
write.dest = GetWrapped(DestDescriptor);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_WRITE);
|
||||
Serialise_DynamicDescriptorWrite(&write);
|
||||
Serialise_DynamicDescriptorWrite(localSerialiser, &write);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -657,18 +676,21 @@ void WrappedID3D12Device::CreateUnorderedAccessView(ID3D12Resource *pResource,
|
||||
// assume descriptors are volatile
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
DynamicDescriptorWrite write;
|
||||
write.desc.samp.heap = NULL;
|
||||
write.desc.samp.idx = 0;
|
||||
write.desc.Init(pResource, pCounterResource, pDesc);
|
||||
write.dest = GetWrapped(DestDescriptor);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_WRITE);
|
||||
Serialise_DynamicDescriptorWrite(&write);
|
||||
Serialise_DynamicDescriptorWrite(localSerialiser, &write);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -692,18 +714,21 @@ void WrappedID3D12Device::CreateRenderTargetView(ID3D12Resource *pResource,
|
||||
// assume descriptors are volatile
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
DynamicDescriptorWrite write;
|
||||
write.desc.samp.heap = NULL;
|
||||
write.desc.samp.idx = 0;
|
||||
write.desc.Init(pResource, pDesc);
|
||||
write.dest = GetWrapped(DestDescriptor);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_WRITE);
|
||||
Serialise_DynamicDescriptorWrite(&write);
|
||||
Serialise_DynamicDescriptorWrite(localSerialiser, &write);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -724,18 +749,21 @@ void WrappedID3D12Device::CreateDepthStencilView(ID3D12Resource *pResource,
|
||||
// assume descriptors are volatile
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
DynamicDescriptorWrite write;
|
||||
write.desc.samp.heap = NULL;
|
||||
write.desc.samp.idx = 0;
|
||||
write.desc.Init(pResource, pDesc);
|
||||
write.dest = GetWrapped(DestDescriptor);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_WRITE);
|
||||
Serialise_DynamicDescriptorWrite(&write);
|
||||
Serialise_DynamicDescriptorWrite(localSerialiser, &write);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -755,18 +783,21 @@ void WrappedID3D12Device::CreateSampler(const D3D12_SAMPLER_DESC *pDesc,
|
||||
// assume descriptors are volatile
|
||||
if(m_State == WRITING_CAPFRAME)
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
DynamicDescriptorWrite write;
|
||||
write.desc.samp.heap = NULL;
|
||||
write.desc.samp.idx = 0;
|
||||
write.desc.Init(pDesc);
|
||||
write.dest = GetWrapped(DestDescriptor);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorWrites.push_back(write);
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_WRITE);
|
||||
Serialise_DynamicDescriptorWrite(&write);
|
||||
Serialise_DynamicDescriptorWrite(localSerialiser, &write);
|
||||
|
||||
m_DeviceRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -779,9 +810,10 @@ void WrappedID3D12Device::CreateSampler(const D3D12_SAMPLER_DESC *pDesc,
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateCommittedResource(
|
||||
const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags,
|
||||
const D3D12_RESOURCE_DESC *pDesc, D3D12_RESOURCE_STATES InitialResourceState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)
|
||||
Serialiser *localSerialiser, const D3D12_HEAP_PROPERTIES *pHeapProperties,
|
||||
D3D12_HEAP_FLAGS HeapFlags, const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
REFIID riidResource, void **ppvResource)
|
||||
{
|
||||
SERIALISE_ELEMENT(D3D12_HEAP_PROPERTIES, props, *pHeapProperties);
|
||||
SERIALISE_ELEMENT(D3D12_HEAP_FLAGS, flags, HeapFlags);
|
||||
@@ -841,15 +873,16 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_COMMITTED_RESOURCE);
|
||||
Serialise_CreateCommittedResource(pHeapProperties, HeapFlags, pDesc, InitialResourceState,
|
||||
pOptimizedClearValue, riidResource, (void **)&wrapped);
|
||||
Serialise_CreateCommittedResource(localSerialiser, pHeapProperties, HeapFlags, pDesc,
|
||||
InitialResourceState, pOptimizedClearValue, riidResource,
|
||||
(void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_Resource;
|
||||
@@ -884,7 +917,8 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateHeap(const D3D12_HEAP_DESC *pDesc, REFIID riid,
|
||||
bool WrappedID3D12Device::Serialise_CreateHeap(Serialiser *localSerialiser,
|
||||
const D3D12_HEAP_DESC *pDesc, REFIID riid,
|
||||
void **ppvHeap)
|
||||
{
|
||||
SERIALISE_ELEMENT(D3D12_HEAP_DESC, desc, *pDesc);
|
||||
@@ -924,14 +958,14 @@ HRESULT WrappedID3D12Device::CreateHeap(const D3D12_HEAP_DESC *pDesc, REFIID rii
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12Heap *wrapped = new WrappedID3D12Heap(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_HEAP);
|
||||
Serialise_CreateHeap(pDesc, riid, (void **)&wrapped);
|
||||
Serialise_CreateHeap(localSerialiser, pDesc, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_Heap;
|
||||
@@ -951,11 +985,10 @@ HRESULT WrappedID3D12Device::CreateHeap(const D3D12_HEAP_DESC *pDesc, REFIID rii
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreatePlacedResource(ID3D12Heap *pHeap, UINT64 HeapOffset,
|
||||
const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
REFIID riid, void **ppvResource)
|
||||
bool WrappedID3D12Device::Serialise_CreatePlacedResource(
|
||||
Serialiser *localSerialiser, ID3D12Heap *pHeap, UINT64 HeapOffset,
|
||||
const D3D12_RESOURCE_DESC *pDesc, D3D12_RESOURCE_STATES InitialState,
|
||||
const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid, void **ppvResource)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, Heap, GetResID(pHeap));
|
||||
SERIALISE_ELEMENT(UINT64, Offset, HeapOffset);
|
||||
@@ -1014,15 +1047,15 @@ HRESULT WrappedID3D12Device::CreatePlacedResource(ID3D12Heap *pHeap, UINT64 Heap
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_PLACED_RESOURCE);
|
||||
Serialise_CreatePlacedResource(pHeap, HeapOffset, pDesc, InitialState, pOptimizedClearValue,
|
||||
riid, (void **)&wrapped);
|
||||
Serialise_CreatePlacedResource(localSerialiser, pHeap, HeapOffset, pDesc, InitialState,
|
||||
pOptimizedClearValue, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_Resource;
|
||||
@@ -1070,8 +1103,8 @@ HRESULT WrappedID3D12Device::CreateReservedResource(const D3D12_RESOURCE_DESC *p
|
||||
ppvResource);
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS Flags,
|
||||
REFIID riid, void **ppFence)
|
||||
bool WrappedID3D12Device::Serialise_CreateFence(Serialiser *localSerialiser, UINT64 InitialValue,
|
||||
D3D12_FENCE_FLAGS Flags, REFIID riid, void **ppFence)
|
||||
{
|
||||
SERIALISE_ELEMENT(UINT64, val, InitialValue);
|
||||
SERIALISE_ELEMENT(D3D12_FENCE_FLAGS, flags, Flags);
|
||||
@@ -1112,14 +1145,14 @@ HRESULT WrappedID3D12Device::CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12Fence *wrapped = new WrappedID3D12Fence(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_FENCE);
|
||||
Serialise_CreateFence(InitialValue, Flags, riid, (void **)&wrapped);
|
||||
Serialise_CreateFence(localSerialiser, InitialValue, Flags, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_Resource;
|
||||
@@ -1139,7 +1172,8 @@ HRESULT WrappedID3D12Device::CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc, REFIID riid,
|
||||
bool WrappedID3D12Device::Serialise_CreateQueryHeap(Serialiser *localSerialiser,
|
||||
const D3D12_QUERY_HEAP_DESC *pDesc, REFIID riid,
|
||||
void **ppvHeap)
|
||||
{
|
||||
SERIALISE_ELEMENT(D3D12_QUERY_HEAP_DESC, desc, *pDesc);
|
||||
@@ -1180,14 +1214,14 @@ HRESULT WrappedID3D12Device::CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc,
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
WrappedID3D12QueryHeap *wrapped = new WrappedID3D12QueryHeap(real, this);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_QUERY_HEAP);
|
||||
Serialise_CreateQueryHeap(pDesc, riid, (void **)&wrapped);
|
||||
Serialise_CreateQueryHeap(localSerialiser, pDesc, riid, (void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_QueryHeap;
|
||||
@@ -1207,7 +1241,8 @@ HRESULT WrappedID3D12Device::CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc,
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_CreateCommandSignature(const D3D12_COMMAND_SIGNATURE_DESC *pDesc,
|
||||
bool WrappedID3D12Device::Serialise_CreateCommandSignature(Serialiser *localSerialiser,
|
||||
const D3D12_COMMAND_SIGNATURE_DESC *pDesc,
|
||||
ID3D12RootSignature *pRootSignature,
|
||||
REFIID riid, void **ppvCommandSignature)
|
||||
{
|
||||
@@ -1257,8 +1292,6 @@ HRESULT WrappedID3D12Device::CreateCommandSignature(const D3D12_COMMAND_SIGNATUR
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
if(GetResourceManager()->HasWrapper(real))
|
||||
{
|
||||
real->Release();
|
||||
@@ -1273,8 +1306,11 @@ HRESULT WrappedID3D12Device::CreateCommandSignature(const D3D12_COMMAND_SIGNATUR
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_COMMAND_SIG);
|
||||
Serialise_CreateCommandSignature(pDesc, pRootSignature, riid, (void **)&wrapped);
|
||||
Serialise_CreateCommandSignature(localSerialiser, pDesc, pRootSignature, riid,
|
||||
(void **)&wrapped);
|
||||
|
||||
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
|
||||
record->type = Resource_CommandSignature;
|
||||
@@ -1305,7 +1341,7 @@ HRESULT WrappedID3D12Device::CreateSharedHandle(ID3D12DeviceChild *pObject,
|
||||
}
|
||||
|
||||
bool WrappedID3D12Device::Serialise_DynamicDescriptorCopies(
|
||||
const std::vector<DynamicDescriptorCopy> *copies)
|
||||
Serialiser *localSerialiser, const std::vector<DynamicDescriptorCopy> *copies)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, numCopies, (uint32_t)copies->size());
|
||||
|
||||
@@ -1398,8 +1434,6 @@ void WrappedID3D12Device::CopyDescriptors(
|
||||
|
||||
if(m_State == WRITING_CAPFRAME && !copies.empty())
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
// reference all the individual heaps
|
||||
for(UINT i = 0; i < NumSrcDescriptorRanges; i++)
|
||||
{
|
||||
@@ -1413,11 +1447,16 @@ void WrappedID3D12Device::CopyDescriptors(
|
||||
GetResourceManager()->MarkResourceFrameReferenced(GetResID(desc->samp.heap), eFrameRef_Read);
|
||||
}
|
||||
|
||||
m_DynamicDescriptorCopies.insert(m_DynamicDescriptorCopies.end(), copies.begin(), copies.end());
|
||||
{
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorCopies.insert(m_DynamicDescriptorCopies.end(), copies.begin(), copies.end());
|
||||
}
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_COPIES);
|
||||
Serialise_DynamicDescriptorCopies(&copies);
|
||||
Serialise_DynamicDescriptorCopies(localSerialiser, &copies);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
@@ -1447,15 +1486,17 @@ void WrappedID3D12Device::CopyDescriptorsSimple(UINT NumDescriptors,
|
||||
copies.push_back(DynamicDescriptorCopy(&dst[i], &src[i], DescriptorHeapsType));
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
SCOPED_LOCK(m_DynDescLock);
|
||||
m_DynamicDescriptorCopies.insert(m_DynamicDescriptorCopies.end(), copies.begin(), copies.end());
|
||||
}
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_COPIES);
|
||||
Serialise_DynamicDescriptorCopies(&copies);
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
SCOPED_SERIALISE_CONTEXT(DYN_DESC_COPIES);
|
||||
Serialise_DynamicDescriptorCopies(localSerialiser, &copies);
|
||||
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1219,17 +1219,17 @@ void D3D12Replay::RemoveReplacement(ResourceId id)
|
||||
|
||||
void D3D12Replay::InitCallstackResolver()
|
||||
{
|
||||
m_pDevice->GetSerialiser()->InitCallstackResolver();
|
||||
m_pDevice->GetMainSerialiser()->InitCallstackResolver();
|
||||
}
|
||||
|
||||
bool D3D12Replay::HasCallstacks()
|
||||
{
|
||||
return m_pDevice->GetSerialiser()->HasCallstacks();
|
||||
return m_pDevice->GetMainSerialiser()->HasCallstacks();
|
||||
}
|
||||
|
||||
Callstack::StackResolver *D3D12Replay::GetCallstackResolver()
|
||||
{
|
||||
return m_pDevice->GetSerialiser()->GetCallstackResolver();
|
||||
return m_pDevice->GetMainSerialiser()->GetCallstackResolver();
|
||||
}
|
||||
|
||||
#pragma region not yet implemented
|
||||
@@ -1542,7 +1542,7 @@ ReplayCreateStatus D3D12_CreateReplayDevice(const char *logfile, IReplayDriver *
|
||||
wrappedDev->SetLogFile(logfile);
|
||||
wrappedDev->SetLogVersion(initParams.SerialiseVersion);
|
||||
|
||||
if(logfile && wrappedDev->GetSerialiser()->HasError())
|
||||
if(logfile && wrappedDev->GetMainSerialiser()->HasError())
|
||||
{
|
||||
SAFE_RELEASE(wrappedDev);
|
||||
return eReplayCreate_FileIOFailed;
|
||||
|
||||
@@ -798,9 +798,8 @@ VkResult WrappedVulkan::GetProvidedExtensionProperties(uint32_t *pPropertyCount,
|
||||
void WrappedVulkan::Serialise_CaptureScope(uint64_t offset)
|
||||
{
|
||||
uint32_t FrameNumber = m_FrameCounter;
|
||||
GetMainSerialiser()->Serialise(
|
||||
"FrameNumber",
|
||||
FrameNumber); // must use main serialiser here to match resource manager below
|
||||
// must use main serialiser here to match resource manager below
|
||||
GetMainSerialiser()->Serialise("FrameNumber", FrameNumber);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
|
||||
@@ -118,10 +118,6 @@ struct VulkanDrawcallTreeNode
|
||||
// must be at the start of any function that serialises
|
||||
#define CACHE_THREAD_SERIALISER() Serialiser *localSerialiser = GetThreadSerialiser();
|
||||
|
||||
// pass the cached serialiser into Serialised_ function
|
||||
#undef SERIALISED_PARAMETER
|
||||
#define SERIALISED_PARAMETER Serialiser *localSerialiser,
|
||||
|
||||
struct VulkanDrawcallCallback
|
||||
{
|
||||
// the three callbacks are used to allow the callback implementor to either
|
||||
|
||||
Reference in New Issue
Block a user