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

Method UploadTransforms

trinity/Tr2RingBuffer.cpp:19–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18template <typename T>
19uint32_t Tr2RingBuffer::UploadTransforms( const T* data, uint32_t dataCount )
20{
21 CCP_ASSERT_M( sizeof( T ) == m_stride, "Stride has to match size of datatype!" );
22
23 std::unique_lock lock( m_mutex );
24 if( m_head >= m_tail )
25 {
26 if( m_head + dataCount > m_size )
27 {
28 m_head = 0;
29 }
30 }
31 if( m_head < m_tail && m_head + dataCount >= m_tail )
32 {
33 CCP_LOG( "Resizing Tr2RingBuffer %s to %uKB", m_name.c_str(), uint32_t( m_size * 2 * m_stride ) / 1024 );
34 Resize( m_size * 2 );
35 }
36
37 memcpy( m_mirror.data() + m_head * m_stride, data, dataCount * m_stride );
38
39 if( m_dirtyRegions[0].offset + m_dirtyRegions[0].size == m_head )
40 {
41 m_dirtyRegions[0].size += dataCount;
42 }
43 else if( m_dirtyRegions[1].offset + m_dirtyRegions[1].size == m_head )
44 {
45 m_dirtyRegions[1].size += dataCount;
46 }
47 else
48 {
49 CCP_ASSERT( false );
50 }
51
52 auto result = m_head;
53 m_head += dataCount;
54 return result;
55}
56
57void Tr2RingBuffer::PrepareBuffer( Tr2RenderContext& renderContext )
58{

Callers 7

GetPerObjectDataMethod · 0.80
UpdateRtSkeletonMethod · 0.80
UpdateRtSkeletonMethod · 0.80
GetPerObjectDataMethod · 0.80
UpdateRtSkeletonMethod · 0.80
GetPerObjectDataMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected