From 145cbfdffd644a572fc46be6d5f9b219b533e667 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Tue, 17 Nov 2020 17:15:16 +0000 Subject: [PATCH] Fix crash on some games using DX11. The line: "ctx->PSGetSamplers(0, 1, &old.PSSampler);" will fail silently (no return code) but will not modify old.PSSampler making the game crash when accessing uninitialized memory. --- ImGui/impls/windows/imgui_impl_dx11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ImGui/impls/windows/imgui_impl_dx11.cpp b/ImGui/impls/windows/imgui_impl_dx11.cpp index 350f2ed..f9e586d 100644 --- a/ImGui/impls/windows/imgui_impl_dx11.cpp +++ b/ImGui/impls/windows/imgui_impl_dx11.cpp @@ -194,7 +194,7 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data) DXGI_FORMAT IndexBufferFormat; ID3D11InputLayout* InputLayout; }; - BACKUP_DX11_STATE old; + BACKUP_DX11_STATE old = {}; old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects); ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);