Backends: DX12: improve Windows 7 compatibility #3696
Closed
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.
Recently I've worked on two separate projects that both use ImGui and needed Windows 7 support for a D3D12 game overlay. This PR is an attempt to get the most important changes required for this to work merged upstream.
Background: D3D12 support for Windows 7 is called D3D12On7 and requires loading a separate DLL located in the application directory or a subdirectory of it. Both changes in this PR are related to accommodating local (non-System32) versions of
d3d12.dll
:d3d12.dll
from local D3D12On7 paths before falling back to System32: this change is the most important one. I based the code for this on the Microsoft recommended way to load d3d12.dll, with the added change that there are three local paths tried instead of one. The local paths tried are those I've seen used in the wild by various games. Finally, if there is ad3d12.dll
already loaded, it is given priority. This covers the case where a different path was used to load the DLL.D3D12SerializeRootSignature
: this change is required in order for ImGui not to fail to be loaded on Windows 7 whend3d12.dll
is in a local subdirectory. I based the code for this change on the existingGetProcAddress
-using code inimgui_impl_win32.cpp
.The current PR should suffice for anyone integrating ImGui in an application that already has working D3D12On7 support. That means that not included in this PR are changes required to make the DX12 sample work on Windows 7. The reason for this is that I felt the amount of added code required for this would make the sample harder to follow due to having two separate
Present()
paths, while not adding much value except for a small subset of users. Another reason is the dependency on the redistributable binaryd3d12.dll
. However if desired I can add this to the PR as well.More information on D3D12On7:
d3d12.dll
for Windows 7)