[idd] driver: use the frameSize instead of the resource size

As the resource size can be larger then the actual frame data, we
need to track this seperately so that we don't waste cycles copying
data the client will never use.
This commit is contained in:
Geoffrey McRae 2025-03-28 14:35:19 +00:00
parent 91e8440c9d
commit 9ffb800e93
3 changed files with 15 additions and 8 deletions

View File

@ -12,7 +12,10 @@ bool CFrameBufferResource::Init(CSwapChainProcessor * swapChain, uint8_t * base,
// nothing to do if the resource already exists and is large enough
if (m_base == base && m_size >= size)
{
m_frameSize = size;
return true;
}
Reset();
@ -87,9 +90,10 @@ bool CFrameBufferResource::Init(CSwapChainProcessor * swapChain, uint8_t * base,
m_res->SetName(resName);
m_base = base;
m_size = size;
m_valid = true;
m_base = base;
m_size = size;
m_frameSize = size;
m_valid = true;
return true;
}

View File

@ -16,6 +16,7 @@ class CFrameBufferResource
bool m_valid;
uint8_t * m_base;
size_t m_size;
size_t m_frameSize;
ComPtr<ID3D12Resource> m_res;
void * m_map;
@ -23,10 +24,11 @@ class CFrameBufferResource
bool Init(CSwapChainProcessor * swapChain, uint8_t * base, size_t size);
void Reset();
bool IsValid() { return m_valid; }
uint8_t * GetBase() { return m_base; }
size_t GetSize() { return m_size; }
void * GetMap() { return m_map; }
bool IsValid() { return m_valid; }
uint8_t * GetBase() { return m_base; }
size_t GetSize() { return m_size; }
size_t GetFrameSize() { return m_frameSize; }
void * GetMap() { return m_map; }
ComPtr<ID3D12Resource> Get() { return m_res; }
};

View File

@ -217,7 +217,8 @@ void CSwapChainProcessor::SwapChainNewFrame(ComPtr<IDXGIResource> acquiredBuffer
m_dx12Device->GetCopyQueue().Reset();
if (m_dx12Device->IsIndirectCopy())
m_devContext->WriteFrameBuffer(fbRes->GetMap(), 0, fbRes->GetSize(), true);
m_devContext->WriteFrameBuffer(
fbRes->GetMap(), 0, fbRes->GetFrameSize(), true);
else
m_devContext->FinalizeFrameBuffer();
}