From 8f3dc5836bb6c111c21e5a7d5be864f0692bd066 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Wed, 20 Nov 2019 18:10:11 +0000 Subject: [PATCH] Add in flag for using spvc instead of direct spriv-cross access Currently does nothing interesting, future CLs will flesh out the functionality. BUG=dawn:281 Change-Id: I89750a45ff5a42a13e1494cafd433bb7ef719b10 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13841 Reviewed-by: Austin Eng Reviewed-by: Corentin Wallez Commit-Queue: Ryan Harrison --- BUILD.gn | 7 ++++++- scripts/dawn_features.gni | 4 ++++ third_party/BUILD.gn | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index ca6a8c02ec..6079642c47 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -127,6 +127,11 @@ source_set("libdawn_native_sources") { "${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 = [] @@ -500,7 +505,7 @@ source_set("libdawn_native_sources") { ] } if (dawn_enable_vulkan_validation_layers) { - defines = [ + defines += [ "DAWN_ENABLE_VULKAN_VALIDATION_LAYERS", "DAWN_VK_DATA_DIR=\"$vulkan_data_subdir\"", ] diff --git a/scripts/dawn_features.gni b/scripts/dawn_features.gni index bed56166cb..24e6f5aa46 100644 --- a/scripts/dawn_features.gni +++ b/scripts/dawn_features.gni @@ -44,6 +44,10 @@ declare_args() { # 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/third_party/BUILD.gn b/third_party/BUILD.gn index 94851eacb3..d78eacfcd3 100644 --- a/third_party/BUILD.gn +++ b/third_party/BUILD.gn @@ -66,8 +66,9 @@ static_library("spirv_cross") { "${spirv_cross_dir}/spirv_parser.hpp", ] - need_glsl_cross = dawn_enable_opengl || dawn_enable_cross_reflection - need_reflection_cross = dawn_enable_cross_reflection + 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 += [