Implement support for new barriers & resource creation functions

This commit is contained in:
baldurk
2023-05-20 13:19:19 +01:00
parent 2777a25345
commit 780ea478b1
13 changed files with 541 additions and 81 deletions
@@ -23,8 +23,241 @@
******************************************************************************/
#include "d3d12_command_list.h"
#include "d3d12_debug.h"
void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::Barrier(
UINT32 NumBarrierGroups, const D3D12_BARRIER_GROUP *pBarrierGroups)
template <typename SerialiserType>
bool WrappedID3D12GraphicsCommandList::Serialise_Barrier(SerialiserType &ser, UINT32 NumBarrierGroups,
const D3D12_BARRIER_GROUP *pBarrierGroups)
{
ID3D12GraphicsCommandList7 *pCommandList = this;
SERIALISE_ELEMENT(pCommandList);
SERIALISE_ELEMENT(NumBarrierGroups);
SERIALISE_ELEMENT_ARRAY(pBarrierGroups, NumBarrierGroups).Important();
SERIALISE_CHECK_READ_ERRORS();
if(IsReplayingAndReading())
{
if(GetWrapped(pCommandList)->GetReal7() == NULL)
{
SET_ERROR_RESULT(m_Cmd->m_FailedReplayResult, ResultCode::APIHardwareUnsupported,
"Capture requires ID3D12GraphicsCommandList7 which isn't available");
return false;
}
m_Cmd->m_LastCmdListID = GetResourceManager()->GetOriginalID(GetResID(pCommandList));
rdcarray<D3D12_BUFFER_BARRIER> filteredUnwrappedBuf;
rdcarray<D3D12_TEXTURE_BARRIER> filteredUnwrappedTex;
rdcarray<D3D12_BARRIER_GROUP> filteredUnwrapped;
// resize so we can take pointers
for(UINT i = 0; i < NumBarrierGroups; i++)
{
if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_BUFFER)
filteredUnwrappedBuf.resize(filteredUnwrappedBuf.size() + pBarrierGroups[i].NumBarriers);
else if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
filteredUnwrappedTex.resize(filteredUnwrappedTex.size() + pBarrierGroups[i].NumBarriers);
}
D3D12_TEXTURE_BARRIER *tex = filteredUnwrappedTex.data();
D3D12_BUFFER_BARRIER *buf = filteredUnwrappedBuf.data();
BakedCmdListInfo &cmdinfo = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID];
// filter out any barriers that reference a NULL resource - this means the resource wasn't used
// elsewhere so was discarded from the capture
for(UINT i = 0; i < NumBarrierGroups; i++)
{
D3D12_BARRIER_GROUP group = pBarrierGroups[i];
if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_BUFFER)
{
const UINT num = group.NumBarriers;
group.NumBarriers = 0;
for(UINT b = 0; b < num; b++)
{
ID3D12Resource *res = group.pBufferBarriers[b].pResource;
if(res)
{
buf[group.NumBarriers] = group.pBufferBarriers[b];
buf[group.NumBarriers].pResource = Unwrap(res);
group.NumBarriers++;
cmdinfo.resourceUsage.push_back(make_rdcpair(
GetResID(res), EventUsage(cmdinfo.curEventID, ResourceUsage::Barrier)));
}
}
group.pBufferBarriers = buf;
buf += group.NumBarriers;
if(group.NumBarriers > 0)
filteredUnwrapped.push_back(group);
}
else if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
{
const UINT num = group.NumBarriers;
group.NumBarriers = 0;
for(UINT b = 0; b < num; b++)
{
ID3D12Resource *res = group.pTextureBarriers[b].pResource;
if(res)
{
tex[group.NumBarriers] = group.pTextureBarriers[b];
tex[group.NumBarriers].pResource = Unwrap(res);
group.NumBarriers++;
cmdinfo.resourceUsage.push_back(make_rdcpair(
GetResID(res), EventUsage(cmdinfo.curEventID, ResourceUsage::Barrier)));
}
}
group.pTextureBarriers = tex;
tex += group.NumBarriers;
if(group.NumBarriers > 0)
filteredUnwrapped.push_back(group);
}
else
{
filteredUnwrapped.push_back(group);
}
}
if(IsActiveReplaying(m_State))
{
if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID))
{
ID3D12GraphicsCommandListX *rerecord = m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID);
pCommandList = rerecord;
if(!filteredUnwrapped.empty())
{
Unwrap7(pCommandList)->Barrier((UINT)filteredUnwrapped.size(), filteredUnwrapped.data());
if(m_pDevice->GetReplayOptions().optimisation != ReplayOptimisationLevel::Fastest)
{
for(UINT i = 0; i < NumBarrierGroups; i++)
{
if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
{
for(UINT b = 0; b < pBarrierGroups[i].NumBarriers; b++)
{
const D3D12_TEXTURE_BARRIER &barrier = pBarrierGroups[i].pTextureBarriers[b];
if(barrier.pResource && (barrier.Flags & D3D12_TEXTURE_BARRIER_FLAG_DISCARD))
{
m_pDevice->GetDebugManager()->FillWithDiscardPattern(
rerecord, m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state,
DiscardType::UndefinedTransition, barrier.pResource, NULL,
barrier.LayoutAfter);
}
}
}
}
}
}
}
else
{
pCommandList = NULL;
}
}
else
{
if(!filteredUnwrapped.empty())
{
Unwrap7(pCommandList)->Barrier((UINT)filteredUnwrapped.size(), filteredUnwrapped.data());
GetCrackedList7()->Barrier((UINT)filteredUnwrapped.size(), filteredUnwrapped.data());
}
}
if(pCommandList)
{
ResourceId cmd = GetResID(pCommandList);
for(UINT i = 0; i < NumBarrierGroups; i++)
{
if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
{
for(UINT b = 0; b < pBarrierGroups[i].NumBarriers; b++)
{
if(pBarrierGroups[i].pTextureBarriers[b].pResource)
m_Cmd->m_BakedCmdListInfo[cmd].barriers.newBarriers.push_back(
pBarrierGroups[i].pTextureBarriers[b]);
}
}
}
}
}
return true;
}
void WrappedID3D12GraphicsCommandList::Barrier(UINT32 NumBarrierGroups,
const D3D12_BARRIER_GROUP *pBarrierGroups)
{
size_t memSize = sizeof(D3D12_BARRIER_GROUP) * NumBarrierGroups;
for(UINT i = 0; i < NumBarrierGroups; i++)
{
if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_BUFFER)
memSize += pBarrierGroups[i].NumBarriers * sizeof(D3D12_BUFFER_BARRIER);
else if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
memSize += pBarrierGroups[i].NumBarriers * sizeof(D3D12_TEXTURE_BARRIER);
}
byte *mem = m_pDevice->GetTempMemory(memSize);
D3D12_BARRIER_GROUP *barriers = (D3D12_BARRIER_GROUP *)mem;
mem += sizeof(D3D12_BARRIER_GROUP) * NumBarrierGroups;
for(UINT i = 0; i < NumBarrierGroups; i++)
{
barriers[i] = pBarrierGroups[i];
if(barriers[i].Type == D3D12_BARRIER_TYPE_BUFFER)
{
D3D12_BUFFER_BARRIER *buf = (D3D12_BUFFER_BARRIER *)mem;
mem += sizeof(D3D12_BUFFER_BARRIER) * barriers[i].NumBarriers;
for(UINT b = 0; b < barriers[i].NumBarriers; b++)
{
buf[b] = barriers[i].pBufferBarriers[b];
buf[b].pResource = Unwrap(buf[b].pResource);
}
barriers[i].pBufferBarriers = buf;
}
else if(barriers[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
{
D3D12_TEXTURE_BARRIER *tex = (D3D12_TEXTURE_BARRIER *)mem;
mem += sizeof(D3D12_TEXTURE_BARRIER) * barriers[i].NumBarriers;
for(UINT b = 0; b < barriers[i].NumBarriers; b++)
{
tex[b] = barriers[i].pTextureBarriers[b];
tex[b].pResource = Unwrap(tex[b].pResource);
}
barriers[i].pTextureBarriers = tex;
}
}
SERIALISE_TIME_CALL(m_pList7->Barrier(NumBarrierGroups, barriers));
if(IsCaptureMode(m_State))
{
CACHE_THREAD_SERIALISER();
SCOPED_SERIALISE_CHUNK(D3D12Chunk::List_Barrier);
Serialise_Barrier(ser, NumBarrierGroups, pBarrierGroups);
m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc));
for(UINT i = 0; i < NumBarrierGroups; i++)
if(pBarrierGroups[i].Type == D3D12_BARRIER_TYPE_TEXTURE)
m_ListRecord->cmdInfo->barriers.newBarriers.append(pBarrierGroups[i].pTextureBarriers,
pBarrierGroups[i].NumBarriers);
}
}
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12GraphicsCommandList, Barrier,
UINT32 NumBarrierGroups, const D3D12_BARRIER_GROUP *pBarrierGroups);
@@ -335,6 +335,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser,
m_Cmd->m_BakedCmdListInfo[BakedCommandList].curEventID = 0;
m_Cmd->m_BakedCmdListInfo[CommandList].executeEvents =
m_Cmd->m_BakedCmdListInfo[BakedCommandList].executeEvents;
m_Cmd->m_BakedCmdListInfo[CommandList].barriers.clear();
m_Cmd->m_BakedCmdListInfo[BakedCommandList].barriers.clear();
}
else
{
@@ -400,6 +402,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser,
m_Cmd->m_BakedCmdListInfo[BakedCommandList].nodeMask = nodeMask;
m_Cmd->m_BakedCmdListInfo[CommandList].allocator =
m_Cmd->m_BakedCmdListInfo[BakedCommandList].allocator = GetResID(pAllocator);
m_Cmd->m_BakedCmdListInfo[CommandList].barriers.clear();
m_Cmd->m_BakedCmdListInfo[BakedCommandList].barriers.clear();
// On list execute we increment all child events/actions by
// m_RootEventID and insert them into the tree.
@@ -901,6 +901,7 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu
ret = m_ReplayList->Serialise_IASetIndexBufferStripCutValue(
ser, D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED);
break;
case D3D12Chunk::List_Barrier: ret = m_ReplayList->Serialise_Barrier(ser, 0, NULL); break;
case D3D12Chunk::PushMarker: ret = m_ReplayList->Serialise_BeginEvent(ser, 0, NULL, 0); break;
case D3D12Chunk::PopMarker: ret = m_ReplayList->Serialise_EndEvent(ser); break;
+4
View File
@@ -196,6 +196,10 @@ void BarrierSet::Configure(ID3D12Resource *res, const SubresourceStateVector &st
b.AccessBefore = D3D12_BARRIER_ACCESS_COMMON;
b.SyncBefore = D3D12_BARRIER_SYNC_ALL;
if(b.LayoutBefore == D3D12_BARRIER_LAYOUT_UNDEFINED)
b.AccessBefore = D3D12_BARRIER_ACCESS_NO_ACCESS;
b.AccessAfter = resourceAccess;
b.SyncAfter = resourceSync;
b.LayoutAfter = resourceLayout;
+9 -3
View File
@@ -147,14 +147,19 @@ struct D3D12ResourceLayout
bool IsLayout() const { return (value & LayoutBit) != 0; }
bool IsStates() const { return (value & LayoutBit) == 0; }
D3D12_RESOURCE_STATES ToStates() const { return D3D12_RESOURCE_STATES(value & ~LayoutBit); }
D3D12_BARRIER_LAYOUT ToLayout() const { return D3D12_BARRIER_LAYOUT(value & ~LayoutBit); }
D3D12_BARRIER_LAYOUT ToLayout() const
{
if(value == D3D12_BARRIER_LAYOUT_UNDEFINED)
return D3D12_BARRIER_LAYOUT_UNDEFINED;
return D3D12_BARRIER_LAYOUT(value & ~LayoutBit);
}
bool operator==(const D3D12ResourceLayout &o) const { return value == o.value; }
bool operator!=(const D3D12ResourceLayout &o) const { return !(*this == o); }
private:
explicit D3D12ResourceLayout(uint32_t v) : value(v) {}
// layouts are an enum so this bit should hopefully never be used. Note that LAYOUT_UNDEFINED is
// ~0U but that's not valid except as a previous state for discards, it's not a layout anything
// can be put into so stored here.
// ~0U and annoyingly it has to be specified for buffers (instead of D3D12_BARRIER_LAYOUT_COMMON)
// so we need to special-case it.
// states are a bitmask but they only use just over 6 hex digits so far, and we assume they won't
// be extended (or not by much).
// We set the bit for layouts and not for states so that we can serialise this
@@ -1032,5 +1037,6 @@ enum class D3D12Chunk : uint32_t
List_OMSetFrontAndBackStencilRef,
List_RSSetDepthBias,
List_IASetIndexBufferStripCutValue,
List_Barrier,
Max,
};
+19 -4
View File
@@ -4158,6 +4158,19 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context)
IID(), NULL);
case D3D12Chunk::Device_CreateCommandQueue1:
return Serialise_CreateCommandQueue1(ser, NULL, IID(), IID(), NULL);
case D3D12Chunk::Device_CreateCommittedResource3:
return Serialise_CreateCommittedResource3(ser, NULL, D3D12_HEAP_FLAG_NONE, NULL,
D3D12_BARRIER_LAYOUT_COMMON, NULL, NULL, 0, NULL,
IID(), NULL);
case D3D12Chunk::Device_CreatePlacedResource2:
return Serialise_CreatePlacedResource2(ser, NULL, 0, NULL, D3D12_BARRIER_LAYOUT_COMMON, NULL,
0, NULL, IID(), NULL);
case D3D12Chunk::Device_CreateReservedResource1:
return Serialise_CreateReservedResource1(ser, NULL, D3D12_RESOURCE_STATE_COMMON, NULL, NULL,
IID(), NULL);
case D3D12Chunk::Device_CreateReservedResource2:
return Serialise_CreateReservedResource2(ser, NULL, D3D12_BARRIER_LAYOUT_COMMON, NULL, NULL,
0, NULL, IID(), NULL);
// in order to get a warning if we miss a case, we explicitly handle the list/queue chunks here.
// If we actually encounter one it's an error (we should hit CaptureBegin first and switch to
@@ -4246,13 +4259,10 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context)
case D3D12Chunk::List_ClearState:
case D3D12Chunk::CoherentMapWrite:
case D3D12Chunk::Device_CreateSampler2:
case D3D12Chunk::Device_CreateCommittedResource3:
case D3D12Chunk::Device_CreatePlacedResource2:
case D3D12Chunk::Device_CreateReservedResource1:
case D3D12Chunk::Device_CreateReservedResource2:
case D3D12Chunk::List_OMSetFrontAndBackStencilRef:
case D3D12Chunk::List_RSSetDepthBias:
case D3D12Chunk::List_IASetIndexBufferStripCutValue:
case D3D12Chunk::List_Barrier:
RDCERR("Unexpected chunk while processing initialisation: %s", ToStr(context).c_str());
return false;
@@ -4719,6 +4729,8 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
{
ID3D12GraphicsCommandListX *list = cmd.m_OutsideCmdList = GetNewList();
cmd.m_BakedCmdListInfo[GetResID(cmd.m_OutsideCmdList)].barriers.clear();
if(!list)
return;
@@ -4740,6 +4752,9 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
if(cmd.m_OutsideCmdList != NULL)
{
if(replayType == eReplay_OnlyDraw)
ApplyBarriers(cmd.m_BakedCmdListInfo[GetResID(cmd.m_OutsideCmdList)].barriers);
ID3D12GraphicsCommandList *list = cmd.m_OutsideCmdList;
CheckHRESULT(list->Close());
+14 -11
View File
@@ -1363,13 +1363,15 @@ public:
bool Serialise_CreateResource(D3D12Chunk chunkType, ID3D12Heap *pHeap, UINT64 HeapOffset,
D3D12_HEAP_PROPERTIES &props, D3D12_HEAP_FLAGS HeapFlags,
D3D12_RESOURCE_DESC1 &desc, D3D12ResourceLayout InitialResourceState,
const D3D12_CLEAR_VALUE *pOptimizedClearValue, ResourceId pResource,
uint64_t gpuAddress);
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
UINT NumCastableFormats, const DXGI_FORMAT *pCastableFormats,
ResourceId pResource, uint64_t gpuAddress);
bool Serialise_CreateResource(D3D12Chunk chunkType, ID3D12Heap *pHeap, UINT64 HeapOffset,
D3D12_HEAP_PROPERTIES &props, D3D12_HEAP_FLAGS HeapFlags,
D3D12_RESOURCE_DESC &desc, D3D12ResourceLayout InitialResourceState,
const D3D12_CLEAR_VALUE *pOptimizedClearValue, ResourceId pResource,
uint64_t gpuAddress)
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
UINT NumCastableFormats, const DXGI_FORMAT *pCastableFormats,
ResourceId pResource, uint64_t gpuAddress)
{
// upconvert to the DESC1 by just memcpy, since it's a superset and the remainder can be
// 0-initialised
@@ -1377,22 +1379,23 @@ public:
memcpy(&desc1, &desc, sizeof(desc));
return Serialise_CreateResource(chunkType, pHeap, HeapOffset, props, HeapFlags, desc1,
InitialResourceState, pOptimizedClearValue, pResource,
gpuAddress);
InitialResourceState, pOptimizedClearValue, NumCastableFormats,
pCastableFormats, pResource, gpuAddress);
}
HRESULT CreateResource(D3D12Chunk chunkType, ID3D12Heap *pHeap, UINT64 HeapOffset,
const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags,
D3D12_RESOURCE_DESC1 pDesc, D3D12ResourceLayout InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession, REFIID riidResource,
ID3D12ProtectedResourceSession *pProtectedSession, UINT NumCastableFormats,
const DXGI_FORMAT *pCastableFormats, REFIID riidResource,
void **ppvResource);
HRESULT CreateResource(D3D12Chunk chunkType, ID3D12Heap *pHeap, UINT64 HeapOffset,
const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags,
D3D12_RESOURCE_DESC pDesc, D3D12ResourceLayout InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession, REFIID riidResource,
void **ppvResource)
ID3D12ProtectedResourceSession *pProtectedSession, UINT NumCastableFormats,
const DXGI_FORMAT *pCastableFormats, REFIID riidResource, void **ppvResource)
{
// upconvert to the DESC1 by just memcpy, since it's a superset and the remainder can be
// 0-initialised
@@ -1400,8 +1403,8 @@ public:
memcpy(&desc1, &pDesc, sizeof(D3D12_RESOURCE_DESC));
return CreateResource(chunkType, pHeap, HeapOffset, pHeapProperties, HeapFlags, desc1,
InitialLayout, pOptimizedClearValue, pProtectedSession, riidResource,
ppvResource);
InitialLayout, pOptimizedClearValue, pProtectedSession,
NumCastableFormats, pCastableFormats, riidResource, ppvResource);
}
IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommittedResource,
@@ -29,8 +29,12 @@
bool WrappedID3D12Device::Serialise_CreateResource(
D3D12Chunk chunkType, ID3D12Heap *pHeap, UINT64 HeapOffset, D3D12_HEAP_PROPERTIES &props,
D3D12_HEAP_FLAGS HeapFlags, D3D12_RESOURCE_DESC1 &desc, D3D12ResourceLayout InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue, ResourceId pResource, uint64_t gpuAddress)
const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT NumCastableFormats,
const DXGI_FORMAT *pCastableFormats, ResourceId pResource, uint64_t gpuAddress)
{
rdcarray<DXGI_FORMAT> CastableFormats;
CastableFormats.assign(pCastableFormats, NumCastableFormats);
// if we're creating a placed resource
if(pHeap)
{
@@ -142,6 +146,14 @@ bool WrappedID3D12Device::Serialise_CreateResource(
__uuidof(ID3D12Resource), (void **)&ret);
break;
}
case D3D12Chunk::Device_CreateCommittedResource3:
{
hr = m_pDevice10->CreateCommittedResource3(
&props, HeapFlags, &desc, InitialLayout.ToLayout(), pOptimizedClearValue, NULL,
(UINT)CastableFormats.size(), CastableFormats.data(), __uuidof(ID3D12Resource),
(void **)&ret);
break;
}
case D3D12Chunk::Device_CreatePlacedResource:
{
hr = m_pDevice->CreatePlacedResource(Unwrap(pHeap), HeapOffset, &desc0,
@@ -156,6 +168,14 @@ bool WrappedID3D12Device::Serialise_CreateResource(
__uuidof(ID3D12Resource), (void **)&ret);
break;
}
case D3D12Chunk::Device_CreatePlacedResource2:
{
hr = m_pDevice10->CreatePlacedResource2(Unwrap(pHeap), HeapOffset, &desc,
InitialLayout.ToLayout(), pOptimizedClearValue,
(UINT)CastableFormats.size(), CastableFormats.data(),
__uuidof(ID3D12Resource), (void **)&ret);
break;
}
case D3D12Chunk::Device_CreateReservedResource:
{
hr = m_pDevice->CreateReservedResource(&desc0, InitialLayout.ToStates(), pOptimizedClearValue,
@@ -168,6 +188,13 @@ bool WrappedID3D12Device::Serialise_CreateResource(
NULL, __uuidof(ID3D12Resource), (void **)&ret);
break;
}
case D3D12Chunk::Device_CreateReservedResource2:
{
hr = m_pDevice10->CreateReservedResource2(
&desc0, InitialLayout.ToLayout(), pOptimizedClearValue, NULL, (UINT)CastableFormats.size(),
CastableFormats.data(), __uuidof(ID3D12Resource), (void **)&ret);
break;
}
default: break;
}
@@ -268,14 +295,13 @@ bool WrappedID3D12Device::Serialise_CreateResource(
return true;
}
HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pHeap,
UINT64 HeapOffset,
const D3D12_HEAP_PROPERTIES *pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags, D3D12_RESOURCE_DESC1 desc,
D3D12ResourceLayout InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession,
REFIID riidResource, void **ppvResource)
HRESULT WrappedID3D12Device::CreateResource(
D3D12Chunk chunkType, ID3D12Heap *pHeap, UINT64 HeapOffset,
const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags,
D3D12_RESOURCE_DESC1 desc, D3D12ResourceLayout InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession, UINT NumCastableFormats,
const DXGI_FORMAT *pCastableFormats, REFIID riidResource, void **ppvResource)
{
if(riidResource != __uuidof(ID3D12Resource) && riidResource != __uuidof(ID3D12Resource1) &&
riidResource != __uuidof(ID3D12Resource2))
@@ -330,7 +356,13 @@ HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pH
outPtr));
break;
}
case D3D12Chunk::Device_CreateCommittedResource3: { break;
case D3D12Chunk::Device_CreateCommittedResource3:
{
SERIALISE_TIME_CALL(ret = m_pDevice10->CreateCommittedResource3(
pHeapProperties, HeapFlags, &desc, InitialLayout.ToLayout(),
pOptimizedClearValue, pProtectedSession, NumCastableFormats,
pCastableFormats, __uuidof(ID3D12Resource), outPtr));
break;
}
case D3D12Chunk::Device_CreatePlacedResource:
{
@@ -346,7 +378,13 @@ HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pH
pOptimizedClearValue, __uuidof(ID3D12Resource), outPtr));
break;
}
case D3D12Chunk::Device_CreatePlacedResource2: { break;
case D3D12Chunk::Device_CreatePlacedResource2:
{
SERIALISE_TIME_CALL(ret = m_pDevice10->CreatePlacedResource2(
Unwrap(pHeap), HeapOffset, &desc, InitialLayout.ToLayout(),
pOptimizedClearValue, NumCastableFormats, pCastableFormats,
__uuidof(ID3D12Resource), outPtr));
break;
}
case D3D12Chunk::Device_CreateReservedResource:
{
@@ -362,7 +400,13 @@ HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pH
pProtectedSession, __uuidof(ID3D12Resource), outPtr));
break;
}
case D3D12Chunk::Device_CreateReservedResource2: { break;
case D3D12Chunk::Device_CreateReservedResource2:
{
SERIALISE_TIME_CALL(ret = m_pDevice10->CreateReservedResource2(
&desc0, InitialLayout.ToLayout(), pOptimizedClearValue,
pProtectedSession, NumCastableFormats, pCastableFormats,
__uuidof(ID3D12Resource), outPtr));
break;
}
default: break;
}
@@ -420,7 +464,13 @@ HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pH
pProtectedSession, riidResource, (void **)&wrapped);
break;
}
case D3D12Chunk::Device_CreateCommittedResource3: { break;
case D3D12Chunk::Device_CreateCommittedResource3:
{
Serialise_CreateCommittedResource3(ser, pHeapProperties, HeapFlags, &desc,
InitialLayout.ToLayout(), pOptimizedClearValue,
pProtectedSession, NumCastableFormats, pCastableFormats,
riidResource, (void **)&wrapped);
break;
}
case D3D12Chunk::Device_CreatePlacedResource:
{
@@ -434,7 +484,12 @@ HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pH
pOptimizedClearValue, riidResource, (void **)&wrapped);
break;
}
case D3D12Chunk::Device_CreatePlacedResource2: { break;
case D3D12Chunk::Device_CreatePlacedResource2:
{
Serialise_CreatePlacedResource2(ser, pHeap, HeapOffset, &desc, InitialLayout.ToLayout(),
pOptimizedClearValue, NumCastableFormats, pCastableFormats,
riidResource, (void **)&wrapped);
break;
}
case D3D12Chunk::Device_CreateReservedResource:
{
@@ -448,7 +503,12 @@ HRESULT WrappedID3D12Device::CreateResource(D3D12Chunk chunkType, ID3D12Heap *pH
pProtectedSession, riidResource, (void **)&wrapped);
break;
}
case D3D12Chunk::Device_CreateReservedResource2: { break;
case D3D12Chunk::Device_CreateReservedResource2:
{
Serialise_CreateReservedResource2(
ser, &desc0, InitialLayout.ToLayout(), pOptimizedClearValue, pProtectedSession,
NumCastableFormats, pCastableFormats, riidResource, (void **)&wrapped);
break;
}
default: break;
}
@@ -570,7 +630,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource(
return Serialise_CreateResource(D3D12Chunk::Device_CreateCommittedResource, NULL, 0, props,
HeapFlags, desc,
D3D12ResourceLayout::FromStates(InitialResourceState),
pOptimizedClearValue, pResource, gpuAddress);
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -585,7 +645,7 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES
{
return CreateResource(D3D12Chunk::Device_CreateCommittedResource, NULL, 0, pHeapProperties,
HeapFlags, *pDesc, D3D12ResourceLayout::FromStates(InitialResourceState),
pOptimizedClearValue, NULL, riidResource, ppvResource);
pOptimizedClearValue, NULL, 0, NULL, riidResource, ppvResource);
}
template <typename SerialiserType>
@@ -615,7 +675,7 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource(
return Serialise_CreateResource(D3D12Chunk::Device_CreatePlacedResource, pHeap, HeapOffset,
props, D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, pResource, gpuAddress);
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -629,7 +689,7 @@ HRESULT WrappedID3D12Device::CreatePlacedResource(ID3D12Heap *pHeap, UINT64 Heap
{
return CreateResource(D3D12Chunk::Device_CreatePlacedResource, pHeap, HeapOffset, NULL,
D3D12_HEAP_FLAG_NONE, *pDesc, D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, NULL, riid, ppvResource);
pOptimizedClearValue, NULL, 0, NULL, riid, ppvResource);
}
template <typename SerialiserType>
@@ -653,9 +713,10 @@ bool WrappedID3D12Device::Serialise_CreateReservedResource(
if(IsReplayingAndReading())
{
D3D12_HEAP_PROPERTIES props = {};
return Serialise_CreateResource(
D3D12Chunk::Device_CreateReservedResource, NULL, 0, props, D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromStates(InitialState), pOptimizedClearValue, pResource, gpuAddress);
return Serialise_CreateResource(D3D12Chunk::Device_CreateReservedResource, NULL, 0, props,
D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -668,7 +729,7 @@ HRESULT WrappedID3D12Device::CreateReservedResource(const D3D12_RESOURCE_DESC *p
{
return CreateResource(D3D12Chunk::Device_CreateReservedResource, NULL, 0, NULL,
D3D12_HEAP_FLAG_NONE, *pDesc, D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, NULL, riid, ppvResource);
pOptimizedClearValue, NULL, 0, NULL, riid, ppvResource);
}
template <typename SerialiserType>
@@ -753,9 +814,10 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE
heapFlags &= ~(D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES |
D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES);
Serialise_CreateResource(
D3D12Chunk::Device_OpenSharedHandle, NULL, 0, heapProperties, heapFlags, desc,
D3D12ResourceLayout::FromStates(D3D12_RESOURCE_STATE_COMMON), NULL, resourceId, 0);
Serialise_CreateResource(D3D12Chunk::Device_OpenSharedHandle, NULL, 0, heapProperties,
heapFlags, desc,
D3D12ResourceLayout::FromStates(D3D12_RESOURCE_STATE_COMMON), NULL,
0, NULL, resourceId, 0);
}
}
else if(isHeap)
@@ -961,7 +1023,7 @@ HRESULT WrappedID3D12Device::OpenSharedHandleInternal(D3D12Chunk chunkType,
hr = CreateResource(D3D12Chunk::Device_OpenSharedHandle, NULL, 0, NULL, D3D12_HEAP_FLAG_NONE,
real->GetDesc(),
D3D12ResourceLayout::FromStates(D3D12_RESOURCE_STATE_COMMON), NULL, NULL,
riid_internal, (void **)&real);
0, NULL, riid_internal, (void **)&real);
// use queryinterface to get the right interface into ppvObj, then release the reference
real->QueryInterface(riid, ppvObj);
@@ -1035,7 +1097,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource1(
return Serialise_CreateResource(D3D12Chunk::Device_CreateCommittedResource1, NULL, 0, props,
HeapFlags, desc,
D3D12ResourceLayout::FromStates(InitialResourceState),
pOptimizedClearValue, pResource, gpuAddress);
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -1049,7 +1111,7 @@ HRESULT WrappedID3D12Device::CreateCommittedResource1(
{
return CreateResource(D3D12Chunk::Device_CreateCommittedResource1, NULL, 0, pHeapProperties,
HeapFlags, *pDesc, D3D12ResourceLayout::FromStates(InitialResourceState),
pOptimizedClearValue, pProtectedSession, riidResource, ppvResource);
pOptimizedClearValue, pProtectedSession, 0, NULL, riidResource, ppvResource);
}
template <typename SerialiserType>
@@ -1076,9 +1138,10 @@ bool WrappedID3D12Device::Serialise_CreateReservedResource1(
if(IsReplayingAndReading())
{
D3D12_HEAP_PROPERTIES props = {};
return Serialise_CreateResource(
D3D12Chunk::Device_CreateReservedResource, NULL, 0, props, D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromStates(InitialState), pOptimizedClearValue, pResource, gpuAddress);
return Serialise_CreateResource(D3D12Chunk::Device_CreateReservedResource1, NULL, 0, props,
D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -1092,7 +1155,7 @@ HRESULT WrappedID3D12Device::CreateReservedResource1(
{
return CreateResource(D3D12Chunk::Device_CreateReservedResource1, NULL, 0, NULL,
D3D12_HEAP_FLAG_NONE, *pDesc, D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, pProtectedSession, riid, ppvResource);
pOptimizedClearValue, pProtectedSession, 0, NULL, riid, ppvResource);
}
template <typename SerialiserType>
@@ -1124,7 +1187,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource2(
return Serialise_CreateResource(D3D12Chunk::Device_CreateCommittedResource2, NULL, 0, props,
HeapFlags, desc,
D3D12ResourceLayout::FromStates(InitialResourceState),
pOptimizedClearValue, pResource, gpuAddress);
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -1138,7 +1201,7 @@ HRESULT WrappedID3D12Device::CreateCommittedResource2(
{
return CreateResource(D3D12Chunk::Device_CreateCommittedResource2, NULL, 0, pHeapProperties,
HeapFlags, *pDesc, D3D12ResourceLayout::FromStates(InitialResourceState),
pOptimizedClearValue, pProtectedSession, riidResource, ppvResource);
pOptimizedClearValue, pProtectedSession, 0, NULL, riidResource, ppvResource);
}
template <typename SerialiserType>
@@ -1168,7 +1231,7 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource1(
return Serialise_CreateResource(D3D12Chunk::Device_CreatePlacedResource1, pHeap, HeapOffset,
props, D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, pResource, gpuAddress);
pOptimizedClearValue, 0, NULL, pResource, gpuAddress);
}
return true;
@@ -1182,7 +1245,45 @@ HRESULT WrappedID3D12Device::CreatePlacedResource1(ID3D12Heap *pHeap, UINT64 Hea
{
return CreateResource(D3D12Chunk::Device_CreatePlacedResource1, pHeap, HeapOffset, NULL,
D3D12_HEAP_FLAG_NONE, *pDesc, D3D12ResourceLayout::FromStates(InitialState),
pOptimizedClearValue, NULL, riid, ppvResource);
pOptimizedClearValue, NULL, 0, NULL, riid, ppvResource);
}
template <typename SerialiserType>
bool WrappedID3D12Device::Serialise_CreateCommittedResource3(
SerialiserType &ser, const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags,
const D3D12_RESOURCE_DESC1 *pDesc, D3D12_BARRIER_LAYOUT InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession, UINT32 NumCastableFormats,
const DXGI_FORMAT *pCastableFormats, REFIID riidResource, void **ppvResource)
{
SERIALISE_ELEMENT_LOCAL(props, *pHeapProperties).Named("pHeapProperties"_lit);
SERIALISE_ELEMENT(HeapFlags);
SERIALISE_ELEMENT_LOCAL(desc, *pDesc).Named("pDesc"_lit).Important();
SERIALISE_ELEMENT(InitialLayout);
SERIALISE_ELEMENT_OPT(pOptimizedClearValue);
// placeholder for future use if we properly capture & replay protected sessions
SERIALISE_ELEMENT_LOCAL(ProtectedSession, ResourceId()).Named("pProtectedSession"_lit);
SERIALISE_ELEMENT(NumCastableFormats);
SERIALISE_ELEMENT_ARRAY(pCastableFormats, NumCastableFormats);
SERIALISE_ELEMENT_LOCAL(guid, riidResource).Named("riidResource"_lit);
SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID())
.TypedAs("ID3D12Resource *"_lit);
SERIALISE_ELEMENT_LOCAL(gpuAddress,
((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer())
.Hidden();
SERIALISE_CHECK_READ_ERRORS();
if(IsReplayingAndReading())
{
return Serialise_CreateResource(D3D12Chunk::Device_CreateCommittedResource3, NULL, 0, props,
HeapFlags, desc, D3D12ResourceLayout::FromLayout(InitialLayout),
pOptimizedClearValue, NumCastableFormats, pCastableFormats,
pResource, gpuAddress);
}
return true;
}
HRESULT WrappedID3D12Device::CreateCommittedResource3(
@@ -1193,7 +1294,45 @@ HRESULT WrappedID3D12Device::CreateCommittedResource3(
_In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, REFIID riidResource,
_COM_Outptr_opt_ void **ppvResource)
{
return E_NOTIMPL;
return CreateResource(D3D12Chunk::Device_CreateCommittedResource3, NULL, 0, pHeapProperties,
HeapFlags, *pDesc, D3D12ResourceLayout::FromLayout(InitialLayout),
pOptimizedClearValue, pProtectedSession, NumCastableFormats,
pCastableFormats, riidResource, ppvResource);
}
template <typename SerialiserType>
bool WrappedID3D12Device::Serialise_CreatePlacedResource2(
SerialiserType &ser, ID3D12Heap *pHeap, UINT64 HeapOffset, const D3D12_RESOURCE_DESC1 *pDesc,
D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue,
UINT32 NumCastableFormats, const DXGI_FORMAT *pCastableFormats, REFIID riid, void **ppvResource)
{
SERIALISE_ELEMENT(pHeap).Important();
SERIALISE_ELEMENT(HeapOffset);
SERIALISE_ELEMENT_LOCAL(desc, *pDesc).Named("pDesc"_lit).Important();
SERIALISE_ELEMENT(InitialLayout);
SERIALISE_ELEMENT_OPT(pOptimizedClearValue);
SERIALISE_ELEMENT(NumCastableFormats);
SERIALISE_ELEMENT_ARRAY(pCastableFormats, NumCastableFormats);
SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit);
SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID())
.TypedAs("ID3D12Resource *"_lit);
SERIALISE_ELEMENT_LOCAL(gpuAddress,
((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer())
.Hidden();
SERIALISE_CHECK_READ_ERRORS();
if(IsReplayingAndReading())
{
D3D12_HEAP_PROPERTIES props = {};
return Serialise_CreateResource(
D3D12Chunk::Device_CreatePlacedResource2, pHeap, HeapOffset, props, D3D12_HEAP_FLAG_NONE,
desc, D3D12ResourceLayout::FromLayout(InitialLayout), pOptimizedClearValue,
NumCastableFormats, pCastableFormats, pResource, gpuAddress);
}
return true;
}
HRESULT WrappedID3D12Device::CreatePlacedResource2(
@@ -1202,7 +1341,45 @@ HRESULT WrappedID3D12Device::CreatePlacedResource2(
UINT32 NumCastableFormats, _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats,
REFIID riid, _COM_Outptr_opt_ void **ppvResource)
{
return E_NOTIMPL;
return CreateResource(D3D12Chunk::Device_CreatePlacedResource2, pHeap, HeapOffset, NULL,
D3D12_HEAP_FLAG_NONE, *pDesc,
D3D12ResourceLayout::FromLayout(InitialLayout), pOptimizedClearValue, NULL,
NumCastableFormats, pCastableFormats, riid, ppvResource);
}
template <typename SerialiserType>
bool WrappedID3D12Device::Serialise_CreateReservedResource2(
SerialiserType &ser, const D3D12_RESOURCE_DESC *pDesc, D3D12_BARRIER_LAYOUT InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue, ID3D12ProtectedResourceSession *pProtectedSession,
UINT32 NumCastableFormats, const DXGI_FORMAT *pCastableFormats, REFIID riid, void **ppvResource)
{
SERIALISE_ELEMENT_LOCAL(desc, *pDesc).Named("pDesc"_lit).Important();
SERIALISE_ELEMENT(InitialLayout);
SERIALISE_ELEMENT_OPT(pOptimizedClearValue);
// placeholder for future use if we properly capture & replay protected sessions
SERIALISE_ELEMENT_LOCAL(ProtectedSession, ResourceId()).Named("pProtectedSession"_lit);
SERIALISE_ELEMENT(NumCastableFormats);
SERIALISE_ELEMENT_ARRAY(pCastableFormats, NumCastableFormats);
SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit);
SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID())
.TypedAs("ID3D12Resource *"_lit);
SERIALISE_ELEMENT_LOCAL(gpuAddress,
((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer())
.Hidden();
SERIALISE_CHECK_READ_ERRORS();
if(IsReplayingAndReading())
{
D3D12_HEAP_PROPERTIES props = {};
return Serialise_CreateResource(
D3D12Chunk::Device_CreateReservedResource2, NULL, 0, props, D3D12_HEAP_FLAG_NONE, desc,
D3D12ResourceLayout::FromLayout(InitialLayout), pOptimizedClearValue, NumCastableFormats,
pCastableFormats, pResource, gpuAddress);
}
return true;
}
HRESULT WrappedID3D12Device::CreateReservedResource2(
@@ -1212,7 +1389,10 @@ HRESULT WrappedID3D12Device::CreateReservedResource2(
_In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, REFIID riid,
_COM_Outptr_opt_ void **ppvResource)
{
return E_NOTIMPL;
return CreateResource(D3D12Chunk::Device_CreateReservedResource2, NULL, 0, NULL,
D3D12_HEAP_FLAG_NONE, *pDesc,
D3D12ResourceLayout::FromLayout(InitialLayout), pOptimizedClearValue,
pProtectedSession, NumCastableFormats, pCastableFormats, riid, ppvResource);
}
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreateCommittedResource,
@@ -1256,3 +1436,23 @@ INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreatePlacedResource1
D3D12_RESOURCE_STATES InitialState,
const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid,
void **ppvResource);
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreateCommittedResource3,
const D3D12_HEAP_PROPERTIES *pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags, const D3D12_RESOURCE_DESC1 *pDesc,
D3D12_BARRIER_LAYOUT InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession,
UINT NumCastableFormats, const DXGI_FORMAT *pCastableFormats,
REFIID riidResource, void **ppvResource);
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreatePlacedResource2, ID3D12Heap *pHeap,
UINT64 HeapOffset, const D3D12_RESOURCE_DESC1 *pDesc,
D3D12_BARRIER_LAYOUT InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
UINT NumCastableFormats, const DXGI_FORMAT *pCastableFormats,
REFIID riid, void **ppvResource);
INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreateReservedResource2,
const D3D12_RESOURCE_DESC *pDesc, D3D12_BARRIER_LAYOUT InitialLayout,
const D3D12_CLEAR_VALUE *pOptimizedClearValue,
ID3D12ProtectedResourceSession *pProtectedSession,
UINT NumCastableFormats, const DXGI_FORMAT *pCastableFormats,
REFIID riid, void **ppvResource);
@@ -2286,22 +2286,6 @@ HRESULT WrappedID3D12Device::CheckFeatureSupport(D3D12_FEATURE Feature, void *pF
return S_OK;
}
else if(Feature == D3D12_FEATURE_D3D12_OPTIONS12)
{
D3D12_FEATURE_DATA_D3D12_OPTIONS12 *opts =
(D3D12_FEATURE_DATA_D3D12_OPTIONS12 *)pFeatureSupportData;
if(FeatureSupportDataSize != sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS12))
return E_INVALIDARG;
opts->EnhancedBarriersSupported = FALSE;
// could support this but the entry point is tied to barriers
opts->RelaxedFormatCastingSupported = FALSE;
if(dolog)
RDCLOG("Forcing no new barrier support");
return S_OK;
}
else if(Feature == D3D12_FEATURE_D3D12_OPTIONS18)
{
D3D12_FEATURE_DATA_D3D12_OPTIONS18 *opts =
+8
View File
@@ -724,6 +724,10 @@ void D3D12ResourceManager::ApplyBarriers(BarrierSet &barriers,
if(trans.SyncBefore == D3D12_BARRIER_SYNC_SPLIT)
continue;
// skip non-layout barriers (including UNDEFINED-UNDEFINED)
if(trans.LayoutBefore == trans.LayoutAfter)
continue;
if(trans.Subresources.NumMipLevels == 0)
{
size_t first = 0;
@@ -799,6 +803,8 @@ void AddStateResetBarrier(D3D12ResourceLayout srcState, D3D12ResourceLayout dstS
b.AccessAfter = D3D12_BARRIER_ACCESS_COMMON;
b.SyncAfter = D3D12_BARRIER_SYNC_ALL;
b.LayoutAfter = dstState.ToLayout();
if(b.LayoutAfter == D3D12_BARRIER_LAYOUT_UNDEFINED)
b.AccessAfter = D3D12_BARRIER_ACCESS_NO_ACCESS;
b.Subresources.IndexOrFirstMipLevel = (UINT)subresource;
b.pResource = res;
@@ -832,6 +838,8 @@ void AddStateResetBarrier(D3D12ResourceLayout srcState, D3D12ResourceLayout dstS
b.AccessAfter = D3D12_BARRIER_ACCESS_COMMON;
b.SyncAfter = D3D12_BARRIER_SYNC_ALL;
b.LayoutAfter = dstState.ToLayout();
if(b.LayoutAfter == D3D12_BARRIER_LAYOUT_UNDEFINED)
b.AccessAfter = D3D12_BARRIER_ACCESS_NO_ACCESS;
b.Subresources.IndexOrFirstMipLevel = (UINT)subresource;
b.pResource = res;
+4 -4
View File
@@ -1756,7 +1756,7 @@ void DoSerialise(SerialiserType &ser, D3D12_TEXTURE_BARRIER &el)
SERIALISE_MEMBER(AccessAfter);
SERIALISE_MEMBER(LayoutBefore);
SERIALISE_MEMBER(LayoutAfter);
SERIALISE_MEMBER(pResource);
SERIALISE_MEMBER(pResource).Important();
SERIALISE_MEMBER(Subresources);
SERIALISE_MEMBER(Flags);
}
@@ -1768,7 +1768,7 @@ void DoSerialise(SerialiserType &ser, D3D12_BUFFER_BARRIER &el)
SERIALISE_MEMBER(SyncAfter);
SERIALISE_MEMBER(AccessBefore);
SERIALISE_MEMBER(AccessAfter);
SERIALISE_MEMBER(pResource);
SERIALISE_MEMBER(pResource).Important();
SERIALISE_MEMBER(Offset);
SERIALISE_MEMBER(Size);
}
@@ -1788,12 +1788,12 @@ void DoSerialise(SerialiserType &ser, D3D12_BARRIER_GROUP &el)
}
case D3D12_BARRIER_TYPE_TEXTURE:
{
SERIALISE_MEMBER_ARRAY(pTextureBarriers, NumBarriers);
SERIALISE_MEMBER_ARRAY(pTextureBarriers, NumBarriers).Important();
break;
}
case D3D12_BARRIER_TYPE_BUFFER:
{
SERIALISE_MEMBER_ARRAY(pBufferBarriers, NumBarriers);
SERIALISE_MEMBER_ARRAY(pBufferBarriers, NumBarriers).Important();
break;
}
}
+2 -1
View File
@@ -28,7 +28,7 @@
template <>
rdcstr DoStringise(const D3D12Chunk &el)
{
RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1122, "Chunks changed without updating names");
RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1123, "Chunks changed without updating names");
BEGIN_ENUM_STRINGISE(D3D12Chunk)
{
@@ -219,6 +219,7 @@ rdcstr DoStringise(const D3D12Chunk &el)
STRINGISE_ENUM_CLASS_NAMED(List_RSSetDepthBias, "ID3D12GraphicsCommandList9::RSSetDepthBias");
STRINGISE_ENUM_CLASS_NAMED(List_IASetIndexBufferStripCutValue,
"ID3D12GraphicsCommandList9::IASetIndexBufferStripCutValue");
STRINGISE_ENUM_CLASS_NAMED(List_Barrier, "ID3D12GraphicsCommandList7::Barrier");
STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk");
}
END_ENUM_STRINGISE()
+1
View File
@@ -116,6 +116,7 @@
</Expand>
</Type>
<Type Name="D3D12ResourceLayout">
<DisplayString Condition="value == D3D12_BARRIER_LAYOUT_UNDEFINED">{D3D12_BARRIER_LAYOUT_UNDEFINED}</DisplayString>
<DisplayString Condition="value &amp; 0x80000000U">{D3D12_BARRIER_LAYOUT(value &amp; 0x7fffffffU)}</DisplayString>
<DisplayString>{D3D12_RESOURCE_STATES(value)}</DisplayString>
</Type>