Revert "Convert spvc build flag to a runtime toggle"
This reverts commit 1954436fe28557dab8381f5b0f8ca7d68ab091c8.
Reason for revert:
The shaderc side of this multi-patch brings in a dependency on glslang, which uses a static initializer, which chromium doesn't like.
Original change's description:
> Convert spvc build flag to a runtime toggle
>
> Also moves some of the spirv_cross code into the main library that was
> feature guarded, since spvc requires it.
>
> BUG=dawn:281
>
> Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,rharrison@chromium.org
Change-Id: Ia9a025fb4440c96874d1b45776a9f97023ca591d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13941
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 4647e4c..0fd9cf4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -124,12 +124,15 @@
":libdawn_native_headers",
":libdawn_native_utils_gen",
"${dawn_root}/src/common",
- "${dawn_shaderc_dir}:libshaderc_spvc",
"${dawn_spirv_tools_dir}:spvtools_val",
"third_party:spirv_cross",
]
-
defines = []
+ if (dawn_use_spvc) {
+ deps += [ "${dawn_shaderc_dir}:libshaderc_spvc" ]
+ defines += [ "DAWN_USE_SPVC" ]
+ }
+
configs += [ ":libdawn_native_internal" ]
libs = []
diff --git a/DEPS b/DEPS
index 6eab355..e882995 100644
--- a/DEPS
+++ b/DEPS
@@ -68,7 +68,7 @@
'condition': 'dawn_standalone',
},
'third_party/shaderc': {
- 'url': '{chromium_git}/external/github.com/google/shaderc@eca11511a0c09dd599837862c96658a91e927a3a',
+ 'url': '{chromium_git}/external/github.com/google/shaderc@c7f5cfd07f41c997045d76fd09c934691ff8a6c6',
'condition': 'dawn_standalone',
},
diff --git a/scripts/dawn_features.gni b/scripts/dawn_features.gni
index 84ac2bb..cc1eb67 100644
--- a/scripts/dawn_features.gni
+++ b/scripts/dawn_features.gni
@@ -44,6 +44,10 @@
# GLSL/HLSL/MSL compiler. This implicitly pulls in the GLSL
# compiler, since it is a sub-class of if.
dawn_enable_cross_reflection = false
+
+ # Enables using spvc for accessing SPIR-V toolchain, instead of
+ # directly accessing it in Dawn.
+ dawn_use_spvc = false
}
# GN does not allow reading a variable defined in the same declare_args().
diff --git a/src/dawn_native/Toggles.cpp b/src/dawn_native/Toggles.cpp
index 0995499..cfe8253 100644
--- a/src/dawn_native/Toggles.cpp
+++ b/src/dawn_native/Toggles.cpp
@@ -82,11 +82,7 @@
"versions of Windows prior to build 1809, or when this toggle is turned off, Dawn "
"will emulate a render pass."}},
{Toggle::SkipValidation,
- {"skip_validation", "Skip expensive validation of Dawn commands."}},
- {Toggle::UseSpvc,
- {"use_spvc",
- "Enable use of spvc for shader compilation, instead of accessing spirv_cross "
- "directly."}}}};
+ {"skip_validation", "Skip expensive validation of Dawn commands."}}}};
} // anonymous namespace
void TogglesSet::SetToggle(Toggle toggle, bool enabled) {
diff --git a/src/dawn_native/Toggles.h b/src/dawn_native/Toggles.h
index 218b5d8..0d5aa7f 100644
--- a/src/dawn_native/Toggles.h
+++ b/src/dawn_native/Toggles.h
@@ -33,7 +33,7 @@
UseD3D12ResourceHeapTier2,
UseD3D12RenderPass,
SkipValidation,
- UseSpvc,
+
EnumCount,
InvalidEnum = EnumCount,
};
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 4830d9d..d78eacf 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -62,6 +62,61 @@
"${spirv_cross_dir}/spirv_cross_error_handling.hpp",
"${spirv_cross_dir}/spirv_cross_parsed_ir.cpp",
"${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
+ "${spirv_cross_dir}/spirv_parser.cpp",
+ "${spirv_cross_dir}/spirv_parser.hpp",
+ ]
+
+ need_glsl_cross =
+ dawn_enable_opengl || dawn_enable_cross_reflection || dawn_use_spvc
+ need_reflection_cross = dawn_enable_cross_reflection || dawn_use_spvc
+
+ if (dawn_enable_d3d12) {
+ sources += [
+ "${spirv_cross_dir}/spirv_hlsl.cpp",
+ "${spirv_cross_dir}/spirv_hlsl.hpp",
+ ]
+ need_glsl_cross = true
+ }
+
+ if (dawn_enable_metal) {
+ sources += [
+ "${spirv_cross_dir}/spirv_msl.cpp",
+ "${spirv_cross_dir}/spirv_msl.hpp",
+ ]
+ need_glsl_cross = true
+ }
+
+ if (need_glsl_cross) {
+ sources += [
+ "${spirv_cross_dir}/spirv_glsl.cpp",
+ "${spirv_cross_dir}/spirv_glsl.hpp",
+ ]
+ }
+
+ if (need_reflection_cross) {
+ sources += [
+ "${spirv_cross_dir}/spirv_reflect.cpp",
+ "${spirv_cross_dir}/spirv_reflect.hpp",
+ ]
+ }
+}
+
+static_library("spirv_cross_full_for_fuzzers") {
+ public_configs = [ ":spirv_cross_public" ]
+ configs += [ ":spirv_cross_internal" ]
+
+ sources = [
+ "${spirv_cross_dir}/GLSL.std.450.h",
+ "${spirv_cross_dir}/spirv.hpp",
+ "${spirv_cross_dir}/spirv_cfg.cpp",
+ "${spirv_cross_dir}/spirv_cfg.hpp",
+ "${spirv_cross_dir}/spirv_common.hpp",
+ "${spirv_cross_dir}/spirv_cross.cpp",
+ "${spirv_cross_dir}/spirv_cross.hpp",
+ "${spirv_cross_dir}/spirv_cross_containers.hpp",
+ "${spirv_cross_dir}/spirv_cross_error_handling.hpp",
+ "${spirv_cross_dir}/spirv_cross_parsed_ir.cpp",
+ "${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
"${spirv_cross_dir}/spirv_glsl.cpp",
"${spirv_cross_dir}/spirv_glsl.hpp",
"${spirv_cross_dir}/spirv_hlsl.cpp",