| 752 | } |
| 753 | |
| 754 | ALResult Tr2PrimaryRenderContextAL::SetPresentParameters( uint32_t adapter, const Tr2PresentParametersAL& presentationParameters ) |
| 755 | { |
| 756 | if( !m_swapchain ) |
| 757 | { |
| 758 | return E_FAIL; |
| 759 | } |
| 760 | |
| 761 | CComPtr<IDXGIOutput> dxgiOutput; |
| 762 | CComPtr<IDXGIAdapter1> adapterPtr; |
| 763 | auto hr = TrinityALImpl::GetVideoAdapter( adapter, &adapterPtr, &dxgiOutput ); |
| 764 | if( FAILED( hr ) ) |
| 765 | { |
| 766 | return hr; |
| 767 | } |
| 768 | |
| 769 | if( m_statsQuery && m_statsStatus == STAT_BEGIN_ISSUED ) |
| 770 | { |
| 771 | m_commandList->EndQuery( m_statsQuery, D3D12_QUERY_TYPE_PIPELINE_STATISTICS, 0 ); |
| 772 | m_statsStatus = STAT_READY; |
| 773 | } |
| 774 | FlushBarriersDx12(); |
| 775 | if( SUCCEEDED( m_commandList->Close() ) ) |
| 776 | { |
| 777 | ID3D12CommandList* const commandLists[] = { m_commandList }; |
| 778 | m_commandQueue->ExecuteCommandLists( _countof( commandLists ), commandLists ); |
| 779 | } |
| 780 | |
| 781 | //if( !presentationParameters.windowed && dxgiOutput != m_output ) |
| 782 | //{ |
| 783 | // // If we are switching between two monitors in fullscreen mode it seems we first should |
| 784 | // // go windowed and then fullscreen on another monitor, otherwise DXGI behaves funny. |
| 785 | // CR( m_swapChain->SetFullscreenState( FALSE, nullptr ) ); |
| 786 | //} |
| 787 | |
| 788 | m_output = dxgiOutput; |
| 789 | |
| 790 | DXGI_FORMAT fmt = Tr2SwapChainUtils::SafeConvertD3DBackBufferFormat( presentationParameters.mode.format ); |
| 791 | |
| 792 | DXGI_MODE_DESC modeDesc; |
| 793 | modeDesc.Width = presentationParameters.mode.width; |
| 794 | modeDesc.Height = presentationParameters.mode.height; |
| 795 | modeDesc.RefreshRate.Numerator = 0; |
| 796 | modeDesc.RefreshRate.Denominator = 0; |
| 797 | modeDesc.Format = fmt; |
| 798 | modeDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER( presentationParameters.mode.scanlineOrdering ); |
| 799 | modeDesc.Scaling = DXGI_MODE_SCALING( presentationParameters.mode.scaling ); |
| 800 | |
| 801 | m_defaultBackBuffer.m_texture->Destroy(); |
| 802 | |
| 803 | WaitForFenceDx12( SignalDx12() ); |
| 804 | for( auto it = begin( m_pendingRelease ); it != end( m_pendingRelease ); ++it ) |
| 805 | { |
| 806 | it->clear(); |
| 807 | } |
| 808 | m_srvUavAllocator->SetFrameIndices( GetRecordingFrameNumber(), GetRenderedFrameNumber() ); |
| 809 | |
| 810 | auto value = m_frameFenceValues[m_currentBackBufferIndex]; |
| 811 | m_frameFenceValues.clear(); |
nothing calls this directly
no test coverage detected