From 947325e00d462d58aa2c84bb09ca8fa8d600a368 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 2 May 2022 15:50:15 +1000 Subject: [PATCH] [host] dxgi: fix failure to copy to texture with sub resources `CopyResource` will silently fail when trying to copy from a texture with no subresources to one with. Instead we must use `ResolveSubresource` --- host/platform/Windows/capture/DXGI/src/d3d11.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/host/platform/Windows/capture/DXGI/src/d3d11.c b/host/platform/Windows/capture/DXGI/src/d3d11.c index b455c0ca..e87e7e88 100644 --- a/host/platform/Windows/capture/DXGI/src/d3d11.c +++ b/host/platform/Windows/capture/DXGI/src/d3d11.c @@ -199,8 +199,16 @@ static bool d3d11_copyFrame(Texture * tex, ID3D11Texture2D * src) tex->copyTime = microtime(); if (tex->texDamageCount < 0) - ID3D11DeviceContext_CopyResource(dxgi->deviceContext, - (ID3D11Resource *)dst, (ID3D11Resource *)src); + { + if (!teximpl->gpu) + ID3D11DeviceContext_CopyResource(dxgi->deviceContext, + (ID3D11Resource *)dst, (ID3D11Resource *)src); + else + ID3D11DeviceContext_ResolveSubresource(dxgi->deviceContext, + (ID3D11Resource *)dst, 0, + (ID3D11Resource *)src, 0, + dxgi->dxgiFormat); + } else { for (int i = 0; i < tex->texDamageCount; ++i)