MCPcopy Create free account
hub / github.com/carbonengine/trinity / MapForReading

Method MapForReading

trinityal/dx11/Tr2BufferALDx11.cpp:241–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241ALResult Tr2BufferAL::MapForReading( const void*& data, Tr2RenderContextAL& renderContext )
242{
243 if( !renderContext.IsValid() || !IsValid() )
244 {
245 data = nullptr;
246 return E_INVALIDCALL;
247 }
248 if( !HasFlag( m_desc.cpuUsage, Tr2CpuUsage::READ ) )
249 {
250 return E_INVALIDCALL;
251 }
252 CR_RETURN_HR( CreateStagingBuffer( m_desc.stride * m_desc.count, renderContext ) );
253
254 renderContext.m_context->CopyResource( m_staging, m_buffer );
255
256 D3D11_MAPPED_SUBRESOURCE ms = { nullptr, 0, 0 };
257 auto hr = renderContext.m_context->Map( m_staging, 0, D3D11_MAP_READ, 0, &ms );
258 if( !ms.pData )
259 {
260 return E_FAIL;
261 }
262 data = ms.pData;
263 return hr;
264}
265
266ALResult Tr2BufferAL::MapForReading( const void*& data, uint32_t offset, uint32_t size, Tr2RenderContextAL& renderContext )
267{

Callers

nothing calls this directly

Calls 6

CopyResourceMethod · 0.80
IsValidFunction · 0.70
HasFlagFunction · 0.70
IsValidMethod · 0.45
MapMethod · 0.45
CopySubresourceRegionMethod · 0.45

Tested by

no test coverage detected