Update to Dawn ToT.
Switch to Dawn's version of dawn_generator.gni. This depends on having a file called build_overrides/dawn.gni. However, this will also enable us to use the upstream Dawn BUILD.gn files more easily in the future. This required adding it to compile.isolate, so the bots can pick it up. Keeping up with Dawn: Rename TextureFormat enums. Rename dawn::BufferUsageBit::TransferDst -> CopyDst. Removal of GLAD dependency. SPIRV-Tools update. Change-Id: Idcd5d1035ed106485dd2503b829e3c3b57a5688b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228568 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
1874ccbd5c
commit
3e45e128eb
2
DEPS
2
DEPS
@ -8,7 +8,7 @@ deps = {
|
||||
"buildtools" : "https://chromium.googlesource.com/chromium/buildtools.git@505de88083136eefd056e5ee4ca0f01fe9b33de8",
|
||||
"common" : "https://skia.googlesource.com/common.git@9737551d7a52c3db3262db5856e6bcd62c462b92",
|
||||
"third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@9ec3f51d11d92c8b87da27811cc7ab577705ea3c",
|
||||
"third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@2d4b5294432f254c8ab093ff399cdf9aa59260a6",
|
||||
"third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@472bd1ec29d8d4e03404bf4b4e0233e4fc6031ce",
|
||||
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b",
|
||||
"third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@a0bca08de07c7d7651047bedc0b653cfaaa4f2ae",
|
||||
"third_party/externals/expat" : "https://android.googlesource.com/platform/external/expat.git@android-6.0.1_r55",
|
||||
|
20
build_overrides/dawn.gni
Normal file
20
build_overrides/dawn.gni
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright 2019 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# These are variables that are overridable by projects that include Dawn.
|
||||
|
||||
dawn_root = "../externals/dawn"
|
||||
|
||||
# The paths to Dawn's dependencies. For now, we leave these unset to
|
||||
# use Dawn's DEPS. Eventually, we'll move to Skia's copies of as
|
||||
# many of these as possible. This will require updating Skia's
|
||||
# SPIRV-Tools and Shaderc at a minimum.
|
||||
|
||||
# dawn_jinja2_dir = "//third_party/jinja2"
|
||||
# dawn_glfw_dir = "//third_party/glfw"
|
||||
# dawn_googletest_dir = "//third_party/googletest"
|
||||
# dawn_shaderc_dir = "//third_party/shaderc"
|
||||
# dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
|
||||
# dawn_spirv_cross_dir = "//third_party/spirv-cross"
|
@ -12,6 +12,7 @@
|
||||
'../../bench',
|
||||
'../../bin/fetch-clang-format',
|
||||
'../../bin/fetch-gn',
|
||||
'../../build_overrides/dawn.gni',
|
||||
'../../buildtools',
|
||||
'../../dm',
|
||||
'../../docs/examples',
|
||||
|
@ -41,14 +41,14 @@ GrPixelConfig GrDawnCaps::onGetConfigFromBackendFormat(const GrBackendFormat& fo
|
||||
}
|
||||
break;
|
||||
case GrColorType::kRGBA_8888:
|
||||
if (dawn::TextureFormat::R8G8B8A8Unorm == textureFormat) {
|
||||
if (dawn::TextureFormat::RGBA8Unorm == textureFormat) {
|
||||
return kRGBA_8888_GrPixelConfig;
|
||||
}
|
||||
break;
|
||||
case GrColorType::kRGB_888x:
|
||||
break;
|
||||
case GrColorType::kBGRA_8888:
|
||||
if (dawn::TextureFormat::B8G8R8A8Unorm == textureFormat) {
|
||||
if (dawn::TextureFormat::BGRA8Unorm == textureFormat) {
|
||||
return kBGRA_8888_GrPixelConfig;
|
||||
}
|
||||
break;
|
||||
@ -68,10 +68,10 @@ GrPixelConfig GrDawnCaps::getYUVAConfigFromBackendFormat(const GrBackendFormat&
|
||||
case dawn::TextureFormat::R8Unorm:
|
||||
return kAlpha_8_as_Red_GrPixelConfig;
|
||||
break;
|
||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
||||
case dawn::TextureFormat::RGBA8Unorm:
|
||||
return kRGBA_8888_GrPixelConfig;
|
||||
break;
|
||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
||||
case dawn::TextureFormat::BGRA8Unorm:
|
||||
return kBGRA_8888_GrPixelConfig;
|
||||
break;
|
||||
default:
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
GrPixelConfig GrDawnFormatToPixelConfig(dawn::TextureFormat format) {
|
||||
switch (format) {
|
||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
||||
case dawn::TextureFormat::RGBA8Unorm:
|
||||
return kRGBA_8888_GrPixelConfig;
|
||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
||||
case dawn::TextureFormat::BGRA8Unorm:
|
||||
return kBGRA_8888_GrPixelConfig;
|
||||
case dawn::TextureFormat::R8Unorm:
|
||||
return kAlpha_8_GrPixelConfig;
|
||||
case dawn::TextureFormat::D32FloatS8Uint:
|
||||
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||
default:
|
||||
SkASSERT(false);
|
||||
return kRGBA_8888_GrPixelConfig;
|
||||
@ -28,10 +28,10 @@ bool GrPixelConfigToDawnFormat(GrPixelConfig config, dawn::TextureFormat* format
|
||||
case kRGBA_4444_GrPixelConfig:
|
||||
case kRGB_565_GrPixelConfig:
|
||||
case kGray_8_GrPixelConfig:
|
||||
*format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
*format = dawn::TextureFormat::RGBA8Unorm;
|
||||
return true;
|
||||
case kBGRA_8888_GrPixelConfig:
|
||||
*format = dawn::TextureFormat::B8G8R8A8Unorm;
|
||||
*format = dawn::TextureFormat::BGRA8Unorm;
|
||||
return true;
|
||||
case kAlpha_8_GrPixelConfig:
|
||||
*format = dawn::TextureFormat::R8Unorm;
|
||||
|
116
third_party/dawn/BUILD.gn
vendored
116
third_party/dawn/BUILD.gn
vendored
@ -14,6 +14,7 @@
|
||||
|
||||
dawn_root = "../externals/dawn"
|
||||
import("$dawn_root/scripts/dawn_features.gni")
|
||||
import("$dawn_root/generator/dawn_generator.gni")
|
||||
|
||||
###############################################################################
|
||||
# Template to wrap the Dawn code generator
|
||||
@ -21,7 +22,7 @@ import("$dawn_root/scripts/dawn_features.gni")
|
||||
|
||||
# Template to help with invocation of the Dawn code generator, looks like this:
|
||||
#
|
||||
# dawn_generator("my_target_gen") {
|
||||
# dawn_json_generator("my_target_gen") {
|
||||
# # Which generator target to output
|
||||
# target = "my_target"
|
||||
# # The list of expected outputs, generation fails if there's a mismatch
|
||||
@ -38,81 +39,6 @@ import("$dawn_root/scripts/dawn_features.gni")
|
||||
# sources = get_target_outputs(":my_target_gen")
|
||||
# }
|
||||
#
|
||||
template("dawn_generator") {
|
||||
# The base arguments for the generator: from this dawn.json, generate this
|
||||
# target using templates in this directory.
|
||||
generator_args = [
|
||||
rebase_path("$dawn_root/dawn.json", root_build_dir),
|
||||
"--template-dir",
|
||||
rebase_path("$dawn_root/generator/templates", root_build_dir),
|
||||
"--targets",
|
||||
invoker.target,
|
||||
]
|
||||
|
||||
# For build parallelism GN wants to know the exact inputs and outputs of
|
||||
# action targets like we use for our code generator. We avoid asking the
|
||||
# generator about its inputs by using the "depfile" feature of GN/Ninja.
|
||||
#
|
||||
# A ninja limitation is that the depfile is a subset of Makefile that can
|
||||
# contain a single target, so we output a single "JSON-tarball" instead.
|
||||
json_tarball = "${target_gen_dir}/${target_name}.json_tarball"
|
||||
json_tarball_depfile = "${json_tarball}.d"
|
||||
|
||||
generator_args += [
|
||||
"--output-json-tarball",
|
||||
rebase_path(json_tarball, root_build_dir),
|
||||
"--depfile",
|
||||
rebase_path(json_tarball_depfile, root_build_dir),
|
||||
]
|
||||
|
||||
# After the JSON tarball is created we need an action target to extract it
|
||||
# with a list of its outputs. The invoker provided a list of expected
|
||||
# outputs. To make sure the list is in sync between the generator and the
|
||||
# build files, we write it to a file and ask the generator to assert it is
|
||||
# correct.
|
||||
expected_outputs_file = "${target_gen_dir}/${target_name}.expected_outputs"
|
||||
write_file(expected_outputs_file, invoker.outputs)
|
||||
|
||||
generator_args += [
|
||||
"--expected-outputs-file",
|
||||
rebase_path(expected_outputs_file, root_build_dir),
|
||||
]
|
||||
|
||||
# The code generator invocation that will write the JSON tarball, check the
|
||||
# outputs are what's expected and write a depfile for Ninja.
|
||||
action("${target_name}_json_tarball") {
|
||||
script = "${dawn_root}/generator/main.py"
|
||||
outputs = [
|
||||
json_tarball,
|
||||
]
|
||||
depfile = json_tarball_depfile
|
||||
args = generator_args
|
||||
}
|
||||
|
||||
# Extract the JSON tarball into the target_gen_dir
|
||||
action("${target_name}") {
|
||||
script = "${dawn_root}/generator/extract_json.py"
|
||||
args = [
|
||||
rebase_path(json_tarball, root_build_dir),
|
||||
rebase_path(target_gen_dir, root_build_dir),
|
||||
]
|
||||
|
||||
deps = [
|
||||
":${target_name}_json_tarball",
|
||||
]
|
||||
inputs = [
|
||||
json_tarball,
|
||||
]
|
||||
|
||||
# The expected output list is relative to the target_gen_dir but action
|
||||
# target outputs are from the root dir so we need to rebase them.
|
||||
outputs = []
|
||||
foreach(source, invoker.outputs) {
|
||||
outputs += [ "${target_gen_dir}/${source}" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Common dawn libraries and configs
|
||||
###############################################################################
|
||||
@ -168,6 +94,7 @@ static_library("dawn_common") {
|
||||
"src/common/Math.cpp",
|
||||
"src/common/Math.h",
|
||||
"src/common/Platform.h",
|
||||
"src/common/Result.cpp",
|
||||
"src/common/Result.h",
|
||||
"src/common/Serial.h",
|
||||
"src/common/SerialMap.h",
|
||||
@ -190,7 +117,7 @@ static_library("dawn_common") {
|
||||
# Dawn headers and libdawn.so
|
||||
###############################################################################
|
||||
|
||||
dawn_generator("dawn_headers_gen") {
|
||||
dawn_json_generator("dawn_headers_gen") {
|
||||
target = "dawn_headers"
|
||||
outputs = [
|
||||
"dawn/dawncpp.h",
|
||||
@ -212,7 +139,7 @@ source_set("dawn_headers") {
|
||||
]
|
||||
}
|
||||
|
||||
dawn_generator("libdawn_gen") {
|
||||
dawn_json_generator("libdawn_gen") {
|
||||
target = "libdawn"
|
||||
outputs = [
|
||||
"dawn/dawncpp.cpp",
|
||||
@ -246,7 +173,7 @@ config("libdawn_native_internal") {
|
||||
}
|
||||
}
|
||||
|
||||
dawn_generator("libdawn_native_utils_gen") {
|
||||
dawn_json_generator("libdawn_native_utils_gen") {
|
||||
target = "dawn_native_utils"
|
||||
outputs = [
|
||||
"dawn_native/ProcTable.cpp",
|
||||
@ -257,6 +184,21 @@ dawn_generator("libdawn_native_utils_gen") {
|
||||
]
|
||||
}
|
||||
|
||||
if (dawn_enable_opengl) {
|
||||
dawn_generator("libdawn_native_opengl_loader_gen") {
|
||||
script = "${dawn_root}/generator/opengl_loader_generator.py"
|
||||
args = [
|
||||
"--gl-xml",
|
||||
rebase_path("${dawn_root}/third_party/khronos/gl.xml", root_build_dir),
|
||||
]
|
||||
outputs = [
|
||||
"dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
|
||||
"dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
|
||||
"dawn_native/opengl/opengl_platform_autogen.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Public libdawn_native headers so they can be publically visible for
|
||||
# dependencies of libdawn_native
|
||||
source_set("libdawn_native_headers") {
|
||||
@ -342,6 +284,8 @@ source_set("libdawn_native_sources") {
|
||||
"src/dawn_native/Fence.h",
|
||||
"src/dawn_native/FenceSignalTracker.cpp",
|
||||
"src/dawn_native/FenceSignalTracker.h",
|
||||
"src/dawn_native/Format.cpp",
|
||||
"src/dawn_native/Format.h",
|
||||
"src/dawn_native/Forward.h",
|
||||
"src/dawn_native/Instance.cpp",
|
||||
"src/dawn_native/Instance.h",
|
||||
@ -403,6 +347,8 @@ source_set("libdawn_native_sources") {
|
||||
"src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
|
||||
"src/dawn_native/d3d12/ComputePipelineD3D12.h",
|
||||
"src/dawn_native/d3d12/D3D12Backend.cpp",
|
||||
"src/dawn_native/d3d12/D3D12Info.cpp",
|
||||
"src/dawn_native/d3d12/D3D12Info.h",
|
||||
"src/dawn_native/d3d12/DescriptorHeapAllocator.cpp",
|
||||
"src/dawn_native/d3d12/DescriptorHeapAllocator.h",
|
||||
"src/dawn_native/d3d12/DeviceD3D12.cpp",
|
||||
@ -494,7 +440,11 @@ source_set("libdawn_native_sources") {
|
||||
}
|
||||
|
||||
if (dawn_enable_opengl) {
|
||||
deps += [ "third_party:glad" ]
|
||||
deps += [
|
||||
":libdawn_native_opengl_loader_gen",
|
||||
"third_party:khronos_platform",
|
||||
]
|
||||
sources += get_target_outputs(":libdawn_native_opengl_loader_gen")
|
||||
sources +=
|
||||
rebase_path([
|
||||
"src/dawn_native/opengl/BackendGL.cpp",
|
||||
@ -508,6 +458,10 @@ source_set("libdawn_native_sources") {
|
||||
"src/dawn_native/opengl/DeviceGL.cpp",
|
||||
"src/dawn_native/opengl/DeviceGL.h",
|
||||
"src/dawn_native/opengl/Forward.h",
|
||||
"src/dawn_native/opengl/NativeSwapChainImplGL.cpp",
|
||||
"src/dawn_native/opengl/NativeSwapChainImplGL.h",
|
||||
"src/dawn_native/opengl/OpenGLFunctions.cpp",
|
||||
"src/dawn_native/opengl/OpenGLFunctions.h",
|
||||
"src/dawn_native/opengl/OpenGLBackend.cpp",
|
||||
"src/dawn_native/opengl/PersistentPipelineStateGL.cpp",
|
||||
"src/dawn_native/opengl/PersistentPipelineStateGL.h",
|
||||
@ -529,6 +483,7 @@ source_set("libdawn_native_sources") {
|
||||
"src/dawn_native/opengl/TextureGL.h",
|
||||
"src/dawn_native/opengl/UtilsGL.cpp",
|
||||
"src/dawn_native/opengl/UtilsGL.h",
|
||||
"src/dawn_native/opengl/opengl_platform.h",
|
||||
],
|
||||
".",
|
||||
"$dawn_root")
|
||||
@ -536,6 +491,7 @@ source_set("libdawn_native_sources") {
|
||||
|
||||
configs -= [ "//gn:warnings" ]
|
||||
if (dawn_enable_vulkan) {
|
||||
deps += [ "third_party:vulkan_headers" ]
|
||||
sources += rebase_path([
|
||||
"src/dawn_native/vulkan/AdapterVk.cpp",
|
||||
"src/dawn_native/vulkan/AdapterVk.h",
|
||||
|
51
third_party/dawn/third_party/BUILD.gn
vendored
51
third_party/dawn/third_party/BUILD.gn
vendored
@ -46,6 +46,27 @@ static_library("spirv_cross") {
|
||||
"${spirv_cross}")
|
||||
}
|
||||
|
||||
# Empty targets to add the include dirs and list the sources of Khronos headers for header inclusion check.
|
||||
config("khronos_headers_public") {
|
||||
include_dirs = [ "../../externals/dawn/third_party/khronos" ]
|
||||
}
|
||||
|
||||
source_set("vulkan_headers") {
|
||||
sources = [
|
||||
"khronos/vulkan/vk_platform.h",
|
||||
"khronos/vulkan/vulkan.h",
|
||||
]
|
||||
|
||||
public_configs = [ ":khronos_headers_public" ]
|
||||
}
|
||||
|
||||
source_set("khronos_platform") {
|
||||
sources = [
|
||||
"khronos/KHR/khrplatform.h",
|
||||
]
|
||||
public_configs = [ ":khronos_headers_public" ]
|
||||
}
|
||||
|
||||
spirv_tools = "$dawn_thirdparty_root/SPIRV-Tools"
|
||||
spirv_tools_spirv_headers_dir = "$dawn_thirdparty_root/spirv-headers"
|
||||
|
||||
@ -423,35 +444,6 @@ static_library("spvtools") {
|
||||
configs += [ ":spvtools_internal_config" ]
|
||||
}
|
||||
|
||||
config("glad_config") {
|
||||
include_dirs = [ "$dawn_thirdparty_root/glad/include" ]
|
||||
}
|
||||
|
||||
static_library("glad") {
|
||||
sources = rebase_path([
|
||||
"glad/include/KHR/khrplatform.h",
|
||||
"glad/include/glad/glad.h",
|
||||
"glad/src/glad.c",
|
||||
],
|
||||
".",
|
||||
"$dawn_thirdparty_root")
|
||||
|
||||
public_configs = [ ":glad_config" ]
|
||||
|
||||
cflags = []
|
||||
if (is_win) {
|
||||
cflags += [
|
||||
"/wd4055",
|
||||
"/wd4054",
|
||||
] # type cast from void* to function pointer
|
||||
} else {
|
||||
cflags_c = [
|
||||
"-Wno-unused-function",
|
||||
"-Wno-strict-prototypes",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
static_library("spvtools_val") {
|
||||
sources = rebase_path([
|
||||
"source/val/basic_block.cpp",
|
||||
@ -488,6 +480,7 @@ static_library("spvtools_val") {
|
||||
"source/val/validate_logicals.cpp",
|
||||
"source/val/validate_memory.cpp",
|
||||
"source/val/validate_memory_semantics.cpp",
|
||||
"source/val/validate_misc.cpp",
|
||||
"source/val/validate_mode_setting.cpp",
|
||||
"source/val/validate_non_uniform.cpp",
|
||||
"source/val/validate_primitives.cpp",
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
dawn::Buffer buffer;
|
||||
if (fBuffers.empty()) {
|
||||
dawn::BufferDescriptor desc;
|
||||
desc.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst;
|
||||
desc.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
desc.size = 1;
|
||||
buffer = fDevice.CreateBuffer(&desc);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user