Skip to content

Commit

Permalink
[fuchsia] Only use upstream vulkan headers (flutter#44157)
Browse files Browse the repository at this point in the history
Stop using the special fuchsia headers, as they are contributing to
undefined behavior when building with LTO.
They are also no longer needed. All relevant fuchsia extensions were
upstreamed some time ago.

In the process, engage in some cleanup which means the "vulkan_config"
is also no longer needed. Rely on GN "public_deps" to provide the vulkan
include paths to various source sets.

See b/291462180 for more details on why this fix was neccesary.
  • Loading branch information
arbreng authored Aug 1, 2023
1 parent 1433e23 commit b3e2d44
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 135 deletions.
5 changes: 0 additions & 5 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,6 @@ deps = {
'src/third_party/pyyaml':
Var('fuchsia_git') + '/third_party/pyyaml.git' + '@' + '25e97546488eee166b1abb229a27856cecd8b7ac',

# Upstream Khronos Vulkan Headers are part of vulkan-deps
# Downstream Fuchsia Vulkan Headers (v1.2.198)
'src/third_party/fuchsia-vulkan':
Var('fuchsia_git') + '/third_party/Vulkan-Headers.git' + '@' + '32640ad82ef648768c706c9bf828b77123a09bc2',

'src/third_party/swiftshader':
Var('swiftshader_git') + '/SwiftShader.git' + '@' + '5f9ed9b16931c7155171d31f75004f73f0a3abc8',

Expand Down
18 changes: 0 additions & 18 deletions ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -1986,24 +1986,6 @@
../../../third_party/freetype2/src/winfonts/rules.mk
../../../third_party/freetype2/tests
../../../third_party/freetype2/vms_make.com
../../../third_party/fuchsia-vulkan/.cmake-format.py
../../../third_party/fuchsia-vulkan/.git
../../../third_party/fuchsia-vulkan/.gitattributes
../../../third_party/fuchsia-vulkan/.gitignore
../../../third_party/fuchsia-vulkan/BUILD.md
../../../third_party/fuchsia-vulkan/CMakeLists.txt
../../../third_party/fuchsia-vulkan/CODE_OF_CONDUCT.md
../../../third_party/fuchsia-vulkan/OWNERS
../../../third_party/fuchsia-vulkan/README.fuchsia
../../../third_party/fuchsia-vulkan/README.md
../../../third_party/fuchsia-vulkan/cmake
../../../third_party/fuchsia-vulkan/registry/cgenerator.py
../../../third_party/fuchsia-vulkan/registry/conventions.py
../../../third_party/fuchsia-vulkan/registry/generator.py
../../../third_party/fuchsia-vulkan/registry/genvk.py
../../../third_party/fuchsia-vulkan/registry/reg.py
../../../third_party/fuchsia-vulkan/registry/spec_tools/util.py
../../../third_party/fuchsia-vulkan/registry/vkconventions.py
../../../third_party/glfw/.appveyor.yml
../../../third_party/glfw/.git
../../../third_party/glfw/.gitattributes
Expand Down
75 changes: 1 addition & 74 deletions ci/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 5ef1e1b309e063c0fcac9bf05e72cd33
Signature: cc43922ed6f49342e50a23ad11cbbe6f

====================================================================================================
LIBRARY: angle
Expand Down Expand Up @@ -275,7 +275,6 @@ LIBRARY: abseil-cpp
LIBRARY: angle
LIBRARY: expat
LIBRARY: flatbuffers
LIBRARY: fuchsia-vulkan
LIBRARY: glslang
LIBRARY: khronos
LIBRARY: perfetto
Expand All @@ -287,18 +286,10 @@ LIBRARY: wuffs
ORIGIN: ../../../third_party/angle/src/libANGLE/overlay/LICENSE.txt
ORIGIN: ../../../third_party/flatbuffers/LICENSE.txt
ORIGIN: ../../../third_party/flatbuffers/swift/LICENSE
ORIGIN: ../../../third_party/fuchsia-vulkan/LICENSE.txt
ORIGIN: ../../../third_party/shaderc/LICENSE
ORIGIN: ../../../third_party/vulkan-deps/spirv-cross/src/LICENSE
ORIGIN: ../../../third_party/vulkan-deps/vulkan-headers/src/LICENSE.txt
ORIGIN: ../../../third_party/vulkan-deps/vulkan-validation-layers/src/LICENSE.txt
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan.hpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_enums.hpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_funcs.hpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_handles.hpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_raii.hpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_structs.hpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/fuchsia-vulkan/registry/vk.xml
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/vulkan-deps/spirv-cross/src/main.cpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/vulkan-deps/spirv-cross/src/spirv_cfg.cpp
ORIGIN: Apache-2.0 OR MIT referenced by ../../../third_party/vulkan-deps/spirv-cross/src/spirv_cfg.hpp
Expand Down Expand Up @@ -341,31 +332,6 @@ ORIGIN: Apache-2.0 referenced by ../../../third_party/angle/include/EGL/eglext.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/angle/include/EGL/eglplatform.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/angle/include/GLES2/gl2platform.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/angle/include/GLES3/gl3platform.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h264std.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h264std_decode.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h264std_encode.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h265std.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h265std_decode.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h265std_encode.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codecs_common.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vk_platform.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_android.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_beta.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_core.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_directfb.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_fuchsia.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_ggp.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_ios.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_macos.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_metal.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_screen.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_vi.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_wayland.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_win32.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_xcb.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_xlib.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_xlib_xrandr.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/khronos/EGL/egl.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/khronos/EGL/eglext.h
ORIGIN: Apache-2.0 referenced by ../../../third_party/khronos/EGL/eglplatform.h
Expand Down Expand Up @@ -670,9 +636,6 @@ ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/flatbuffers/swift/Sources/FlatBuffers/VeriferOptions.swift
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/flatbuffers/swift/Sources/FlatBuffers/Verifiable.swift
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/flatbuffers/swift/Sources/FlatBuffers/Verifier.swift
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vk_icd.h
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vk_layer.h
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/fuchsia-vulkan/include/vulkan/vk_sdk_platform.h
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/khronos/GLES2/gl2platform.h
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/khronos/GLES3/gl3platform.h
ORIGIN: http://www.apache.org/licenses/LICENSE-2.0 referenced by ../../../third_party/perfetto/Android.bp
Expand Down Expand Up @@ -2807,42 +2770,6 @@ FILE: ../../../third_party/flatbuffers/swift/Sources/FlatBuffers/Verifier.swift
FILE: ../../../third_party/flatbuffers/tsconfig.json
FILE: ../../../third_party/flatbuffers/tsconfig.mjs.json
FILE: ../../../third_party/flatbuffers/yarn.lock
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h264std.h
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h264std_decode.h
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h264std_encode.h
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h265std.h
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h265std_decode.h
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codec_h265std_encode.h
FILE: ../../../third_party/fuchsia-vulkan/include/vk_video/vulkan_video_codecs_common.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vk_icd.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vk_layer.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vk_platform.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vk_sdk_platform.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan.hpp
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_android.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_beta.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_core.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_directfb.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_enums.hpp
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_fuchsia.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_funcs.hpp
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_ggp.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_handles.hpp
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_ios.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_macos.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_metal.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_raii.hpp
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_screen.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_structs.hpp
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_vi.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_wayland.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_win32.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_xcb.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_xlib.h
FILE: ../../../third_party/fuchsia-vulkan/include/vulkan/vulkan_xlib_xrandr.h
FILE: ../../../third_party/fuchsia-vulkan/registry/validusage.json
FILE: ../../../third_party/fuchsia-vulkan/registry/vk.xml
FILE: ../../../third_party/khronos/EGL/egl.h
FILE: ../../../third_party/khronos/EGL/eglext.h
FILE: ../../../third_party/khronos/EGL/eglplatform.h
Expand Down
3 changes: 2 additions & 1 deletion common/graphics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ source_set("graphics") {

public_configs = [ "//flutter:config" ]
if (shell_enable_vulkan) {
public_configs += [ "//flutter/vulkan:vulkan_config" ]
public_deps =
[ "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers" ]
}
}
2 changes: 0 additions & 2 deletions examples/vulkan_glfw/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ executable("vulkan_glfw") {

sources = [ "src/main.cc" ]

configs += [ "//flutter/vulkan:vulkan_config" ]

deps = [
"//flutter/shell/platform/embedder:embedder",
"//third_party/glfw",
Expand Down
11 changes: 4 additions & 7 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,19 @@ source_set("flow") {
]

public_configs = [ "//flutter:config" ]
if (shell_enable_vulkan) {
public_configs += [ "//flutter/vulkan:vulkan_config" ]
}

deps = [
public_deps = [
"//flutter/common",
"//flutter/common/graphics",
"//flutter/display_list",
"//flutter/fml",
"//third_party/skia",
]

deps = [ "//third_party/skia" ]

if (impeller_supports_rendering) {
deps += [ "//flutter/impeller" ]
}

public_deps = [ "//flutter/display_list" ]
}

if (enable_unittests) {
Expand Down
9 changes: 3 additions & 6 deletions flutter_vma/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ source_set("flutter_vma") {
defines = [ "VMA_USE_STL_SHARED_MUTEX=0" ]
}

deps = [
public_deps = [
"//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers",
"//third_party/vulkan_memory_allocator",
]
Expand All @@ -28,13 +28,10 @@ source_set("flutter_skia_vma") {
"flutter_skia_vma.h",
]

public_deps = [ ":flutter_vma" ]

deps = [
public_deps = [
":flutter_vma",
"//flutter/fml",
"//flutter/vulkan/procs",
"//third_party/skia",
"//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers",
"//third_party/vulkan_memory_allocator",
]
}
2 changes: 2 additions & 0 deletions impeller/renderer/backend/vulkan/vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
#define VULKAN_HPP_NAMESPACE impeller::vk
#define VULKAN_HPP_ASSERT_ON_RESULT(ignored) \
{ [[maybe_unused]] auto res = (ignored); }
#define VULKAN_HPP_NO_EXCEPTIONS

#include "vulkan/vulkan.hpp"

static_assert(VK_HEADER_VERSION >= 215, "Vulkan headers must not be too old.");
1 change: 0 additions & 1 deletion testing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ if (use_swiftshader) {

configs -= [ "//build/config/clang:extra_warnings" ]
configs += [
"//flutter/vulkan:vulkan_config", # for swiftshader
"//third_party/angle:gl_prototypes",
"//third_party/swiftshader:swiftshader_config",
]
Expand Down
2 changes: 1 addition & 1 deletion tools/fuchsia/build_fuchsia_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def RunGN(variant_dir, flags):
def BuildNinjaTargets(variant_dir, targets):
assert os.path.exists(os.path.join(_out_dir, variant_dir))

print('Running autoninja for targets: %s', targets)
print('Running autoninja for targets: %s' % targets)
RunExecutable(['autoninja', '-C',
os.path.join(_out_dir, variant_dir)] + targets)

Expand Down
16 changes: 1 addition & 15 deletions vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@

import("//build/fuchsia/sdk.gni")

config("vulkan_config") {
include_dirs = [ "//third_party/vulkan_memory_allocator/include" ]
defines = [ "VULKAN_HPP_NO_EXCEPTIONS=1" ]
if (is_fuchsia) {
include_dirs += [ "//third_party/fuchsia-vulkan/include" ]
defines += [ "VK_USE_PLATFORM_FUCHSIA=1" ]
} else {
include_dirs += [ "//third_party/vulkan-deps/vulkan-headers/src/include" ]
}
}

source_set("vulkan") {
sources = [
"vulkan_application.cc",
Expand Down Expand Up @@ -59,10 +48,7 @@ source_set("vulkan") {
"//third_party/skia",
]

public_configs = [
":vulkan_config",
"//flutter:config",
]
public_configs = [ "//flutter:config" ]

public_deps =
[ "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers" ]
Expand Down
8 changes: 4 additions & 4 deletions vulkan/procs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ source_set("procs") {
"vulkan_proc_table.h",
]

deps = [ "//flutter/fml" ]
public_configs = [ "//flutter:config" ]

public_configs = [
"//flutter/vulkan:vulkan_config",
"//flutter:config",
public_deps = [
"//flutter/fml",
"//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers",
]
}
1 change: 0 additions & 1 deletion vulkan/vulkan_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <utility>
#include <vector>

#include "flutter/flutter_vma/flutter_skia_vma.h"
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_proc_table.h"
Expand Down

0 comments on commit b3e2d44

Please sign in to comment.