DX11 Windows crash when some features are unsupported. #4045

Closed
opened 2021-04-15 08:20:53 +00:00 by Nemirtingas · 2 comments
Nemirtingas commented 2021-04-15 08:20:53 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

Version: Any
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx11.cpp + imgui_impl_win32.cpp
Compiler: MSVC (VS Community 2019), C++14
Operating System: Windows 10

My Issue/Question:
When using my game overlay, some DX11 games crash when using the DX11 renderer at
ocornut/imgui@d6a5cc7934/backends/imgui_impl_dx11.cpp (L267)
because
ocornut/imgui@d6a5cc7934/backends/imgui_impl_dx11.cpp (L209)
failed silently (this function has no return code) and the content of old.PSSampler will then be uninitialized (some random stuff in it).

My quick fix is just to initialize old like so:

BACKUP_DX11_STATE old = {};

All pointers will be nulled and not used because there are already if(old.thing != NULL) checks in the code.

Its an old issue I fixed on my project, I'll see if I can remember on what game it crashed.

**Version/Branch of Dear ImGui:** Version: Any Branch: master **Back-end/Renderer/Compiler/OS** Back-ends: imgui_impl_dx11.cpp + imgui_impl_win32.cpp Compiler: MSVC (VS Community 2019), C++14 Operating System: Windows 10 **My Issue/Question:** When using my game overlay, some DX11 games crash when using the DX11 renderer at https://github.com/ocornut/imgui/blob/d6a5cc7934b4f4f9d5effffc4f1acee151247f51/backends/imgui_impl_dx11.cpp#L267 because https://github.com/ocornut/imgui/blob/d6a5cc7934b4f4f9d5effffc4f1acee151247f51/backends/imgui_impl_dx11.cpp#L209 failed silently (this function has no return code) and the content of `old.PSSampler` will then be uninitialized (some random stuff in it). My quick fix is just to initialize old like so: ``` BACKUP_DX11_STATE old = {}; ``` All pointers will be nulled and not used because there are already `if(old.thing != NULL)` checks in the code. Its an old issue I fixed on my project, I'll see if I can remember on what game it crashed.
ocornut commented 2021-04-15 11:30:22 +00:00 (Migrated from github.com)

That makes sense. Merged the fix: 858ea17eba
Thanks a lot!

That makes sense. Merged the fix: 858ea17eba47e17c7a2e4acb5a5678320d7b1290 Thanks a lot!
Nemirtingas commented 2021-04-15 12:33:56 +00:00 (Migrated from github.com)

Thanks

Thanks
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#4045
No description provided.