Add build time flag to control enabling SPIRV-Cross reflection

This adds a flag to enable using the reflection compiler from
SPIRV-Cross, and also updates the build rules to make sure that the
GLSL compiler is also present when using reflection, since the
reflection compiler subclassess the GLSL compiler.

BUG=dawn:231

Change-Id: I4e227cb955a3bb794d906dabdadffdaca001352b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ryan Harrison 2019-10-07 15:47:27 +00:00 committed by Commit Bot service account
parent 86d921e048
commit d561448d0d
2 changed files with 16 additions and 3 deletions

View File

@ -37,4 +37,11 @@ declare_args() {
# Enables the compilation of Dawn's Vulkan backend
dawn_enable_vulkan = is_linux || is_win || is_fuchsia
# Enable use of reflection compiler in spirv-cross. This is needed
# if performing reflection on systems that the platform language
# shader is SPIR-V, since there isn't an instance of the
# GLSL/HLSL/MSL compiler. This implicitly pulls in the GLSL
# compiler, since it is a sub-class of if.
dawn_enable_cross_reflection = false
}

12
third_party/BUILD.gn vendored
View File

@ -62,11 +62,10 @@ static_library("spirv_cross") {
"${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
"${spirv_cross_dir}/spirv_parser.cpp",
"${spirv_cross_dir}/spirv_parser.hpp",
"${spirv_cross_dir}/spirv_reflect.cpp",
"${spirv_cross_dir}/spirv_reflect.hpp",
]
need_glsl_cross = dawn_enable_opengl
need_glsl_cross = dawn_enable_opengl || dawn_enable_cross_reflection
need_reflection_cross = dawn_enable_cross_reflection
if (dawn_enable_d3d12) {
sources += [
@ -90,6 +89,13 @@ static_library("spirv_cross") {
"${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") {