Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3324,7 +3324,11 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default
//
// We'll need the depth buffer later...
//
if (DefaultDepthBuffer == nullptr)
// GO_CHANGE
// Guard against calling GetDepthStencilSurface on a lost/invalid device.
// The D3D9-to-D3D12 translation layer may access freed GPU memory if the
// device is in a lost state, causing an EXCEPTION_ACCESS_VIOLATION_READ crash.
if (DefaultDepthBuffer == nullptr && !IsDeviceLost)
{
// IDirect3DSurface8 *depth_buffer = nullptr;
DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer));
Expand Down Expand Up @@ -3452,7 +3456,11 @@ void DX8Wrapper::Set_Render_Target
//
// We'll need the depth buffer later...
//
if (DefaultDepthBuffer == nullptr)
// GO_CHANGE
// Guard against calling GetDepthStencilSurface on a lost/invalid device.
// The D3D9-to-D3D12 translation layer may access freed GPU memory if the
// device is in a lost state, causing an EXCEPTION_ACCESS_VIOLATION_READ crash.
if (DefaultDepthBuffer == nullptr && !IsDeviceLost)
{
// IDirect3DSurface8 *depth_buffer = nullptr;
DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer));
Expand Down
12 changes: 10 additions & 2 deletions GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3600,7 +3600,11 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default
//
// We'll need the depth buffer later...
//
if (DefaultDepthBuffer == nullptr)
// GO_CHANGE
// Guard against calling GetDepthStencilSurface on a lost/invalid device.
// The D3D9-to-D3D12 translation layer may access freed GPU memory if the
// device is in a lost state, causing an EXCEPTION_ACCESS_VIOLATION_READ crash.
if (DefaultDepthBuffer == nullptr && !IsDeviceLost)
{
// IDirect3DSurface8 *depth_buffer = nullptr;
DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer));
Expand Down Expand Up @@ -3728,7 +3732,11 @@ void DX8Wrapper::Set_Render_Target
//
// We'll need the depth buffer later...
//
if (DefaultDepthBuffer == nullptr)
// GO_CHANGE
// Guard against calling GetDepthStencilSurface on a lost/invalid device.
// The D3D9-to-D3D12 translation layer may access freed GPU memory if the
// device is in a lost state, causing an EXCEPTION_ACCESS_VIOLATION_READ crash.
if (DefaultDepthBuffer == nullptr && !IsDeviceLost)
{
// IDirect3DSurface8 *depth_buffer = nullptr;
DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer));
Expand Down
Loading