Unwrap presentation queues passed to ResizeBuffers1

This commit is contained in:
baldurk
2016-10-27 19:35:44 +02:00
parent 3c222af4e2
commit f7c155acd3
7 changed files with 52 additions and 14 deletions
+12 -1
View File
@@ -2408,8 +2408,19 @@ void WrappedID3D11Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
RDCFATAL("Unexpected replay type");
}
void WrappedID3D11Device::ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap)
void WrappedID3D11Device::ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap, UINT QueueCount,
IUnknown *const *ppPresentQueue,
IUnknown **unwrappedQueues)
{
RDCASSERT(ppPresentQueue == NULL);
if(ppPresentQueue)
{
RDCERR("D3D11 doesn't support present queues - passing through unmodified");
for(UINT i = 0; i < QueueCount; i++)
unwrappedQueues[i] = ppPresentQueue[i];
}
for(int i = 0; i < swap->GetNumBackbuffers(); i++)
{
WrappedID3D11Texture2D1 *wrapped11 = (WrappedID3D11Texture2D1 *)swap->GetBackbuffers()[i];
+2 -1
View File
@@ -480,7 +480,8 @@ public:
void NewSwapchainBuffer(IUnknown *backbuffer);
void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap);
void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap, UINT QueueCount,
IUnknown *const *ppPresentQueue, IUnknown **unwrappedQueues);
void InternalRef() { InterlockedIncrement(&m_InternalRefcount); }
void InternalRelease() { InterlockedDecrement(&m_InternalRefcount); }
+3 -2
View File
@@ -148,9 +148,10 @@ public:
{
m_pDevice->NewSwapchainBuffer(backbuffer);
}
virtual void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swapChain)
virtual void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swapChain, UINT QueueCount,
IUnknown *const *ppPresentQueue, IUnknown **unwrappedQueues)
{
m_pDevice->ReleaseSwapchainResources(swapChain);
m_pDevice->ReleaseSwapchainResources(swapChain, QueueCount, ppPresentQueue, unwrappedQueues);
}
virtual IUnknown *WrapSwapchainBuffer(WrappedIDXGISwapChain4 *swap, DXGI_SWAP_CHAIN_DESC *swapDesc,
UINT buffer, IUnknown *realSurface)
+14 -1
View File
@@ -542,8 +542,21 @@ void WrappedID3D12Device::ApplyBarriers(vector<D3D12_RESOURCE_BARRIER> &barriers
GetResourceManager()->ApplyBarriers(barriers, m_ResourceStates);
}
void WrappedID3D12Device::ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap)
void WrappedID3D12Device::ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap, UINT QueueCount,
IUnknown *const *ppPresentQueue,
IUnknown **unwrappedQueues)
{
if(ppPresentQueue)
{
for(UINT i = 0; i < QueueCount; i++)
{
WrappedID3D12CommandQueue *wrappedQ = (WrappedID3D12CommandQueue *)ppPresentQueue[i];
RDCASSERT(WrappedID3D12CommandQueue::IsAlloc(wrappedQ));
unwrappedQueues[i] = wrappedQ->GetReal();
}
}
for(int i = 0; i < swap->GetNumBackbuffers(); i++)
{
WrappedID3D12Resource *wrapped = (WrappedID3D12Resource *)swap->GetBackbuffers()[i];
+2 -1
View File
@@ -448,7 +448,8 @@ public:
HRESULT Present(WrappedIDXGISwapChain4 *swap, UINT SyncInterval, UINT Flags);
void NewSwapchainBuffer(IUnknown *backbuffer) {}
void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap);
void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swap, UINT QueueCount,
IUnknown *const *ppPresentQueue, IUnknown **unwrappedQueues);
void Map(WrappedID3D12Resource *Resource, UINT Subresource);
void Unmap(WrappedID3D12Resource *Resource, UINT Subresource, byte *mapPtr,
+14 -6
View File
@@ -200,7 +200,7 @@ WrappedIDXGISwapChain4::WrappedIDXGISwapChain4(IDXGISwapChain *real, HWND wnd, I
WrappedIDXGISwapChain4::~WrappedIDXGISwapChain4()
{
m_pDevice->ReleaseSwapchainResources(this);
m_pDevice->ReleaseSwapchainResources(this, 0, NULL, NULL);
SAFE_RELEASE(m_pDevice);
@@ -267,9 +267,10 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGISwapChain4::QueryInterface(REFIID riid, vo
return RefCountDXGIObject::QueryInterface(riid, ppvObject);
}
void WrappedIDXGISwapChain4::ReleaseBuffersForResize()
void WrappedIDXGISwapChain4::ReleaseBuffersForResize(UINT QueueCount, IUnknown *const *ppPresentQueue,
IUnknown **unwrappedQueues)
{
m_pDevice->ReleaseSwapchainResources(this);
m_pDevice->ReleaseSwapchainResources(this, QueueCount, ppPresentQueue, unwrappedQueues);
}
void WrappedIDXGISwapChain4::WrapBuffersAfterResize()
@@ -303,7 +304,7 @@ HRESULT WrappedIDXGISwapChain4::ResizeBuffers(
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags)
{
ReleaseBuffersForResize();
ReleaseBuffersForResize(0, NULL, NULL);
HRESULT ret = m_pReal->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags);
@@ -319,10 +320,17 @@ HRESULT WrappedIDXGISwapChain4::ResizeBuffers1(_In_ UINT BufferCount, _In_ UINT
_In_reads_(BufferCount)
IUnknown *const *ppPresentQueue)
{
ReleaseBuffersForResize();
IUnknown **unwrappedQueues = NULL;
if(ppPresentQueue)
unwrappedQueues = new IUnknown *[BufferCount];
ReleaseBuffersForResize(BufferCount, ppPresentQueue, unwrappedQueues);
HRESULT ret = m_pReal3->ResizeBuffers1(BufferCount, Width, Height, Format, SwapChainFlags,
pCreationNodeMask, ppPresentQueue);
pCreationNodeMask, unwrappedQueues);
SAFE_DELETE_ARRAY(unwrappedQueues);
WrapBuffersAfterResize();
+5 -2
View File
@@ -170,7 +170,9 @@ struct ID3DDevice
virtual void FirstFrame(WrappedIDXGISwapChain4 *swapChain) = 0;
virtual void NewSwapchainBuffer(IUnknown *backbuffer) = 0;
virtual void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swapChain) = 0;
virtual void ReleaseSwapchainResources(WrappedIDXGISwapChain4 *swapChain, UINT QueueCount,
IUnknown *const *ppPresentQueue,
IUnknown **unwrappedQueues) = 0;
virtual IUnknown *WrapSwapchainBuffer(WrappedIDXGISwapChain4 *swap, DXGI_SWAP_CHAIN_DESC *swapDesc,
UINT buffer, IUnknown *realSurface) = 0;
@@ -556,7 +558,8 @@ class WrappedIDXGISwapChain4 : public IDXGISwapChain4, public RefCountDXGIObject
IUnknown *m_pBackBuffers[MAX_NUM_BACKBUFFERS];
void ReleaseBuffersForResize();
void ReleaseBuffersForResize(UINT QueueCount, IUnknown *const *ppPresentQueue,
IUnknown **unwrappedQueues);
void WrapBuffersAfterResize();
public: