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

Method RenderBatchGroup

trinity/Tr2RenderContext.cpp:457–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void Tr2RenderContextBase::RenderBatchGroup( std::vector<Tr2RenderBatch>::const_iterator startBatch, const BlueSharedString& techniqueName, Tr2ConstantBufferAL** buffers, Tr2RenderContext& renderContext )
458{
459
460 auto& firstBatch = *startBatch;
461 auto endBatch = startBatch + firstBatch.m_groupCount;
462
463 if( firstBatch.m_renderingMode != Tr2EffectStateManager::RM_ANY )
464 {
465 m_esm.ApplyStandardStates( firstBatch.m_renderingMode );
466 }
467
468 auto currentShader = firstBatch.m_material->GetShaderStateInterface();
469 uint32_t technique;
470 if( !currentShader->GetTechniqueIndex( techniqueName, technique ) )
471 {
472 return;
473 }
474 const uint32_t passCount = currentShader->GetPassCount( technique );
475 if( passCount == 0 )
476 {
477 return;
478 }
479
480 const char* effectPath = dynamic_cast<Tr2Effect*>( startBatch->m_material )->GetEffectPathName();
481 CCP_STATS_ZONE( effectPath );
482#if TRINITY_PLATFORM == TRINITY_DIRECTX12
483 GPU_REGION( renderContext, effectPath );
484#endif
485
486 const auto currentShaderMask = currentShader->GetShaderTypeMask( technique );
487
488 m_esm.ApplyVertexDeclaration( firstBatch.m_vertexDeclaration );
489 if( firstBatch.m_vertexStreams[0] )
490 {
491 m_esm.ApplyStreamSource( 0, *firstBatch.m_vertexStreams[0], 0, firstBatch.m_stride[0] );
492 }
493 if( firstBatch.m_vertexStreams[1] )
494 {
495 m_esm.ApplyStreamSource( 1, *firstBatch.m_vertexStreams[1], 0, firstBatch.m_stride[1] );
496 }
497 if( firstBatch.m_indexBuffer )
498 {
499 m_esm.ApplyIndexBuffer( *firstBatch.m_indexBuffer, firstBatch.m_indexStride );
500 }
501
502 for( uint32_t passIx = 0; passIx < passCount; ++passIx )
503 {
504 auto batch = startBatch;
505
506 const auto& passDesc = currentShader->GetEffectDescription().techniques[technique].passes[passIx];
507
508 currentShader->ApplyAllStateForPass( technique, passIx, renderContext );
509
510 for( auto batch = startBatch; batch != endBatch; ++batch )
511 {
512 batch->m_material->ApplyMaterialDataForPass( technique, passIx, renderContext );
513 if( batch->m_objectData )
514 {

Callers 1

RenderSortedBatchesMethod · 0.80

Calls 15

GetPassNameFunction · 0.85
ApplyStandardStatesMethod · 0.80
GetTechniqueIndexMethod · 0.80
GetPassCountMethod · 0.80
GetEffectPathNameMethod · 0.80
GetShaderTypeMaskMethod · 0.80
ApplyStreamSourceMethod · 0.80
ApplyIndexBufferMethod · 0.80
ApplyAllStateForPassMethod · 0.80

Tested by

no test coverage detected