mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-10-31 04:31:57 +00:00 
			
		
		
		
	[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:
		| @@ -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; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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; } | ||||
| }; | ||||
|   | ||||
| @@ -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(); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Geoffrey McRae
					Geoffrey McRae