| 379 | // CDX11VideoProcessor |
| 380 | |
| 381 | CDX11VideoProcessor::CDX11VideoProcessor(CMpcVideoRenderer* pFilter, const Settings_t& config, HRESULT& hr) |
| 382 | : CVideoProcessor(pFilter) |
| 383 | { |
| 384 | m_bShowStats = config.bShowStats; |
| 385 | m_iResizeStats = config.iResizeStats; |
| 386 | m_iTexFormat = config.iTexFormat; |
| 387 | m_VPFormats = config.VPFmts; |
| 388 | m_iVPDeinterlacing = config.iVPDeinterlacing; |
| 389 | m_bDeintDouble = config.bDeintDouble; |
| 390 | m_bVPScaling = config.bVPScaling; |
| 391 | m_iVPSuperRes = config.iVPSuperRes; |
| 392 | m_bVPRTXVideoHDR = config.bVPRTXVideoHDR; |
| 393 | m_iChromaScaling = config.iChromaScaling; |
| 394 | m_iUpscaling = config.iUpscaling; |
| 395 | m_iDownscaling = config.iDownscaling; |
| 396 | m_bInterpolateAt50pct = config.bInterpolateAt50pct; |
| 397 | m_bUseDither = config.bUseDither; |
| 398 | m_bDeintBlend = config.bDeintBlend; |
| 399 | m_iSwapEffect = config.iSwapEffect; |
| 400 | m_bVBlankBeforePresent = config.bVBlankBeforePresent; |
| 401 | m_bAdjustPresentTime = config.bAdjustPresentTime; |
| 402 | m_bHdrPreferDoVi = config.bHdrPreferDoVi; |
| 403 | m_bHdrPassthrough = config.bHdrPassthrough; |
| 404 | m_bHdrLocalToneMapping = config.bHdrLocalToneMapping; |
| 405 | m_iHdrLocalToneMappingType = config.iHdrLocalToneMappingType; |
| 406 | m_iHdrDisplayMaxNits = config.iHdrDisplayMaxNits; |
| 407 | m_iHdrToggleDisplay = config.iHdrToggleDisplay; |
| 408 | m_iHdrOsdBrightness = config.iHdrOsdBrightness; |
| 409 | m_bConvertToSdr = config.bConvertToSdr; |
| 410 | m_iSDRDisplayNits = config.iSDRDisplayNits; |
| 411 | |
| 412 | m_nCurrentAdapter = -1; |
| 413 | |
| 414 | hr = CreateDXGIFactory1(IID_IDXGIFactory1, (void**)&m_pDXGIFactory1); |
| 415 | if (FAILED(hr)) { |
| 416 | DLog(L"CDX11VideoProcessor::CDX11VideoProcessor() : CreateDXGIFactory1() failed with error {}", HR2Str(hr)); |
| 417 | return; |
| 418 | } |
| 419 | |
| 420 | // set default ProcAmp ranges and values |
| 421 | SetDefaultDXVA2ProcAmpRanges(m_DXVA2ProcAmpRanges); |
| 422 | SetDefaultDXVA2ProcAmpValues(m_DXVA2ProcAmpValues); |
| 423 | |
| 424 | pOrigSetWindowPosDX11 = SetWindowPos; |
| 425 | auto ret = HookFunc(&pOrigSetWindowPosDX11, pNewSetWindowPosDX11); |
| 426 | DLogIf(!ret, L"CDX11VideoProcessor::CDX11VideoProcessor() : hook for SetWindowPos() fail"); |
| 427 | |
| 428 | pOrigSetWindowLongADX11 = SetWindowLongA; |
| 429 | ret = HookFunc(&pOrigSetWindowLongADX11, pNewSetWindowLongADX11); |
| 430 | DLogIf(!ret, L"CDX11VideoProcessor::CDX11VideoProcessor() : hook for SetWindowLongA() fail"); |
| 431 | |
| 432 | MH_EnableHook(MH_ALL_HOOKS); |
| 433 | |
| 434 | CComPtr<IDXGIAdapter> pDXGIAdapter; |
| 435 | for (UINT adapter = 0; m_pDXGIFactory1->EnumAdapters(adapter, &pDXGIAdapter) != DXGI_ERROR_NOT_FOUND; ++adapter) { |
| 436 | CComPtr<IDXGIOutput> pDXGIOutput; |
| 437 | for (UINT output = 0; pDXGIAdapter->EnumOutputs(output, &pDXGIOutput) != DXGI_ERROR_NOT_FOUND; ++output) { |
| 438 | DXGI_OUTPUT_DESC desc{}; |
nothing calls this directly
no test coverage detected