Skip to content

Commit

Permalink
Update dependencies in D3D12 SDK installer script
Browse files Browse the repository at this point in the history
- Add colored console output.
  • Loading branch information
Calinou committed May 7, 2024
1 parent 7cdad33 commit 47ac224
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
6 changes: 5 additions & 1 deletion core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,11 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF_RST("rendering/rendering_device/d3d12/max_misc_descriptors_per_frame", 512);
custom_prop_info["rendering/rendering_device/d3d12/max_misc_descriptors_per_frame"] = PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/max_misc_descriptors_per_frame", PROPERTY_HINT_RANGE, "32,4096");

GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/agility_sdk_version"), 610);
// The default value must match the minor part of the Agility SDK version
// installed by the scripts provided in the repository
// (check `misc/scripts/install_d3d12_sdk_windows.py`).
// For example, if the script installs 1.613.3, the default value must be 613.
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/agility_sdk_version"), 613);

GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2713,8 +2713,8 @@
<member name="rendering/renderer/rendering_method.web" type="String" setter="" getter="" default="&quot;gl_compatibility&quot;">
Override for [member rendering/renderer/rendering_method] on web.
</member>
<member name="rendering/rendering_device/d3d12/agility_sdk_version" type="int" setter="" getter="" default="610">
Version code of the Direct3D 12 Agility SDK to use ([code]D3D12SDKVersion[/code]).
<member name="rendering/rendering_device/d3d12/agility_sdk_version" type="int" setter="" getter="" default="613">
Version code of the [url=https://devblogs.microsoft.com/directx/directx12agility/]Direct3D 12 Agility SDK[/url] to use ([code]D3D12SDKVersion[/code]). This must match the [i]minor[/i] version that is installed next to the editor binary and in the export templates directory for the current editor version. For example, if you have [code]1.613.3[/code] installed, you need to input [code]613[/code] here.
</member>
<member name="rendering/rendering_device/d3d12/max_misc_descriptors_per_frame" type="int" setter="" getter="" default="512">
The number of entries in the miscellaneous descriptors heap the Direct3D 12 rendering driver uses each frame, used for various operations like clearing a texture.
Expand Down
38 changes: 28 additions & 10 deletions misc/scripts/install_d3d12_sdk_windows.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
import urllib.request
import shutil
import subprocess
import sys

# Enable ANSI escape code support on Windows 10 and later (for colored console output).
# <https://github.com/python/cpython/issues/73245>
if sys.platform == "win32":
from ctypes import windll, c_int, byref

stdout_handle = windll.kernel32.GetStdHandle(c_int(-11))
mode = c_int(0)
windll.kernel32.GetConsoleMode(c_int(stdout_handle), byref(mode))
mode = c_int(mode.value | 4)
windll.kernel32.SetConsoleMode(c_int(stdout_handle), mode)

# Base Godot dependencies path
# If cross-compiling (no LOCALAPPDATA), we install in `bin`
Expand All @@ -14,21 +26,27 @@
deps_folder = os.path.join("bin", "build_deps")

# DirectX Shader Compiler
dxc_version = "v1.7.2308"
dxc_filename = "dxc_2023_08_14.zip"
# Check for latest version: https://github.com/microsoft/DirectXShaderCompiler/releases/latest
dxc_version = "v1.8.2403.2"
dxc_filename = "dxc_2024_03_29.zip"
dxc_archive = os.path.join(deps_folder, dxc_filename)
dxc_folder = os.path.join(deps_folder, "dxc")
# Mesa NIR
# Check for latest version: https://github.com/godotengine/godot-nir-static/releases/latest
mesa_version = "23.1.9"
mesa_filename = "godot-nir-23.1.9.zip"
mesa_archive = os.path.join(deps_folder, mesa_filename)
mesa_folder = os.path.join(deps_folder, "mesa")
# WinPixEventRuntime
pix_version = "1.0.231030001"
# Check for latest version: https://www.nuget.org/api/v2/package/WinPixEventRuntime (check downloaded filename)
pix_version = "1.0.240308001"
pix_archive = os.path.join(deps_folder, f"WinPixEventRuntime_{pix_version}.nupkg")
pix_folder = os.path.join(deps_folder, "pix")
# DirectX 12 Agility SDK
agility_sdk_version = "1.610.4"
# Check for latest version: https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12 (check downloaded filename)
# After updating this, remember to change the default value of the `rendering/rendering_device/d3d12/agility_sdk_version`
# project setting to match the minor version (e.g. for `1.613.3`, it should be `613`).
agility_sdk_version = "1.613.3"
agility_sdk_archive = os.path.join(deps_folder, f"Agility_SDK_{agility_sdk_version}.nupkg")
agility_sdk_folder = os.path.join(deps_folder, "agility_sdk")

Expand All @@ -37,7 +55,7 @@
os.makedirs(deps_folder)

# DirectX Shader Compiler
print("[1/4] DirectX Shader Compiler")
print("\x1b[1m[1/4] DirectX Shader Compiler\x1b[0m")
if os.path.isfile(dxc_archive):
os.remove(dxc_archive)
print(f"Downloading DirectX Shader Compiler {dxc_filename} ...")
Expand All @@ -54,7 +72,7 @@
print(f"DirectX Shader Compiler {dxc_filename} installed successfully.\n")

# Mesa NIR
print("[2/4] Mesa NIR")
print("\x1b[1m[2/4] Mesa NIR\x1b[0m")
if os.path.isfile(mesa_archive):
os.remove(mesa_archive)
print(f"Downloading Mesa NIR {mesa_filename} ...")
Expand All @@ -81,7 +99,7 @@
dlltool = shutil.which("x86_64-w64-mingw32-dlltool") or ""
has_mingw = gendef != "" and dlltool != ""

print("[3/4] WinPixEventRuntime")
print("\x1b[1m[3/4] WinPixEventRuntime\x1b[0m")
if os.path.isfile(pix_archive):
os.remove(pix_archive)
print(f"Downloading WinPixEventRuntime {pix_version} ...")
Expand Down Expand Up @@ -112,7 +130,7 @@
print(f"WinPixEventRuntime {pix_version} installed successfully.\n")

# DirectX 12 Agility SDK
print("[4/4] DirectX 12 Agility SDK")
print("\x1b[1m[4/4] DirectX 12 Agility SDK\x1b[0m")
if os.path.isfile(agility_sdk_archive):
os.remove(agility_sdk_archive)
print(f"Downloading DirectX 12 Agility SDK {agility_sdk_version} ...")
Expand All @@ -128,5 +146,5 @@
print(f"DirectX 12 Agility SDK {agility_sdk_version} installed successfully.\n")

# Complete message
print(f'All Direct3D 12 SDK components were installed to "{deps_folder}" successfully!')
print('You can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".')
print(f'\x1b[92mAll Direct3D 12 SDK components were installed to "{deps_folder}" successfully!\x1b[0m')
print('\x1b[92mYou can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".\x1b[0m')

0 comments on commit 47ac224

Please sign in to comment.