MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / Init

Method Init

Source/DX11VideoProcessor.cpp:547–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545}
546
547HRESULT CDX11VideoProcessor::Init(const HWND hwnd, const bool displayHdrChanged, bool* pChangeDevice/* = nullptr*/)
548{
549 DLog(L"CDX11VideoProcessor::Init()");
550
551 const bool bWindowChanged = displayHdrChanged || (m_hWnd != hwnd);
552 g_hWnd = m_hWnd = hwnd;
553
554 FillDisplayParams();
555
556 if (m_bExclusiveScreen != m_pFilter->m_bExclusiveScreen) {
557 m_srcVideoTransferFunction = 0;
558 }
559
560 IDXGIAdapter* pDXGIAdapter = nullptr;
561 const UINT currentAdapter = GetAdapter(hwnd, m_pDXGIFactory1, &pDXGIAdapter);
562 CheckPointer(pDXGIAdapter, E_FAIL);
563 if (m_nCurrentAdapter == currentAdapter) {
564 SAFE_RELEASE(pDXGIAdapter);
565
566 SetCallbackDevice();
567
568 if (!m_pDXGISwapChain1 || m_bExclusiveScreen != m_pFilter->m_bExclusiveScreen || bWindowChanged) {
569 InitSwapChain(bWindowChanged);
570 UpdateStatsStatic();
571 m_pFilter->OnDisplayModeChange();
572 }
573
574 return S_OK;
575 }
576 m_nCurrentAdapter = currentAdapter;
577
578 ReleaseSwapChain();
579 m_pDXGIFactory2.Release();
580 ReleaseDevice();
581
582 D3D_FEATURE_LEVEL featureLevels[] = {
583 D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0,
584 D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0,
585 };
586 D3D_FEATURE_LEVEL featurelevel;
587
588 ID3D11Device *pDevice = nullptr;
589
590 HRESULT hr = D3D11CreateDevice(
591 pDXGIAdapter,
592 D3D_DRIVER_TYPE_UNKNOWN,
593 nullptr,
594#ifdef _DEBUG
595 D3D11_CREATE_DEVICE_DEBUG,
596#else
597 0,
598#endif
599 featureLevels,
600 std::size(featureLevels),
601 D3D11_SDK_VERSION,
602 &pDevice,
603 &featurelevel,
604 nullptr);

Callers 2

ResetMethod · 0.45
ConfigureMethod · 0.45

Calls 6

DLogFunction · 0.85
HR2StrFunction · 0.85
HaveSSE41Function · 0.85
OnDisplayModeChangeMethod · 0.80
GetAdapterFunction · 0.70
ReleaseMethod · 0.45

Tested by

no test coverage detected