Wrap and serialise query heaps

This commit is contained in:
baldurk
2016-09-16 16:12:02 +02:00
parent a635b8273f
commit 9301ec0838
4 changed files with 92 additions and 3 deletions
+24
View File
@@ -906,6 +906,16 @@ void Serialiser::Serialise(const char *name, D3D12_DESCRIPTOR_HEAP_DESC &el)
Serialise("NodeMask", el.NodeMask);
}
template <>
void Serialiser::Serialise(const char *name, D3D12_QUERY_HEAP_DESC &el)
{
ScopedContext scope(this, name, "D3D12_QUERY_HEAP_DESC", 0, true);
Serialise("Type", el.Type);
Serialise("Count", el.Count);
Serialise("NodeMask", el.NodeMask);
}
template <>
void Serialiser::Serialise(const char *name, D3D12_CLEAR_VALUE &el)
{
@@ -1039,6 +1049,20 @@ string ToStrHelper<false, D3D12_MEMORY_POOL>::Get(const D3D12_MEMORY_POOL &el)
return StringFormat::Fmt("D3D12_MEMORY_POOL<%d>", el);
}
string ToStrHelper<false, D3D12_QUERY_HEAP_TYPE>::Get(const D3D12_QUERY_HEAP_TYPE &el)
{
switch(el)
{
TOSTR_CASE_STRINGIZE(D3D12_QUERY_HEAP_TYPE_OCCLUSION)
TOSTR_CASE_STRINGIZE(D3D12_QUERY_HEAP_TYPE_TIMESTAMP)
TOSTR_CASE_STRINGIZE(D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS)
TOSTR_CASE_STRINGIZE(D3D12_QUERY_HEAP_TYPE_SO_STATISTICS)
default: break;
}
return StringFormat::Fmt("D3D12_QUERY_HEAP_TYPE<%d>", el);
}
string ToStrHelper<false, D3D12_DESCRIPTOR_HEAP_TYPE>::Get(const D3D12_DESCRIPTOR_HEAP_TYPE &el)
{
switch(el)
+4 -1
View File
@@ -181,6 +181,8 @@ void Serialiser::Serialise(const char *name, D3D12_HEAP_DESC &el);
template <>
void Serialiser::Serialise(const char *name, D3D12_DESCRIPTOR_HEAP_DESC &el);
template <>
void Serialiser::Serialise(const char *name, D3D12_QUERY_HEAP_DESC &el);
template <>
void Serialiser::Serialise(const char *name, D3D12_SAMPLER_DESC &el);
template <>
void Serialiser::Serialise(const char *name, D3D12_CONSTANT_BUFFER_VIEW_DESC &el);
@@ -229,10 +231,11 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
D3D12_CHUNK_MACRO(CREATE_DESCRIPTOR_HEAP, "ID3D12Device::CreateDescriptorHeap") \
D3D12_CHUNK_MACRO(CREATE_ROOT_SIG, "ID3D12Device::CreateRootSignature") \
\
D3D12_CHUNK_MACRO(CREATE_HEAP, "ID3D12Device::CreateHrap") \
D3D12_CHUNK_MACRO(CREATE_HEAP, "ID3D12Device::CreateHeap") \
D3D12_CHUNK_MACRO(CREATE_COMMITTED_RESOURCE, "ID3D12Device::CreateCommittedResource") \
D3D12_CHUNK_MACRO(CREATE_PLACED_RESOURCE, "ID3D12Device::CreatePlacedResource") \
\
D3D12_CHUNK_MACRO(CREATE_QUERY_HEAP, "ID3D12Device::CreateQueryHeap") \
D3D12_CHUNK_MACRO(CREATE_FENCE, "ID3D12Device::CreateFence") \
\
D3D12_CHUNK_MACRO(CLOSE_LIST, "ID3D12GraphicsCommandList::Close") \
+1
View File
@@ -1614,6 +1614,7 @@ void WrappedID3D12Device::ProcessChunk(uint64_t offset, D3D12ChunkType context)
Serialise_CreatePlacedResource(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 SET_RESOURCE_NAME: Serialise_SetResourceName(0x0, ""); break;
+63 -2
View File
@@ -981,11 +981,72 @@ HRESULT WrappedID3D12Device::CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS
return ret;
}
bool WrappedID3D12Device::Serialise_CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc, REFIID riid,
void **ppvHeap)
{
SERIALISE_ELEMENT(D3D12_QUERY_HEAP_DESC, desc, *pDesc);
SERIALISE_ELEMENT(IID, guid, riid);
SERIALISE_ELEMENT(ResourceId, QueryHeap, ((WrappedID3D12QueryHeap *)*ppvHeap)->GetResourceID());
if(m_State == READING)
{
ID3D12QueryHeap *ret = NULL;
HRESULT hr = m_pDevice->CreateQueryHeap(&desc, guid, (void **)&ret);
if(FAILED(hr))
{
RDCERR("Failed on resource serialise-creation, HRESULT: 0x%08x", hr);
}
else
{
ret = new WrappedID3D12QueryHeap(ret, this);
GetResourceManager()->AddLiveResource(QueryHeap, ret);
}
}
return true;
}
HRESULT WrappedID3D12Device::CreateQueryHeap(const D3D12_QUERY_HEAP_DESC *pDesc, REFIID riid,
void **ppvHeap)
{
D3D12NOTIMP(__PRETTY_FUNCTION_SIGNATURE__);
return m_pDevice->CreateQueryHeap(pDesc, riid, ppvHeap);
if(ppvHeap == NULL)
return m_pDevice->CreateQueryHeap(pDesc, riid, NULL);
if(riid != __uuidof(ID3D12QueryHeap))
return E_NOINTERFACE;
ID3D12QueryHeap *real = NULL;
HRESULT ret = m_pDevice->CreateQueryHeap(pDesc, riid, (void **)&real);
if(SUCCEEDED(ret))
{
SCOPED_LOCK(m_D3DLock);
WrappedID3D12QueryHeap *wrapped = new WrappedID3D12QueryHeap(real, this);
if(m_State >= WRITING)
{
SCOPED_SERIALISE_CONTEXT(CREATE_QUERY_HEAP);
Serialise_CreateQueryHeap(pDesc, riid, (void **)&wrapped);
D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID());
record->type = Resource_QueryHeap;
record->Length = 0;
wrapped->SetResourceRecord(record);
record->AddChunk(scope.Get());
}
else
{
GetResourceManager()->AddLiveResource(wrapped->GetResourceID(), wrapped);
}
*ppvHeap = (ID3D12QueryHeap *)wrapped;
}
return ret;
}
HRESULT WrappedID3D12Device::CreateCommandSignature(const D3D12_COMMAND_SIGNATURE_DESC *pDesc,