| 455 | } |
| 456 | |
| 457 | void 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 | { |
no test coverage detected