| 599 | } |
| 600 | |
| 601 | void Tr2RenderContextBase::RenderGdprBatches( ITriRenderBatchAccumulator* batches, const BlueSharedString& techniqueName ) |
| 602 | { |
| 603 | |
| 604 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 605 | |
| 606 | Tr2RenderContext* renderContext = reinterpret_cast<Tr2RenderContext*>( this ); |
| 607 | |
| 608 | renderContext->SetTopology( Tr2RenderContextEnum::TOP_TRIANGLES ); |
| 609 | |
| 610 | auto& gdprBatches = batches->GetGdprBatches(); |
| 611 | |
| 612 | #if TRINITY_PLATFORM == TRINITY_DIRECTX12 || TRINITY_PLATFORM == TRINITY_METAL |
| 613 | if( g_gdrEnabled ) |
| 614 | { |
| 615 | CCP_STATS_ZONE( "Indirect drawing" ); |
| 616 | #if TRINITY_PLATFORM != TRINITY_METAL |
| 617 | GPU_REGION( *renderContext, "Indirect drawing" ); |
| 618 | #endif |
| 619 | |
| 620 | Tr2RenderContext* primaryContext = reinterpret_cast<Tr2RenderContext*>( this ); |
| 621 | |
| 622 | static Tr2IndirectDrawBuffer s_buffer; |
| 623 | if( !s_buffer.IsValid() ) |
| 624 | { |
| 625 | s_buffer.Create( 1024 * 1024 ); |
| 626 | if( !s_buffer.IsValid() ) |
| 627 | { |
| 628 | return; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | s_buffer.SetFrameNumbers( primaryContext->GetPrimaryRenderContext().GetRecordingFrameNumber(), primaryContext->GetPrimaryRenderContext().GetRenderedFrameNumber() ); |
| 633 | |
| 634 | struct Bin |
| 635 | { |
| 636 | Tr2IndirectDrawBufferWriter writer; |
| 637 | uint32_t firstIndex; |
| 638 | uint32_t endIndex; |
| 639 | uint32_t technique; |
| 640 | uint32_t pass; |
| 641 | bool binStart; |
| 642 | }; |
| 643 | |
| 644 | std::vector<Bin> writers; |
| 645 | writers.reserve( gdprBatches.size() ); |
| 646 | |
| 647 | { |
| 648 | CCP_STATS_ZONE( "Prepare" ); |
| 649 | |
| 650 | uint32_t size = uint32_t( gdprBatches.size() ); |
| 651 | uint32_t endIndex = 0; |
| 652 | for( uint32_t firstIndex = 0; firstIndex < size; firstIndex = endIndex ) |
| 653 | { |
| 654 | auto& firstBatch = gdprBatches[firstIndex]; |
| 655 | endIndex = firstIndex + firstBatch.m_groupCount; |
| 656 | |
| 657 | uint32_t technique; |
| 658 | if( !firstBatch.m_shader->GetTechniqueIndex( techniqueName, technique ) ) |
nothing calls this directly
no test coverage detected