Add Tint to BUILD.gn

Tint is behind a build flag, since Tint is not yet available in
chromium's third_party.

BUG=dawn:403

Change-Id: If5fa36b36216ef6965341b886c3bd70d27daf23a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ryan Harrison 2020-05-07 21:15:55 +00:00 committed by Commit Bot service account
parent 4fe8ead090
commit 4f3811c064
7 changed files with 42 additions and 2 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ third_party/shaderc/
third_party/swiftshader/ third_party/swiftshader/
third_party/spirv-cross/ third_party/spirv-cross/
third_party/spirv-headers/ third_party/spirv-headers/
third_party/tint/
third_party/vulkan-headers/ third_party/vulkan-headers/
third_party/vulkan-loader/ third_party/vulkan-loader/
third_party/vulkan-validation-layers/ third_party/vulkan-validation-layers/

2
DEPS
View File

@ -85,7 +85,7 @@ deps = {
# WGSL support # WGSL support
'third_party/tint': { 'third_party/tint': {
'url': '{dawn_git}/tint@054927d7eb34803e2a05ab7993688e448a362948', 'url': '{dawn_git}/tint@1f1f08f94a11f470a4551896df9f610b71876924',
'condition': 'dawn_standalone', 'condition': 'dawn_standalone',
}, },

View File

@ -35,5 +35,6 @@ dawn_shaderc_dir = "//third_party/shaderc"
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools" dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
dawn_spirv_cross_dir = "//third_party/spirv-cross" dawn_spirv_cross_dir = "//third_party/spirv-cross"
dawn_swiftshader_dir = "//third_party/swiftshader" dawn_swiftshader_dir = "//third_party/swiftshader"
dawn_tint_dir = "//third_party/tint"
dawn_vulkan_loader_dir = "//third_party/vulkan-loader" dawn_vulkan_loader_dir = "//third_party/vulkan-loader"
dawn_vulkan_validation_layers_dir = "//third_party/vulkan-validation-layers" dawn_vulkan_validation_layers_dir = "//third_party/vulkan-validation-layers"

24
build_overrides/tint.gni Normal file
View File

@ -0,0 +1,24 @@
# Copyright 2020 The Dawn Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
tint_root_dir = "//third_party/tint"
tint_spirv_tools_dir = "//third_party/SPIRV-Tools"
tint_googletest_dir = "//third_party/googletest"
tint_spirv_headers_dir = "//third_party/spirv-headers"
# Only need the WGSL->SPIR-V transformation
tint_build_spv_reader = false
tint_build_spv_writer = true
tint_build_wgsl_reader = true
tint_build_wgsl_writer = false

View File

@ -59,7 +59,7 @@ declare_args() {
# if performing reflection on systems that the platform language # if performing reflection on systems that the platform language
# shader is SPIR-V, since there isn't an instance of the # shader is SPIR-V, since there isn't an instance of the
# GLSL/HLSL/MSL compiler. This implicitly pulls in the GLSL # GLSL/HLSL/MSL compiler. This implicitly pulls in the GLSL
# compiler, since it is a sub-class of if. # compiler, since it is a sub-class of it.
dawn_enable_cross_reflection = false dawn_enable_cross_reflection = false
# Enables error injection for faking failures to native API calls # Enables error injection for faking failures to native API calls
@ -68,6 +68,10 @@ declare_args() {
# Whether Dawn should enable X11 support. # Whether Dawn should enable X11 support.
dawn_use_x11 = is_linux && !is_chromeos dawn_use_x11 = is_linux && !is_chromeos
# Enable support WGSL for shaders. Currently this is
# experimental, and requires dawn_tint_dir to be set.
dawn_enable_wgsl = false
} }
# GN does not allow reading a variable defined in the same declare_args(). # GN does not allow reading a variable defined in the same declare_args().

View File

@ -71,3 +71,8 @@ if (!defined(dawn_vulkan_validation_layers_dir)) {
# Default to VVLs not being available. # Default to VVLs not being available.
dawn_vulkan_validation_layers_dir = "" dawn_vulkan_validation_layers_dir = ""
} }
if (!defined(dawn_tint_dir)) {
# Default to Tint not being available.
dawn_tint_dir = ""
}

View File

@ -569,6 +569,11 @@ source_set("dawn_native_sources") {
] ]
} }
} }
if (dawn_enable_wgsl) {
deps += [ "${dawn_tint_dir}:libtint" ]
defines += [ "DAWN_ENABLE_WGSL" ]
}
} }
# The static and shared libraries for dawn_native. Most of the files are # The static and shared libraries for dawn_native. Most of the files are