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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ bin
compile_commands.json
platform/windows/godot_res.res

# Downloaded by `misc/scripts/install_dxcompiler_windows.ps1`
platform/windows/dxc/

Comment on lines +38 to +40
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.

# Generated by Godot binary
.import/
/gdextension_interface.h
Expand Down
82 changes: 82 additions & 0 deletions misc/scripts/install_d3d12_sdk_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# DirectX Shader Compiler

$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?


if (Test-Path "$env:LOCALAPPDATA\dxc") {
Write-Output "Removing existing local DirectX Shader Compiler installation in $env:LOCALAPPDATA\dxc ..."
# Remove existing local DirectX Shader Compiler if present to allow for updates.
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\dxc"
}

Write-Output "Extracting DirectX Shader Compiler $dxc_filename ..."
Expand-Archive "$env:TEMP\$dxc_filename" -DestinationPath "$env:LOCALAPPDATA\dxc"

# Remove the original archive as it's not required anymore.
Remove-Item -Recurse -Force "$env:TEMP\$dxc_filename"

Write-Output "DirectX Shader Compiler $dxc_filename installed successfully.`n"

# Mesa NIR

$mesa_filename="godot-nir-23.1.0-1-devel.zip"
Write-Output "Downloading Mesa NIR $mesa_filename ..."
Invoke-WebRequest -Uri https://github.com/godotengine/godot-nir-static/releases/download/23.1.0-devel/$mesa_filename -OutFile "$env:TEMP\$mesa_filename"

if (Test-Path "$env:LOCALAPPDATA\mesa") {
Write-Output "Removing existing local Mesa NIR installation in $env:LOCALAPPDATA\mesa ..."
# Remove existing local Mesa NIR if present to allow for updates.
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\mesa"
}

Write-Output "Extracting Mesa NIR $mesa_filename ..."
Expand-Archive "$env:TEMP\$mesa_filename" -DestinationPath "$env:LOCALAPPDATA\mesa"

# Remove the original archive as it's not required anymore.
Remove-Item -Recurse -Force "$env:TEMP\$mesa_filename"

Write-Output "Mesa NIR $mesa_filename installed successfully.`n"

# WinPixEventRuntime

$pix_version="1.0.231030001"
Write-Output "Downloading WinPixEventRuntime $pix_version ..."
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/WinPixEventRuntime/$pix_version -OutFile "$env:TEMP\$pix_version"

if (Test-Path "$env:LOCALAPPDATA\pix") {
Write-Output "Removing existing local WinPixEventRuntime installation in $env:LOCALAPPDATA\pix ..."
# Remove existing local WinPixEventRuntime if present to allow for updates.
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\pix"
}

Write-Output "Extracting WinPixEventRuntime $pix_version ..."
Expand-Archive "$env:TEMP\$pix_version" -DestinationPath "$env:LOCALAPPDATA\pix"

# Remove the original archive as it's not required anymore.
Remove-Item -Recurse -Force "$env:TEMP\$pix_version"

Write-Output "WinPixEventRuntime $pix_version installed successfully.`n"

# DirectX 12 Agility SDK

$agility_sdk_version="1.611.2"
Write-Output "Downloading DirectX 12 Agility SDK $agility_sdk_version ..."
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/$agility_sdk_version -OutFile "$env:TEMP\$agility_sdk_version"

if (Test-Path "$env:LOCALAPPDATA\agility_sdk") {
Write-Output "Removing existing local DirectX 12 Agility SDK installation in $env:LOCALAPPDATA\agility_sdk ..."
# Remove existing local DirectX 12 Agility SDK if present to allow for updates.
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\agility_sdk"
}

Write-Output "Extracting DirectX 12 Agility SDK $agility_sdk_version ..."
Expand-Archive "$env:TEMP\$agility_sdk_version" -DestinationPath "$env:LOCALAPPDATA\agility_sdk"

# Remove the original archive as it's not required anymore.
Remove-Item -Recurse -Force "$env:TEMP\$agility_sdk_version"

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.

Write-Output 'You can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes" with MSVC installed (MinGW builds are currently not supported).'
8 changes: 4 additions & 4 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ def get_opts():
BoolVariable("incremental_link", "Use MSVC incremental linking. May increase or decrease build times.", False),
("angle_libs", "Path to the ANGLE static libraries", ""),
# Direct3D 12 support.
("mesa_libs", "Path to the MESA/NIR static libraries (required for D3D12)", ""),
("dxc_path", "Path to the DirectX Shader Compiler distribution (required for D3D12)", ""),
("agility_sdk_path", "Path to the Agility SDK distribution (optional for D3D12)", ""),
("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"),
Comment on lines +191 to +195
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.

]


Expand Down
Loading