소스 검색

Update dependencies in D3D12 SDK installer script

- Add colored console output.
Hugo Locurcio 1 년 전
부모
커밋
47ac22486d
3개의 변경된 파일35개의 추가작업 그리고 13개의 파일을 삭제
  1. 5 1
      core/config/project_settings.cpp
  2. 2 2
      doc/classes/ProjectSettings.xml
  3. 28 10
      misc/scripts/install_d3d12_sdk_windows.py

+ 5 - 1
core/config/project_settings.cpp

@@ -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);

+ 2 - 2
doc/classes/ProjectSettings.xml

@@ -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.

+ 28 - 10
misc/scripts/install_d3d12_sdk_windows.py

@@ -4,6 +4,18 @@ import os
 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`
@@ -14,21 +26,27 @@ else:
     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")
 
@@ -37,7 +55,7 @@ if not os.path.exists(deps_folder):
     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} ...")
@@ -54,7 +72,7 @@ os.remove(dxc_archive)
 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} ...")
@@ -81,7 +99,7 @@ if dlltool == "":
     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} ...")
@@ -112,7 +130,7 @@ else:
 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} ...")
@@ -128,5 +146,5 @@ os.remove(agility_sdk_archive)
 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')