From 24eea4392c901e6cf29760b53cd08053b7b65aed Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Sat, 26 Sep 2026 16:32:21 +0200 Subject: [PATCH] GS/DX11: Fix null texture related crashes when device creation fails. Make sure null texture is initialized to null, otherwise if device creation fails early it causes issues when deleting the texture since it wasn't even created. Also properly null it out after deletion. --- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 1 + pcsx2/GS/Renderers/DX11/GSDevice11.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index cb2a471cd9..d71837db5b 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -618,6 +618,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle) void GSDevice11::Destroy() { delete m_null_texture; + m_null_texture = nullptr; GSDevice::Destroy(); DestroySwapChain(); diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.h b/pcsx2/GS/Renderers/DX11/GSDevice11.h index 33f47a9cca..8fc99a40ab 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.h +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.h @@ -140,7 +140,7 @@ private: wil::com_ptr_nothrow m_expand_vb_srv; wil::com_ptr_nothrow m_expand_ib_vs_srv; - GSTexture* m_null_texture; + GSTexture* m_null_texture = nullptr; D3D_FEATURE_LEVEL m_feature_level = D3D_FEATURE_LEVEL_10_0; u32 m_vb_pos = 0; // bytes