From 97d162d5bed9bdce81449e4cd384f050b0e1cdd6 Mon Sep 17 00:00:00 2001 From: Steve Lhomme <robux4@ycbcr.xyz> Date: Sat, 8 Jun 2024 09:44:54 +0200 Subject: [PATCH 04/17] d3d11_scaler: fix AMD super scaler if the source has padding It asserts in debug build and will keep the padding in release mode. --- modules/video_output/win32/d3d11_scaler.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/video_output/win32/d3d11_scaler.cpp b/modules/video_output/win32/d3d11_scaler.cpp index da6c2edf0f..c30d8517fa 100644 --- a/modules/video_output/win32/d3d11_scaler.cpp +++ b/modules/video_output/win32/d3d11_scaler.cpp @@ -657,11 +657,16 @@ int D3D11_UpscalerScale(vlc_object_t *vd, d3d11_scaler *scaleProc, picture_sys_t D3D11_TEXTURE2D_DESC stagingDesc, inputDesc; amfStaging->GetDesc(&stagingDesc); p_sys->texture[KNOWN_DXGI_INDEX]->GetDesc(&inputDesc); - assert(stagingDesc.Width == inputDesc.Width); - assert(stagingDesc.Height == inputDesc.Height); + assert(stagingDesc.Width <= inputDesc.Width); + assert(stagingDesc.Height <= inputDesc.Height); assert(stagingDesc.Format == inputDesc.Format); #endif + D3D11_BOX box = {}; + box.bottom = stagingDesc.Height, + box.right = stagingDesc.Width, + box.back = 1, + // copy source into staging as it may not be shared d3d11_device_lock( scaleProc->d3d_dev ); scaleProc->d3d_dev->d3dcontext->CopySubresourceRegion(amfStaging, @@ -669,7 +674,7 @@ int D3D11_UpscalerScale(vlc_object_t *vd, d3d11_scaler *scaleProc, picture_sys_t 0, 0, 0, p_sys->texture[KNOWN_DXGI_INDEX], p_sys->slice_index, - NULL); + &box); d3d11_device_unlock( scaleProc->d3d_dev ); submitSurface = scaleProc->amfInput; -- 2.41.1