Add Direct3D 12 setup script for distribution with binary releases #91475
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.
This script is meant to be packaged with binary releases so that Direct3D 12 support can be set up in an automated manner. To use the script, double-click it and follow the instructions. The EULA can be accepted automatically using the
-y
or/y
command line argument (e.g. for use on CI).This installs
dxil.dll
and the Agility SDK, both of which are copied on export if a project uses Direct3D 12 or requests it with theapplication/export_d3d12
option in its Windows export preset.PIX is not set up by this script, as it requires further conversion to work with MinGW (which official Godot binaries use). This tool is not available out of the box on Windows, so it'd need to also download a MinGW toolchain to run
dlltool
. Either way, PIX is only required for engine developers anyway, not regular users of an exported project.There is a TODO left in the script as I can't find a permalink to the Microsoft EULA used for
dxil.dll
. This EULA is included asLICENSE-MS.txt
in the DirectX Shader Compiler download, but since it's only part of the ZIP archive (and is not in the GitHub repository), there's no way we could display it to the user before they accept the EULA.You can find the EULA I reuploaded from the latest release here: LICENSE-MS.txt
FAQ
In-editor integration versus command line tool
I chose to make this a command line tool, so you have a chance to run it before starting Godot. In platforms where OpenGL/Vulkan support are not available, this allows setting up Direct3D 12 before you start Godot. The project manager/editor could be configured to take advantage of this with an automatic fallback to Direct3D 12 (similar to godotengine/godot-proposals#8006).
In comparison, an editor or project manager tool wouldn't be able to run before initializing a window, and therefore a graphics context. (That is, unless Godot had a software rendering backend for 2D/GUI-only apps.)
Comparison with the existing install script
There's already a
install_d3d12_sdk_windows.py
script that installs Direct3D 12 SDK components. However, this one is meant to be used by engine developers to compile and run Direct3D 12-enabled builds. It also requires Python to be installed to be run.In contrast, this PR adds a Batch script that has no dependencies. It's designed to be run by engine users who don't intend to compile the engine.
Preview
TODO