Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backends: DX12: improve Windows 7 compatibility #3696

Closed
wants to merge 1 commit into from

Conversation

Mattiwatti
Copy link
Contributor

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:

  • Attempt to load 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 a d3d12.dll already loaded, it is given priority. This covers the case where a different path was used to load the DLL.
  • Do not statically import D3D12SerializeRootSignature: this change is required in order for ImGui not to fail to be loaded on Windows 7 when d3d12.dll is in a local subdirectory. I based the code for this change on the existing GetProcAddress-using code in imgui_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 binary d3d12.dll. However if desired I can add this to the PR as well.

More information on D3D12On7:

- Attempt to load d3d12.dll from local D3D12On7 paths before falling back to System32
- Do not statically import D3D12SerializeRootSignature
ocornut pushed a commit that referenced this pull request Jan 11, 2021
- Attempt to load d3d12.dll from local D3D12On7 paths before falling back to System32
- Do not statically import D3D12SerializeRootSignature
@ocornut
Copy link
Owner

ocornut commented Jan 11, 2021

Thank you Matthijs.
I have now merged this with minor changes (changelog, compacted some of the changes) + added a link to this issue for future reference.

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 binary d3d12.dll. However if desired I can add this to the PR as well.

I agree with your logic and feels its not the role of our dear imgui examples to provide that infrastructure.
If it was a matter of patching only a few lines I'd happy to merge, otherwise we can consider just adding a comment in the sample to refer to e.g. this issue.

@ocornut ocornut closed this Jan 11, 2021
@Mattiwatti Mattiwatti deleted the d3d12on7 branch January 12, 2021 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants