From 9ffb800e93c7f52b55f256dc6412e333f48b113c Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 28 Mar 2025 14:35:19 +0000 Subject: [PATCH] [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. --- idd/LGIdd/CFrameBufferResource.cpp | 10 +++++++--- idd/LGIdd/CFrameBufferResource.h | 10 ++++++---- idd/LGIdd/CSwapChainProcessor.cpp | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/idd/LGIdd/CFrameBufferResource.cpp b/idd/LGIdd/CFrameBufferResource.cpp index cebf65af..41c30d90 100644 --- a/idd/LGIdd/CFrameBufferResource.cpp +++ b/idd/LGIdd/CFrameBufferResource.cpp @@ -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; } diff --git a/idd/LGIdd/CFrameBufferResource.h b/idd/LGIdd/CFrameBufferResource.h index 1ec6a2f4..ba8377d9 100644 --- a/idd/LGIdd/CFrameBufferResource.h +++ b/idd/LGIdd/CFrameBufferResource.h @@ -16,6 +16,7 @@ class CFrameBufferResource bool m_valid; uint8_t * m_base; size_t m_size; + size_t m_frameSize; ComPtr 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 Get() { return m_res; } }; diff --git a/idd/LGIdd/CSwapChainProcessor.cpp b/idd/LGIdd/CSwapChainProcessor.cpp index 56d58833..eec3afde 100644 --- a/idd/LGIdd/CSwapChainProcessor.cpp +++ b/idd/LGIdd/CSwapChainProcessor.cpp @@ -217,7 +217,8 @@ void CSwapChainProcessor::SwapChainNewFrame(ComPtr 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(); } \ No newline at end of file