| 349 | } |
| 350 | |
| 351 | void 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 |
nothing calls this directly
no test coverage detected