void CRenderCaptureDX::EndRender() { // send commands to the GPU queue auto deviceResources = DX::DeviceResources::Get(); deviceResources->FinishCommandList(); Microsoft::WRL::ComPtr<ID3D11DeviceContext> pContext = deviceResources->GetImmediateContext(); pContext->CopyResource(m_copyTex.Get(), m_renderTex.Get()); if (m_query) { pContext->End(m_query.Get()); } if (m_flags & CAPTUREFLAG_IMMEDIATELY) SurfaceToBuffer(); else SetState(CAPTURESTATE_NEEDSREADOUT); }
// Apply a 3D flip for hit-tested tile visual HRESULT Application::FlipVisual(int visualIndex) { HRESULT hr = S_OK; Microsoft::WRL::ComPtr<IDCompositionAnimation> dcompAngleAnimation; if (SUCCEEDED(hr)) { hr = _dcompDevice->CreateAnimation(&dcompAngleAnimation); } if (SUCCEEDED(hr)) { hr = dcompAngleAnimation->AddCubic(0.0, 0.0f, 180.0f, 0.0f, 0.0f); } if (SUCCEEDED(hr)) { hr = dcompAngleAnimation->End(1.0, 180.0f); } Microsoft::WRL::ComPtr<IDCompositionRotateTransform3D> dcompFlipTransform; if (SUCCEEDED(hr)) { hr = _dcompDevice->CreateRotateTransform3D(&dcompFlipTransform); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetCenterX(1.0f * _hWndClientWidth / 8.0f); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetCenterY(1.0f * _hWndClientHeight / 8.0f); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetCenterZ(0.0f); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetAxisX(0.0f); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetAxisY(1.0f); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetAxisZ(0.0f); } if (SUCCEEDED(hr)) { hr = dcompFlipTransform->SetAngle(dcompAngleAnimation.Get()); } if (SUCCEEDED(hr)) { hr = _dcompTileVisuals[visualIndex]->SetEffect(dcompFlipTransform.Get()); } if (SUCCEEDED(hr)) { hr = _dcompDevice->Commit(); } return hr; }