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

Add a script to install Direct3D 12 SDK components #86123

Closed

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Dec 13, 2023

  • Define a default path that uses the locations from the script.

This makes it much faster to get started with Direct3D 12 builds, as you only need to run misc/scripts/install_d3d12_sdk_windows.ps1 then run scons d3d12=yes.

This installs DirectX Shader Compiler, Mesa NIR, WinPixEventRuntime and DirectX 12 Agility SDK.

See also godotengine/godot-docs#8610.

Preview

$ .\misc\scripts\install_d3d12_sdk_windows.ps1
Downloading DirectX Shader Compiler dxc_2023_08_14.zip ...
Extracting DirectX Shader Compiler dxc_2023_08_14.zip ...
DirectX Shader Compiler dxc_2023_08_14.zip installed successfully.

Downloading Mesa NIR godot-nir-23.1.0-1-devel.zip ...
Extracting Mesa NIR godot-nir-23.1.0-1-devel.zip ...
Mesa NIR godot-nir-23.1.0-1-devel.zip installed successfully.

Downloading WinPixEventRuntime 1.0.231030001 ...
Extracting WinPixEventRuntime 1.0.231030001 ...
WinPixEventRuntime 1.0.231030001 installed successfully.

Downloading DirectX 12 Agility SDK 1.611.2 ...
Extracting DirectX 12 Agility SDK 1.611.2 ...
DirectX 12 Agility SDK 1.611.2 installed successfully.

All Direct3D 12 SDK components were installed successfully!
You can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes" with MSVC installed (MinGW builds are currently not supported).

- Define a default path that uses the locations from the script.

This makes it much faster to get started with Direct3D 12 builds,
as you only need to run `misc/scripts/install_d3d12_sdk_windows.ps1`
then run `scons d3d12=yes`.

This installs DirectX Shader Compiler, Mesa NIR, WinPixEventRuntime
and DirectX 12 Agility SDK.
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems useful 👍

I'm a bit concerned about the impact of the Agility and PIX SDKs which are optional dependencies, but now would likely be installed by most users if we document this as the easiest way to set things up.

What's the impact from those optional deps on production builds?

Another concern is that we're installing silently to %LOCALAPPDATA%, so it might not be easy for users to clean up old dependencies in their user folder. At least printing the path at install would help, but maybe it should even be printed when building? Or there could be an uninstall script.

Comment on lines +191 to +195
("mesa_libs", "Path to the MESA/NIR static libraries (required for D3D12)", f"{os.getenv("LOCALAPPDATA")}/mesa"),
("dxc_path", "Path to the DirectX Shader Compiler distribution (required for D3D12)", f"{os.getenv("LOCALAPPDATA")}/dxc"),
("agility_sdk_path", "Path to the Agility SDK distribution (optional for D3D12)", f"{os.getenv("LOCALAPPDATA")}/agility_sdk"),
("agility_sdk_multiarch", "Whether the Agility SDK DLLs will be stored in arch-specific subdirectories", False),
("pix_path", "Path to the PIX runtime distribution (optional for D3D12)", ""),
("pix_path", "Path to the PIX runtime distribution (optional for D3D12)", f"{os.getenv("LOCALAPPDATA")}/pix"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would install those in something like %LOCALAPPDATA%\Godot\build_deps\. Which can can be factored out as a variable so you only need to getenv once.


Write-Output "DirectX 12 Agility SDK $agility_sdk_version installed successfully.`n"

Write-Output "All Direct3D 12 SDK components were installed successfully!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would output where the dependencies have been installed.


$dxc_filename="dxc_2023_08_14.zip"
Write-Output "Downloading DirectX Shader Compiler $dxc_filename ..."
Invoke-WebRequest -Uri https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.7.2308/$dxc_filename -OutFile "$env:TEMP\$dxc_filename"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract all version strings as variables at the top of the script, so it's easy to update?

Comment on lines +38 to +40
# Downloaded by `misc/scripts/install_dxcompiler_windows.ps1`
platform/windows/dxc/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be from an earlier attempt.

@mrbbbaixue
Copy link
Contributor

Is downloading these SDKs to %localappdata% a must?
I think most people will download it only for building godot, is it possible to store these sdks to the godot build folder?

@Calinou
Copy link
Member Author

Calinou commented Dec 15, 2023

Is downloading these SDKs to %localappdata% a must? I think most people will download it only for building godot, is it possible to store these sdks to the godot build folder?

It could be done, but my rationale for downloading them to %LOCALAPPDATA% is that if you remove the Godot repository folder and clone it again, you won't need to redownload the SDK components. This saves bandwidth and time for returning cloners 🙂

%LOCALAPPDATA% is a user-specific location, so you don't need any special permissions to write to it.

@mrbbbaixue
Copy link
Contributor

mrbbbaixue commented Dec 15, 2023

It could be done, but my rationale for downloading them to %LOCALAPPDATA% is that if you remove the Godot repository folder and clone it again, you won't need to redownload the SDK components. This saves bandwidth and time for returning cloners 🙂.

Oh that's what I missed. I agree that we can store these in %LOCALAPPDATA%, but should give a clear reminder (or providing an uninstall script).

@LinuxUserGD
Copy link
Contributor

godotengine/godot-docs#8610

Currently, we don't support building with Direct3D 12 enabled when using MinGW. Support will be added in the future if possible.

A similar Python script could still be useful for cross-compiling Godot with Direct3D on Linux using Wine/MSVC I think.

@bruvzg
Copy link
Member

bruvzg commented Dec 19, 2023

Currently, we don't support building with Direct3D 12 enabled when using MinGW. Support will be added in the future if possible.

A similar Python script could still be useful for cross-compiling Godot with Direct3D on Linux using Wine/MSVC I think.

MinGW support will be added, either via #86150 or #83452 (Mesa static libs repo is already updated). So adding support for the Wine/MSVC is excessive (is it possible with the current MSVC? Even if it is, it's probably complicated and unstable).

@YuriSizov
Copy link
Contributor

There is also a downside to using PS1 scripts. If they are not signed, you cannot run them without lowering security levels locally. Doing so is a huge PITA, so unless you have an environment ready for this, it will be very challenging to runs a PS1 script.

So moving to Python is probably worthwhile even now.

@Calinou
Copy link
Member Author

Calinou commented Jan 3, 2024

@Calinou Calinou closed this Jan 3, 2024
@Calinou Calinou removed this from the 4.3 milestone Jan 3, 2024
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.

6 participants