mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Implement complex version of CopyDescriptors
This commit is contained in:
@@ -847,6 +847,40 @@ void WrappedID3D12Device::CopyDescriptors(
|
||||
|
||||
RDCUNIMPLEMENTED("CopyDescriptors does not copy our internal descriptor data");
|
||||
|
||||
UINT srcRange = 0, dstRange = 0;
|
||||
UINT srcIdx = 0, dstIdx = 0;
|
||||
|
||||
D3D12Descriptor *src = GetWrapped(pSrcDescriptorRangeStarts[0]);
|
||||
D3D12Descriptor *dst = GetWrapped(pDestDescriptorRangeStarts[0]);
|
||||
|
||||
for(; srcRange < NumSrcDescriptorRanges && dstRange < NumDestDescriptorRanges;)
|
||||
{
|
||||
dst[dstIdx].CopyFrom(src[srcIdx]);
|
||||
|
||||
srcIdx++;
|
||||
dstIdx++;
|
||||
|
||||
// move source onto the next range
|
||||
if(srcIdx >= pSrcDescriptorRangeSizes[srcRange])
|
||||
{
|
||||
srcRange++;
|
||||
srcIdx = 0;
|
||||
|
||||
// check srcRange is valid - we might be about to exit the loop from reading off the end
|
||||
if(srcRange < NumSrcDescriptorRanges)
|
||||
src = GetWrapped(pSrcDescriptorRangeStarts[srcRange]);
|
||||
}
|
||||
|
||||
if(dstIdx >= pDestDescriptorRangeSizes[srcRange])
|
||||
{
|
||||
dstRange++;
|
||||
dstIdx = 0;
|
||||
|
||||
if(dstRange < NumDestDescriptorRanges)
|
||||
dst = GetWrapped(pDestDescriptorRangeStarts[srcRange]);
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY(dstStarts);
|
||||
SAFE_DELETE_ARRAY(srcStarts);
|
||||
}
|
||||
@@ -863,16 +897,7 @@ void WrappedID3D12Device::CopyDescriptorsSimple(UINT NumDescriptors,
|
||||
D3D12Descriptor *dst = GetWrapped(DestDescriptorRangeStart);
|
||||
|
||||
for(UINT i = 0; i < NumDescriptors; i++)
|
||||
{
|
||||
// save these so we can do a straight copy then restore them
|
||||
WrappedID3D12DescriptorHeap *heap = dst[i].samp.heap;
|
||||
uint32_t index = dst[i].samp.idx;
|
||||
|
||||
dst[i] = src[i];
|
||||
|
||||
dst[i].samp.heap = heap;
|
||||
dst[i].samp.idx = index;
|
||||
}
|
||||
dst[i].CopyFrom(src[i]);
|
||||
}
|
||||
|
||||
HRESULT WrappedID3D12Device::OpenSharedHandle(HANDLE NTHandle, REFIID riid, void **ppvObj)
|
||||
|
||||
@@ -145,6 +145,18 @@ void D3D12Descriptor::Create(ID3D12Device *dev, D3D12_CPU_DESCRIPTOR_HANDLE hand
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12Descriptor::CopyFrom(const D3D12Descriptor &src)
|
||||
{
|
||||
// save these so we can do a straight copy then restore them
|
||||
WrappedID3D12DescriptorHeap *heap = samp.heap;
|
||||
uint32_t index = samp.idx;
|
||||
|
||||
*this = src;
|
||||
|
||||
samp.heap = heap;
|
||||
samp.idx = index;
|
||||
}
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE Unwrap(D3D12_CPU_DESCRIPTOR_HANDLE handle)
|
||||
{
|
||||
if(handle.ptr == 0)
|
||||
|
||||
@@ -149,6 +149,7 @@ struct D3D12Descriptor
|
||||
void Init(ID3D12Resource *pResource, const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc);
|
||||
|
||||
void Create(ID3D12Device *dev, D3D12_CPU_DESCRIPTOR_HANDLE handle);
|
||||
void CopyFrom(const D3D12Descriptor &src);
|
||||
|
||||
union
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user