fix(dx8): Prevent device reset crash on Intel GPUs - #591
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a fatal
EXCEPTION_ACCESS_VIOLATION_READcrash occurring in the Intel integrated graphics driver (igd9trinity32.dll) during a D3D8 device reset operation.Root Cause:
The
DX8Wrapper::Reset_Device()function indx8wrapper.cppwas callingIDirect3DDevice8::Reset()without first releasing all outstanding COM references to non-managed D3D8 surfaces, specificallyDefaultRenderTarget,DefaultDepthBuffer,CurrentRenderTarget, andCurrentDepthBuffer. While most drivers would returnD3DERR_INVALIDCALLin this scenario, the Intel 32-bit legacy D3D8 compatibility driver crashes during its internal resource destruction (CSwapChain::Reset->DestroyResource). Additionally, theReset()call was not protected by aDbgHelpGuard, which is present inCreate_Device()to mitigate driver-specific issues.Solution:
DefaultRenderTarget,DefaultDepthBuffer,CurrentRenderTarget, andCurrentDepthBufferbefore callingIDirect3DDevice8::Reset(). This ensures all non-managed surface references are zeroed out as required by D3D8.Reset(), re-acquire the new default render target and depth stencil surfaces.IDirect3DDevice8::Reset()call with aDbgHelpGuardto prevent potential conflicts withdbghelp.dllthat can lead to driver crashes.Fixes CLIENT-196