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

Method Process

Source/DX9VideoProcessor.cpp:2647–2771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2645}
2646
2647HRESULT CDX9VideoProcessor::Process(IDirect3DSurface9* pRenderTarget, const CRect& srcRect, const CRect& dstRect, const bool second)
2648{
2649 HRESULT hr = S_OK;
2650 m_bDitherUsed = false;
2651
2652 CRect rSrc = srcRect;
2653 IDirect3DTexture9* pInputTexture = nullptr;
2654
2655 const UINT numSteps = GetPostScaleSteps();
2656
2657 if (m_DXVA2VP.IsReady()) {
2658 const bool bNeedShaderTransform =
2659 (m_TexConvertOutput.Width != dstRect.Width() || m_TexConvertOutput.Height != dstRect.Height() || m_iRotation || m_bFlip
2660 || dstRect.left < 0 || dstRect.top < 0 || dstRect.right > m_windowRect.right || dstRect.bottom > m_windowRect.bottom);
2661
2662 if (!bNeedShaderTransform && !numSteps) {
2663 m_bVPScalingUseShaders = false;
2664 hr = DxvaVPPass(pRenderTarget, rSrc, dstRect, second);
2665
2666 return hr;
2667 }
2668
2669 CRect rect(0, 0, m_TexConvertOutput.Width, m_TexConvertOutput.Height);
2670 hr = DxvaVPPass(m_TexConvertOutput.pSurface, rSrc, rect, second);
2671 pInputTexture = m_TexConvertOutput.pTexture;
2672 rSrc = rect;
2673 }
2674 else if (m_PSConvColorData.bEnable) {
2675 ConvertColorPass(m_TexConvertOutput.pSurface);
2676 pInputTexture = m_TexConvertOutput.pTexture;
2677 rSrc.SetRect(0, 0, m_TexConvertOutput.Width, m_TexConvertOutput.Height);
2678 }
2679 else {
2680 pInputTexture = m_TexSrcVideo.pTexture;
2681 }
2682
2683 if (numSteps) {
2684 UINT step = 0;
2685 Tex_t* pTex = m_TexsPostScale.GetFirstTex();
2686 IDirect3DSurface9* pRT = pTex->pSurface;
2687
2688 auto StepSetting = [&]() {
2689 step++;
2690 pInputTexture = pTex->pTexture;
2691 if (step < numSteps) {
2692 pTex = m_TexsPostScale.GetNextTex();
2693 pRT = pTex->pSurface;
2694 }
2695 else {
2696 pRT = pRenderTarget;
2697 }
2698 };
2699
2700 CRect rect;
2701 rect.IntersectRect(dstRect, CRect(0, 0, pTex->Width, pTex->Height));
2702
2703 if (m_DXVA2VP.IsReady()) {
2704 m_bVPScalingUseShaders = rSrc.Width() != dstRect.Width() || rSrc.Height() != dstRect.Height();

Callers 1

DxvaVPPassMethod · 0.45

Calls 4

HR2StrFunction · 0.85
IsReadyMethod · 0.45
GetFirstTexMethod · 0.45
GetNextTexMethod · 0.45

Tested by

no test coverage detected