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

Method RenderGdprBatches

trinity/Tr2RenderContext.cpp:601–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601void 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 ) )

Callers

nothing calls this directly

Calls 15

sizeMethod · 0.80
GetTechniqueIndexMethod · 0.80
GetPassCountMethod · 0.80
NextMethod · 0.80
CopyArgumentsMethod · 0.80
GetEffectPathNameMethod · 0.80
ApplyStreamSourceMethod · 0.80
ApplyIndexBufferMethod · 0.80
ApplyAllStateForPassMethod · 0.80
SetAllStateMethod · 0.80

Tested by

no test coverage detected