-------------------------------------------------------------------------------------- Description: Sorts particles! --------------------------------------------------------------------------------------
| 602 | // Sorts particles! |
| 603 | // -------------------------------------------------------------------------------------- |
| 604 | void Tr2GpuParticleSystem::Sort( Tr2RenderContext& renderContext ) |
| 605 | { |
| 606 | if( !CheckEffect( m_setSortParameters ) || !CheckEffect( m_sort ) || !CheckEffect( m_sortStep ) || !CheckEffect( m_sortInner ) ) |
| 607 | { |
| 608 | return; |
| 609 | } |
| 610 | |
| 611 | m_sortTimer.Begin( renderContext ); |
| 612 | ON_BLOCK_EXIT( [&] { m_sortTimer.End( renderContext ); } ); |
| 613 | |
| 614 | Tr2Renderer::RunComputeShader( m_setSortParameters, 1, 1, 1, renderContext ); |
| 615 | if( m_sortParameters && m_sortParameters->IsValid() ) |
| 616 | { |
| 617 | Tr2Renderer::RunComputeShaderIndirect( m_sort, *m_sortParameters, 0, renderContext ); |
| 618 | |
| 619 | if( m_maxParticles > 512 ) |
| 620 | { |
| 621 | uint32_t presorted = 512; |
| 622 | bool done = false; |
| 623 | while( !done ) |
| 624 | { |
| 625 | done = SortIncremental( presorted, renderContext ); |
| 626 | presorted *= 2; |
| 627 | } |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | // -------------------------------------------------------------------------------------- |
| 633 | // Description: |
nothing calls this directly
no test coverage detected