Skip to content

Commit

Permalink
crashfix for GW2 28.07 patch
Browse files Browse the repository at this point in the history
game sets render target to depth stencil,
dx9 ignores this with errored out call

we just ignore it for now instead of crashing
  • Loading branch information
megai2 committed Jul 28, 2020
1 parent a9aeff8 commit 35bf7c0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions d912pxy/d912pxy_device_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ HRESULT d912pxy_device::GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurfac

HRESULT d912pxy_device::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil)
{
d912pxy_s.render.iframe.BindSurface(0, PXY_COM_LOOKUP(pNewZStencil, surface));
d912pxy_surface* newDS = PXY_COM_LOOKUP(pNewZStencil, surface);

//megai2: remove this filter when GW2 is fixed
if (newDS)
{
if (newDS->GetDX9DescAtLevel(0).Usage != D3DUSAGE_DEPTHSTENCIL)
newDS = nullptr;
}

d912pxy_s.render.iframe.BindSurface(0, newDS);

return D3D_OK;
}
Expand Down Expand Up @@ -146,7 +155,6 @@ HRESULT d912pxy_device::Clear(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D
DWORD cvtCf = ((D3D12_CLEAR_FLAG_DEPTH * ((Flags & D3DCLEAR_ZBUFFER) != 0)) | (D3D12_CLEAR_FLAG_STENCIL * ((Flags & D3DCLEAR_STENCIL) != 0)));

d912pxy_surface* surf = d912pxy_s.render.iframe.GetBindedSurface(0);

if (surf)
d912pxy_s.render.replay.DoDSClear(surf, Z, Stencil & 0xFF, (D3D12_CLEAR_FLAGS)cvtCf, d912pxy_s.render.iframe.GetViewport());
}
Expand Down

0 comments on commit 35bf7c0

Please sign in to comment.