Add GN arg dawn_use_built_dxc
Now, DXC is always checked out, and dawn_use_built_Dxc controls whether
or not DXC is compiled and used in the D3D12 backend.
Adding a GN arg allows us to configure using DXC only in Dawn builders
and not all of Chromium bots, until the DXC path is well tested and
stable.
Bug: chromium:1462339
Change-Id: Iaeb58df3e84e086c8a2ab73025d7505a90869c5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/140323
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/DEPS b/DEPS
index 807913c..eaae9c1 100644
--- a/DEPS
+++ b/DEPS
@@ -21,7 +21,6 @@
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
'dawn_ninja_version': 'version:2@1.11.1.chromium.6',
'dawn_go_version': 'version:2@1.18.4',
- 'dawn_build_dxc': True,
'node_darwin_arm64_sha': '31859fc1fa0994a95f44f09c367d6ff63607cfde',
'node_darwin_x64_sha': '16dfd094763b71988933a31735f9dea966f9abd6',
@@ -163,12 +162,11 @@
'third_party/dxc': {
'url': '{chromium_git}/external/github.com/microsoft/DirectXShaderCompiler@5e080a772910f147cc447fc34e8eb489f0761144',
- 'condition': 'dawn_build_dxc',
},
'third_party/dxheaders': {
# The non-Windows build of DXC depends on DirectX-Headers, and at a specific commit (not ToT)
'url': '{chromium_git}/external/github.com/microsoft/DirectX-Headers@980971e835876dc0cde415e8f9bc646e64667bf7',
- 'condition': 'dawn_build_dxc and host_os != "win"',
+ 'condition': 'host_os != "win"',
},
# WebGPU CTS - not used directly by Dawn, only transitively by Chromium.
diff --git a/build_overrides/dawn.gni b/build_overrides/dawn.gni
index 7cf74ac..59196ec 100644
--- a/build_overrides/dawn.gni
+++ b/build_overrides/dawn.gni
@@ -23,10 +23,6 @@
# True if Dawn can access build/, testing/ and other Chrome folders.
dawn_has_build = true
-# Whether we allow building DXC. This variable may be used to disable
-# building DXC in Chromium.
-dawn_build_dxc = true
-
# Defaults for these are set again in dawn_overrides_with_defaults.gni so that
# users of Dawn don't have to set dirs if they happen to use the same as Dawn.
diff --git a/scripts/dawn_features.gni b/scripts/dawn_features.gni
index 2ce8454..6736f88 100644
--- a/scripts/dawn_features.gni
+++ b/scripts/dawn_features.gni
@@ -13,6 +13,7 @@
# limitations under the License.
import("//build_overrides/build.gni")
+import("dawn_overrides_with_defaults.gni")
if (build_with_chromium) {
import("//build/config/ozone.gni")
@@ -44,6 +45,13 @@
# to be set to take effect.
# TODO(dawn:1536): Enable SwiftShader for Android.
dawn_use_swiftshader = !is_android && !is_ios
+
+ # Whether we allow building DXC.
+ # Only use DXC in standalone builds until it is stable. It will be
+ # explicitly enabled in Chromium builds.
+ # DXC requires SM6.0+ which is blocklisted on x86.
+ # See crbug.com/tint/1753.
+ dawn_use_built_dxc = dawn_standalone && is_win && target_cpu != "x86"
}
declare_args() {
diff --git a/scripts/dawn_overrides_with_defaults.gni b/scripts/dawn_overrides_with_defaults.gni
index 4e781d6..317bd07 100644
--- a/scripts/dawn_overrides_with_defaults.gni
+++ b/scripts/dawn_overrides_with_defaults.gni
@@ -28,10 +28,6 @@
dawn_has_build = true
}
-if (!defined(dawn_build_dxc)) {
- dawn_build_dxc = false
-}
-
if (!defined(dawn_root)) {
dawn_root = get_path_info("..", "abspath")
}
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index db8b9a2..6d4f252 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -480,9 +480,9 @@
}
if (dawn_enable_d3d12) {
- if (is_win && dawn_build_dxc) {
+ if (dawn_use_built_dxc) {
deps += [ "$dawn_root/third_party/gn/dxc:dxcompiler" ]
- defines += [ "DAWN_BUILD_DXC" ]
+ defines += [ "DAWN_USE_BUILT_DXC" ]
data_deps += [ "$dawn_root/third_party/gn/dxc:copy_dxil_dll" ]
}
libs += [ "dxguid.lib" ]
diff --git a/src/dawn/native/d3d/PlatformFunctions.cpp b/src/dawn/native/d3d/PlatformFunctions.cpp
index 16800ef..8a32596 100644
--- a/src/dawn/native/d3d/PlatformFunctions.cpp
+++ b/src/dawn/native/d3d/PlatformFunctions.cpp
@@ -144,7 +144,7 @@
void PlatformFunctions::LoadDXIL(const std::string& baseWindowsSDKPath) {
constexpr char kDxilDLLName[] = "dxil.dll";
const std::array kDxilDLLPaths{
-#ifdef DAWN_BUILD_DXC
+#ifdef DAWN_USE_BUILT_DXC
std::string{kDxilDLLName},
#else
std::string{kDxilDLLName},
@@ -168,7 +168,7 @@
constexpr char kDxCompilerDLLName[] = "dxcompiler.dll";
const std::array kDxCompilerDLLPaths{
-#ifdef DAWN_BUILD_DXC
+#ifdef DAWN_USE_BUILT_DXC
std::string{kDxCompilerDLLName},
#else
std::string{kDxCompilerDLLName}, baseWindowsSDKPath + kDxCompilerDLLName
diff --git a/src/dawn/native/d3d12/BackendD3D12.cpp b/src/dawn/native/d3d12/BackendD3D12.cpp
index 0327dec..2c4a042 100644
--- a/src/dawn/native/d3d12/BackendD3D12.cpp
+++ b/src/dawn/native/d3d12/BackendD3D12.cpp
@@ -56,7 +56,7 @@
DAWN_TRY(Base::Initialize(std::move(functions)));
-#ifdef DAWN_BUILD_DXC
+#ifdef DAWN_USE_BUILT_DXC
DAWN_INVALID_IF(!IsDXCAvailable(), "DXC dlls were built, but are not available");
#endif
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
index ff90b2b..1341f0c 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
@@ -459,7 +459,7 @@
void PhysicalDevice::SetupBackendAdapterToggles(TogglesState* adapterToggles) const {
// Check for use_dxc toggle
-#ifdef DAWN_BUILD_DXC
+#ifdef DAWN_USE_BUILT_DXC
// Default to using DXC. If shader model < 6.0, though, we must use FXC.
if (GetDeviceInfo().shaderModel <= 60) {
adapterToggles->ForceSet(Toggle::UseDXC, false);
diff --git a/src/dawn/tests/BUILD.gn b/src/dawn/tests/BUILD.gn
index c464937..4c58b9d 100644
--- a/src/dawn/tests/BUILD.gn
+++ b/src/dawn/tests/BUILD.gn
@@ -123,7 +123,7 @@
# Windows SDK into build folder, in order to ensure a DXC of verison 1.6 is
# avaliable when running end-to-end tests in Chromium. Note that currently DXC
# only provided for x86 and x64 in Windows SDK 20348.
-if (!dawn_build_dxc && build_with_chromium && is_win &&
+if (!dawn_use_built_dxc && build_with_chromium && is_win &&
(target_cpu == "x64" || target_cpu == "x86")) {
# The windows_sdk_path is acquired in visual_studio_version.gni.
import("//build/config/win/visual_studio_version.gni")
@@ -165,7 +165,7 @@
# binary from Windows SDK.
if (build_with_chromium && is_win &&
(target_cpu == "x64" || target_cpu == "x86")) {
- if (dawn_build_dxc) {
+ if (dawn_use_built_dxc) {
if (!defined(deps)) {
deps = []
}