mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-11 09:58:10 +00:00
[idd] rewrite to support DirectX12 copy
This commit is contained in:
31
idd/LGIdd/CFrameBufferPool.cpp
Normal file
31
idd/LGIdd/CFrameBufferPool.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "CFrameBufferPool.h"
|
||||
#include "CSwapChainProcessor.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void CFrameBufferPool::Init(CSwapChainProcessor * swapChain)
|
||||
{
|
||||
m_swapChain = swapChain;
|
||||
}
|
||||
|
||||
void CFrameBufferPool::Reset()
|
||||
{
|
||||
for (int i = 0; i < ARRAYSIZE(m_buffers); ++i)
|
||||
m_buffers[i].Reset();
|
||||
}
|
||||
|
||||
CFrameBufferResource * CFrameBufferPool::Get(const CIndirectDeviceContext::PreparedFrameBuffer& buffer, size_t minSize)
|
||||
{
|
||||
if (buffer.frameIndex > ARRAYSIZE(m_buffers) - 1)
|
||||
return nullptr;
|
||||
|
||||
CFrameBufferResource* fbr = &m_buffers[buffer.frameIndex];
|
||||
if (!fbr->IsValid() || fbr->GetBase() != buffer.mem || fbr->GetSize() < minSize)
|
||||
{
|
||||
fbr->Reset();
|
||||
if (!fbr->Init(m_swapChain, buffer.mem, minSize))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return fbr;
|
||||
}
|
Reference in New Issue
Block a user