Allow using swiftshader with the Vulkan backend
This adds swiftshader as a dependency of Dawn, and when it is present
dawn_use_swiftshader=true will force usage of it. (due to a Vulkan
loader limitation we can't have both regular drivers and swiftshader in
the same VkInstance).
BUG=dawn:283
Change-Id: Ib94f4dcca652eb380e994f007cdcfb145b1a5102
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/scripts/dawn_features.gni b/scripts/dawn_features.gni
index 84ac2bb..2de3260 100644
--- a/scripts/dawn_features.gni
+++ b/scripts/dawn_features.gni
@@ -44,14 +44,20 @@
# 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 usage of swiftshader on the Vulkan backend.
+ # Note that this will only work in standalone and in projects that set the
+ # dawn_swiftshader_dir variable in build_overrides/dawn.gni
+ # Because of how the Vulkan loader works, setting this make Dawn only able
+ # to find the Swiftshader ICD and not the others.
+ dawn_use_swiftshader = false
}
# GN does not allow reading a variable defined in the same declare_args().
# Put them in two separate declare_args() when setting the value of one
# argument based on another.
-if (dawn_enable_vulkan) {
- declare_args() {
- # Uses our built version of Vulkan validation layers
- dawn_enable_vulkan_validation_layers = (is_linux && !is_chromeos) || is_win
- }
+declare_args() {
+ # Uses our built version of Vulkan validation layers
+ dawn_enable_vulkan_validation_layers =
+ dawn_enable_vulkan && ((is_linux && !is_chromeos) || is_win)
}