[d3d9] Validate RT parent device during SetRenderTarget

This commit is contained in:
WinterSnowfall 2024-11-20 17:13:18 +02:00
parent 90382259c1
commit 87bbcad25b
No known key found for this signature in database

View file

@ -1592,7 +1592,12 @@ namespace dxvk {
IDirect3DSurface9* pRenderTarget) {
D3D9DeviceLock lock = LockDevice();
if (unlikely((pRenderTarget == nullptr && RenderTargetIndex == 0)))
if (unlikely(pRenderTarget == nullptr && RenderTargetIndex == 0))
return D3DERR_INVALIDCALL;
// We need to make sure the render target was created using this device.
D3D9Surface* rt = static_cast<D3D9Surface*>(pRenderTarget);
if (unlikely(rt != nullptr && rt->GetDevice() != this))
return D3DERR_INVALIDCALL;
return SetRenderTargetInternal(RenderTargetIndex, pRenderTarget);