| 27 | } |
| 28 | |
| 29 | bool Tr2SwapChain::OnPrepareResources() |
| 30 | { |
| 31 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 32 | if( SUCCEEDED( m_swapChain.Create( m_windowHandle, renderContext ) ) ) |
| 33 | { |
| 34 | if( !m_depthStencil ) |
| 35 | { |
| 36 | m_depthStencil.Attach( new OTr2DepthStencil ); |
| 37 | } |
| 38 | CR_RETURN_VAL( HRESULT( m_depthStencil->Create( m_swapChain.GetWidth(), m_swapChain.GetHeight(), Tr2RenderContextEnum::DSFMT_D24S8, 0, 0 ) ), false ); |
| 39 | if( !m_backBuffer ) |
| 40 | { |
| 41 | m_backBuffer.CreateInstance(); |
| 42 | m_backBuffer->SetName( "swapchain backbuffer" ); |
| 43 | } |
| 44 | m_backBuffer->Attach( m_swapChain.GetBackBuffer(), this ); |
| 45 | return true; |
| 46 | } |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | bool Tr2SwapChain::Present( Tr2RenderContext& renderContext ) |
| 51 | { |
nothing calls this directly
no test coverage detected