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

Method RenderBatchesInOrder

trinity/Tr2RenderContext.cpp:351–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void Tr2RenderContextBase::RenderBatchesInOrder( ITriRenderBatchAccumulator* batches, const BlueSharedString& techniqueName )
352{
353 Tr2RenderContext* primaryContext = reinterpret_cast<Tr2RenderContext*>( this );
354 Tr2RingBuffer::GetInstance<Float4x3>().PrepareBuffer( *primaryContext );
355 Tr2RingBuffer::GetInstance<Tr2MorphTargetAnimationData>().PrepareBuffer( *primaryContext );
356
357 D3DPERF_EVENT( L"Tr2RenderContext::RenderBatchesInOrder" );
358
359 Tr2RenderContext* renderContext = reinterpret_cast<Tr2RenderContext*>( this );
360
361 CCP_STATS_ZONE( "Direct drawing (sorted)" );
362#if TRINITY_PLATFORM != TRINITY_METAL
363 GPU_REGION( *renderContext, "Direct drawing (sorted)" );
364#endif
365
366 UseTextures( batches, techniqueName, *renderContext );
367
368 Tr2ConstantBufferAL* perObjectConstantBuffers[CBUFFER_COUNT];
369 for( uint32_t i = 0; i != CBUFFER_COUNT; ++i )
370 {
371 perObjectConstantBuffers[i] = &m_perObjectConstantBuffers[i];
372 }
373
374 const Tr2PerObjectData* curPerObjectData = nullptr;
375 Tr2Shader* lastShader = nullptr;
376 uint32_t technique = 0;
377 uint32_t passCount = 0;
378 uint32_t shaderMask = 0;
379
380 for( auto& batch : batches->GetBatches() )
381 {
382 if( batch.m_renderingMode != Tr2EffectStateManager::RM_ANY )
383 {
384 m_esm.ApplyStandardStates( batch.m_renderingMode );
385 }
386
387 if( batch.m_shader != lastShader )
388 {
389 if( !batch.m_shader->GetTechniqueIndex( techniqueName, technique ) )
390 {
391 continue;
392 }
393 passCount = batch.m_shader->GetPassCount( technique );
394 if( passCount == 0 )
395 {
396 continue;
397 }
398 shaderMask = batch.m_shader->GetShaderTypeMask( technique );
399 lastShader = batch.m_shader;
400 }
401
402 const char* effectPath = dynamic_cast<Tr2Effect*>( batch.m_material )->GetEffectPathName();
403 CCP_STATS_ZONE( effectPath );
404
405#if TRINITY_PLATFORM == TRINITY_DIRECTX12
406 GPU_REGION( *renderContext, effectPath );
407#endif
408

Callers

nothing calls this directly

Calls 15

UseTexturesFunction · 0.85
GetPassNameFunction · 0.85
SubmitGeometryFunction · 0.85
PrepareBufferMethod · 0.80
ApplyStandardStatesMethod · 0.80
GetTechniqueIndexMethod · 0.80
GetPassCountMethod · 0.80
GetShaderTypeMaskMethod · 0.80
GetEffectPathNameMethod · 0.80
ApplyAllStateForPassMethod · 0.80
GetBatchesMethod · 0.45

Tested by

no test coverage detected