Skip to content
Merged
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
28 changes: 28 additions & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,37 @@ bool DX8Wrapper::Reset_Device(bool reload_assets)
memset(Vertex_Shader_Constants, 0, sizeof(Vector4) * MAX_VERTEX_SHADER_CONSTANTS);
memset(Pixel_Shader_Constants, 0, sizeof(Vector4) * MAX_PIXEL_SHADER_CONSTANTS);

// TheSuperHackers @bugfix Tin Tin Hamans - Release all surface references before Reset().
// D3D8 requires that no non-managed surfaces (render targets, depth buffers) have outstanding
// references when Reset() is called. Failing to do so causes a crash inside the Intel integrated
// graphics driver (igd9trinity32.dll) during DestroyResource inside CSwapChain::Reset.
if (DefaultRenderTarget != nullptr)
{
DefaultRenderTarget->Release();
DefaultRenderTarget = nullptr;
}
if (DefaultDepthBuffer != nullptr)
{
DefaultDepthBuffer->Release();
DefaultDepthBuffer = nullptr;
}
if (CurrentRenderTarget != nullptr)
{
CurrentRenderTarget->Release();
CurrentRenderTarget = nullptr;
}
if (CurrentDepthBuffer != nullptr)
{
CurrentDepthBuffer->Release();
CurrentDepthBuffer = nullptr;
}

HRESULT hr = _Get_D3D_Device8()->TestCooperativeLevel();
if (hr != D3DERR_DEVICELOST)
{
// TheSuperHackers @bugfix xezon 13/06/2025 Front load the system dbghelp.dll to prevent
// the graphics driver from potentially loading the old game dbghelp.dll and then crashing the game process.
DbgHelpGuard dbgHelpGuard;
DX8CALL_HRES(Reset(&_PresentParameters), hr)
if (hr != D3D_OK)
return false; //reset failed.
Expand Down
Loading