Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/chromium/6827' into dcp
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmader committed Nov 8, 2024
2 parents b4eae6e + b2edbc3 commit d850c2a
Show file tree
Hide file tree
Showing 33,537 changed files with 413,481 additions and 624,203 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Empty file added .git-blame-ignore-revs
Empty file.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
*.tmpl eol=lf
*.tmpl.inc eol=lf
*.inl eol=lf
*.bat eol=crlf
*.txt eol=lf
*.bat eol=crlf
23 changes: 18 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,26 @@ jobs:
# 2. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Debug, latest GCC compiler toolchain in the container, default generator>
# 4. <Linux, Release, latest GCC compiler toolchain in the container, default generator>
# 5. <MacOS, Debug, latest Clang compiler toolchain on the default runner image, default generator>
# 6. <MacOS, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 5. <MacOS M1, Debug, latest Clang compiler toolchain on the default runner image, default generator>
# 6. <MacOS M1, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 7. <MacOS x64, Debug, latest Clang compiler toolchain on the default runner image, default generator>
# 8. <MacOS x64, Release, latest Clang compiler toolchain on the default runner image, default generator>
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
build_type: [Debug, Release]
toolchain: [gcc, clang, msvc]
include:
- os: macos-latest
toolchain: clang
c_compiler: $(brew --prefix llvm@15)/bin/clang
cpp_compiler: $(brew --prefix llvm@15)/bin/clang++
c_compiler: clang
cpp_compiler: clang++
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
container: null
- os: macos-13
toolchain: clang
c_compiler: clang
cpp_compiler: clang++
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
container: null
Expand All @@ -54,6 +63,10 @@ jobs:
toolchain: msvc
- os: macos-latest
toolchain: gcc
- os: macos-13
toolchain: msvc
- os: macos-13
toolchain: gcc
- os: ubuntu-latest
toolchain: msvc
- os: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
path = third_party/libc++abi/src
url = https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi
gclient-condition = dawn_standalone
[submodule "third_party/libdrm/src"]
path = third_party/libdrm/src
url = https://chromium.googlesource.com/chromiumos/third_party/libdrm
gclient-condition = dawn_standalone and host_os == "linux"
[submodule "build"]
path = build
url = https://chromium.googlesource.com/chromium/src/build
Expand Down
162 changes: 105 additions & 57 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ set(USE_WAYLAND OFF)
set(USE_X11 OFF)
set(USE_WINDOWS_UI OFF)
set(BUILD_SAMPLES OFF)
set(BUILD_TESTS OFF)
set(TARGET_MACOS OFF)
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
# Only the samples are supported for Emscripten at the moment.
# TODO(crbug.com/42240181): Make dawn_end2end_tests work too.
set(ENABLE_EMSCRIPTEN ON)
set(BUILD_SAMPLES ON)
set(BUILD_TESTS ON)
set(ENABLE_NULL OFF)
elseif (WIN32)
set(ENABLE_D3D11 ON)
Expand Down Expand Up @@ -146,6 +148,24 @@ if (NOT ${DAWN_EMSCRIPTEN_TOOLCHAIN} STREQUAL "" AND ENABLE_EMSCRIPTEN)
set(DAWN_ENABLE_EMSCRIPTEN ON)
endif()

message(STATUS "Dawn build D3D11 backend: ${DAWN_ENABLE_D3D11}")
message(STATUS "Dawn build D3D12 backend: ${DAWN_ENABLE_D3D12}")
message(STATUS "Dawn build Metal backend: ${DAWN_ENABLE_METAL}")
message(STATUS "Dawn build Vulkan backend: ${DAWN_ENABLE_VULKAN}")
message(STATUS "Dawn build OpenGL backend: ${DAWN_ENABLE_DESKTOP_GL}")
message(STATUS "Dawn build OpenGL ES backend: ${DAWN_ENABLE_OPENGLES}")
message(STATUS "Dawn build Emscripten: ${DAWN_ENABLE_EMSCRIPTEN}")
message(STATUS "Dawn build Null backend: ${DAWN_ENABLE_NULL}")
message(STATUS "")
message(STATUS "Dawn enable SPIR-V validation: ${DAWN_ENABLE_SPIRV_VALIDATION}")
message(STATUS "")
message(STATUS "Dawn build with ASAN: ${DAWN_ENABLE_ASAN}")
message(STATUS "Dawn build with TSAN: ${DAWN_ENABLE_TSAN}")
message(STATUS "Dawn build with MSAN: ${DAWN_ENABLE_MSAN}")
message(STATUS "Dawn build with UBSAN: ${DAWN_ENABLE_UBSAN}")
message(STATUS "Dawn enable install: ${DAWN_ENABLE_INSTALL}")
message(STATUS "")

option(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
option(DAWN_USE_WAYLAND "Enable support for Wayland surface" ${USE_WAYLAND})
option(DAWN_USE_X11 "Enable support for X11 surface" ${USE_X11})
Expand All @@ -156,6 +176,7 @@ option(DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG "Enable DXC asserts in non-debug builds
option(DAWN_TARGET_MACOS "Manually link Apple core frameworks" ${TARGET_MACOS})

option(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" ${BUILD_SAMPLES})
option(DAWN_BUILD_TESTS "Enables building Dawn's tests" ${BUILD_TESTS})
option(DAWN_BUILD_NODE_BINDINGS "Enables building Dawn's NodeJS bindings" OFF)
option(DAWN_ENABLE_SWIFTSHADER "Enables building Swiftshader as part of the build and Vulkan adapter discovery" OFF)
option(DAWN_BUILD_BENCHMARKS "Build Dawn benchmarks" OFF)
Expand All @@ -167,6 +188,28 @@ option(DAWN_ENABLE_PIC "Build with Position-Independent-Code enabled" OFF)
option(DAWN_EMIT_COVERAGE "Emit code coverage information" OFF)
set_if_not_defined(LLVM_SOURCE_DIR "${Dawn_LLVM_SOURCE_DIR}" "Directory to an LLVM source checkout. Required to build turbo-cov")

message(STATUS "Dawn build with asserts in all configurations: ${DAWN_ALWAYS_ASSERT}")
message(STATUS "Dawn build Wayland support: ${DAWN_USE_WAYLAND}")
message(STATUS "Dawn build X11 support: ${DAWN_USE_X11}")
message(STATUS "Dawn build GLFW support: ${DAWN_USE_GLFW}")
message(STATUS "Dawn build Windows UI support: ${DAWN_USE_WINDOWS_UI}")
message(STATUS "Dawn build and use DXC: ${DAWN_USE_BUILT_DXC}")
message(STATUS "Dawn enable DXC asserts in non-debug builds: ${DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG}")
message(STATUS "Dawn target MacOS: ${TARGET_MACOS}")
message(STATUS "")
message(STATUS "Dawn build samples: ${DAWN_BUILD_SAMPLES}")
message(STATUS "Dawn build Node bindings: ${DAWN_BUILD_NODE_BINDINGS}")
message(STATUS "Dawn build Swiftshader: ${DAWN_ENABLE_SWIFTSHADER}")
message(STATUS "Dawn build benchmarks: ${DAWN_BUILD_BENCHMARKS}")
message(STATUS "Dawn build protobuf: ${DAWN_BUILD_PROTOBUF}")
message(STATUS "")
message(STATUS "Dawn build PIC: ${DAWN_ENABLE_PIC}")
message(STATUS "DAWN Werror: ${DAWN_WERROR}")
message(STATUS "")
message(STATUS "Dawn emit coverage: ${DAWN_EMIT_COVERAGE}")
message(STATUS "LLVM Source dir: ${LLVM_SOURCE_DIR}")
message(STATUS "")

if (DAWN_ENABLE_OPENGLES OR DAWN_ENABLE_DESKTOP_GL)
set(TINT_DEFAULT_GLSL ON)
else()
Expand All @@ -190,7 +233,6 @@ option(TINT_BUILD_HLSL_WRITER "Build the HLSL output writer" ${DAWN_ENABLE_D3D12
option(TINT_BUILD_MSL_WRITER "Build the MSL output writer" ${DAWN_ENABLE_METAL})
option(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" ${DAWN_ENABLE_VULKAN})
option(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON)

option(TINT_BUILD_SYNTAX_TREE_WRITER "Build the syntax tree writer" OFF)

if (DAWN_BUILD_PROTOBUF AND TARGET libprotobuf)
Expand All @@ -206,12 +248,43 @@ option(TINT_BUILD_BENCHMARKS "Build Tint benchmarks" OFF)
option(TINT_BUILD_TESTS "Build tests" ON)
option(TINT_BUILD_AS_OTHER_OS "Override OS detection to force building of *_other.cc files" OFF)

if (DAWN_ENABLE_EMSCRIPTEN)
# Skip tint tests in emscripten build
set(TINT_BUILD_TESTS OFF)
# Skip GLSL validation in Emscripten
set(TINT_BUILD_GLSL_VALIDATOR OFF)
endif()

option(TINT_BUILD_TINTD "Build the WGSL language server" OFF)

option(TINT_ENABLE_BREAK_IN_DEBUGGER "Enable tint::debugger::Break()" OFF)
option(TINT_CHECK_CHROMIUM_STYLE "Check for [chromium-style] issues during build" OFF)
option(TINT_RANDOMIZE_HASHES "Randomize the hash seed value to detect non-deterministic output" OFF)

message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}")
message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}")
message(STATUS "Tint build GLSL writer: ${TINT_BUILD_GLSL_WRITER}")
message(STATUS "Tint build GLSL validator: ${TINT_BUILD_GLSL_VALIDATOR}")
message(STATUS "Tint build HLSL writer: ${TINT_BUILD_HLSL_WRITER}")
message(STATUS "Tint build MSL writer: ${TINT_BUILD_MSL_WRITER}")
message(STATUS "Tint build SPIR-V writer: ${TINT_BUILD_SPV_WRITER}")
message(STATUS "Tint build WGSL writer: ${TINT_BUILD_WGSL_WRITER}")
message(STATUS "Tint build Syntax Tree writer: ${TINT_BUILD_SYNTAX_TREE_WRITER}")
message(STATUS "")
message(STATUS "Tint build command line executable tools: ${TINT_BUILD_CMD_TOOLS}")
message(STATUS "Tint install: ${TINT_ENABLE_INSTALL}")
message(STATUS "Tint build fuzzers: ${TINT_BUILD_FUZZERS}")
message(STATUS "Tint build IR binary: ${TINT_BUILD_IR_BINARY}")
message(STATUS "Tint build IR fuzzer: ${TINT_BUILD_IR_FUZZER}")
message(STATUS "Tint build benchmarks: ${TINT_BUILD_BENCHMARKS}")
message(STATUS "Tint build tests: ${TINT_BUILD_TESTS}")
message(STATUS "Tint build tintd: ${TINT_BUILD_TINTD}")
message(STATUS "")
message(STATUS "Tint enable break in debugger: ${TINT_ENABLE_BREAK_IN_DEBUGGER}")
message(STATUS "Tint build checking [chromium-style]: ${TINT_CHECK_CHROMIUM_STYLE}")
message(STATUS "Tint randomize hashes: ${TINT_RANDOMIZE_HASHES}")
message(STATUS "")

set_if_not_defined(DAWN_THIRD_PARTY_DIR "${Dawn_SOURCE_DIR}/third_party" "Directory in which to find third-party dependencies.")

set_if_not_defined(DAWN_ABSEIL_DIR "${DAWN_THIRD_PARTY_DIR}/abseil-cpp" "Directory in which to find Abseil")
Expand All @@ -223,30 +296,59 @@ set_if_not_defined(DAWN_SWIFTSHADER_DIR "${DAWN_THIRD_PARTY_DIR}/swiftshader" "D
set_if_not_defined(DAWN_PROTOBUF_DIR "${DAWN_THIRD_PARTY_DIR}/protobuf" "Directory in which to find protobuf")
set_if_not_defined(DAWN_LPM_DIR "${DAWN_THIRD_PARTY_DIR}/libprotobuf-mutator/src" "Directory in which to find libprotobuf")
set_if_not_defined(DAWN_EMDAWNWEBGPU_DIR "${DAWN_THIRD_PARTY_DIR}/emdawnwebgpu" "Directory in which to find Dawn specific Emscripten bindings")
set_if_not_defined(DAWN_GOOGLETEST_DIR "${DAWN_THIRD_PARTY_DIR}/googletest" "Directory in which to find googletest")

set_if_not_defined(DAWN_SPIRV_TOOLS_DIR "${DAWN_THIRD_PARTY_DIR}/spirv-tools/src" "Directory in which to find SPIRV-Tools")
set_if_not_defined(DAWN_SPIRV_HEADERS_DIR "${DAWN_THIRD_PARTY_DIR}/spirv-headers/src" "Directory in which to find SPIRV-Headers")
set_if_not_defined(DAWN_GLSLANG_DIR "${DAWN_THIRD_PARTY_DIR}/glslang/src" "Directory in which to find GLSLang")
set_if_not_defined(DAWN_VULKAN_HEADERS_DIR "${DAWN_THIRD_PARTY_DIR}/vulkan-headers/src" "Directory in which to find Vulkan-Headers")
set_if_not_defined(DAWN_VULKAN_UTILITY_LIBRARIES_DIR "${DAWN_THIRD_PARTY_DIR}/vulkan-utility-libraries/src" "Directory in which to find Vulkan-Utility-Libraries")

message(STATUS "Dawn third_party dir: ${DAWN_THIRD_PARTY_DIR}")
message(STATUS "Dawn GLFW dir: ${DAWN_GLFW_DIR}")
message(STATUS "Dawn Jinja2 dir: ${DAWN_JINJA2_DIR}")
message(STATUS "Dawn MarkupSafe dir: ${DAWN_MARKUPSAFE_DIR}")
message(STATUS "Dawn Khronos dir: ${DAWN_KHRONOS_DIR}")
message(STATUS "Dawn Swiftshader dir: ${DAWN_SWIFTSHADER_DIR}")
message(STATUS "Dawn Protobuf dir: ${DAWN_PROTOBUF_DIR}")
message(STATUS "Dawn LPM dir: ${DAWN_LPM_DIR}")
message(STATUS "Dawn Emdawnwebgpu dir: ${DAWN_EMDAWNWEBGPU_DIR}")
message(STATUS "Dawn Spir-Tools dir: ${DAWN_SPIRV_TOOLS_DIR}")
message(STATUS "Dawn Spirv-Headers dir: ${DAWN_SPIRV_HEADERS_DIR}")
message(STATUS "Dawn Glslang dir: ${DAWN_GLSLANG_DIR}")
message(STATUS "Dawn Vulkan Headers dir: ${DAWN_VULKAN_HEADERS_DIR}")
message(STATUS "Dawn Vulkan Utility Libraries dir: ${DAWN_VULKAN_UTILITY_LIBRARIES_DIR}")
message(STATUS "")

# Dependencies for DAWN_BUILD_NODE_BINDINGS
set_if_not_defined(NODE_ADDON_API_DIR "${DAWN_THIRD_PARTY_DIR}/node-addon-api" "Directory in which to find node-addon-api")
set_if_not_defined(NODE_API_HEADERS_DIR "${DAWN_THIRD_PARTY_DIR}/node-api-headers" "Directory in which to find node-api-headers")
set_if_not_defined(WEBGPU_IDL_PATH "${DAWN_THIRD_PARTY_DIR}/gpuweb/webgpu.idl" "Path to the webgpu.idl definition file")
set_if_not_defined(GO_EXECUTABLE "go" "Golang executable for running the IDL generator")

option(DAWN_FETCH_DEPENDENCIES "Use fetch_dawn_dependencies.py as an alternative to using depot_tools" OFF)
message(STATUS "Node Addon API dir: ${NODE_ADDON_API_DIR}")
message(STATUS "Node API Headers dir: ${NODE_API_HEADERS_DIR}")
message(STATUS "Webgpu IDL path: ${WEBGPU_IDL_PATH}")
message(STATUS "Go exe: ${GO_EXECUTABLE}")
message(STATUS "")

option(DAWN_FETCH_DEPENDENCIES "Use fetch_dawn_dependencies.py as an alternative to using depot_tools" OFF)
option(DAWN_BUILD_MONOLITHIC_LIBRARY "Bundle all dawn components into a single shared library." ON)

message(STATUS "Dawn fetch dependencies: ${DAWN_FETCH_DEPENDENCIES}")
message(STATUS "Dawn build monolithic library: ${DAWN_BUILD_MONOLITHIC_LIBRARY}")
message(STATUS "")

# Optional path to Emscripten toolchain to allow for building WASM.
set_if_not_defined(DAWN_EMSCRIPTEN_TOOLCHAIN "" "Directory in which to find Emscripten toolchain")
set(DAWN_ENABLE_EMSCRIPTEN OFF)
if (NOT ${DAWN_EMSCRIPTEN_TOOLCHAIN} STREQUAL "" AND ENABLE_EMSCRIPTEN)
set(DAWN_ENABLE_EMSCRIPTEN ON)
endif()

message(STATUS "Dawn Emscripten toolchain: ${DAWN_EMSCRIPTEN_TOOLCHAIN}")
message(STATUS "")

# Much of the backend code is shared among desktop OpenGL and OpenGL ES
if (${DAWN_ENABLE_DESKTOP_GL} OR ${DAWN_ENABLE_OPENGLES})
set(DAWN_ENABLE_OPENGL ON)
Expand Down Expand Up @@ -285,57 +387,6 @@ include(DawnCompilerWarningFlags)
include(DawnInitializeBuildType)
include(DawnLibrary)

message(STATUS "Dawn build D3D11 backend: ${DAWN_ENABLE_D3D11}")
message(STATUS "Dawn build D3D12 backend: ${DAWN_ENABLE_D3D12}")
message(STATUS "Dawn build Metal backend: ${DAWN_ENABLE_METAL}")
message(STATUS "Dawn build Vulkan backend: ${DAWN_ENABLE_VULKAN}")
message(STATUS "Dawn build OpenGL backend: ${DAWN_ENABLE_DESKTOP_GL}")
message(STATUS "Dawn build OpenGL ES backend: ${DAWN_ENABLE_OPENGLES}")
message(STATUS "Dawn build Emscripten: ${DAWN_ENABLE_EMSCRIPTEN}")
message(STATUS "Dawn build Null backend: ${DAWN_ENABLE_NULL}")

message(STATUS "Dawn enable SPIR-V validation: ${DAWN_ENABLE_SPIRV_VALIDATION}")

message(STATUS "Dawn build with asserts in all configurations: ${DAWN_ALWAYS_ASSERT}")
message(STATUS "Dawn build Wayland support: ${DAWN_USE_WAYLAND}")
message(STATUS "Dawn build X11 support: ${DAWN_USE_X11}")
message(STATUS "Dawn build GLFW support: ${DAWN_USE_GLFW}")
message(STATUS "Dawn build Windows UI support: ${DAWN_USE_WINDOWS_UI}")
message(STATUS "Dawn build and use DXC: ${DAWN_USE_BUILT_DXC}")
message(STATUS "Dawn enable DXC asserts in non-debug builds: ${DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG}")

message(STATUS "Dawn build samples: ${DAWN_BUILD_SAMPLES}")
message(STATUS "Dawn build Node bindings: ${DAWN_BUILD_NODE_BINDINGS}")
message(STATUS "Dawn build Swiftshader: ${DAWN_ENABLE_SWIFTSHADER}")
message(STATUS "Dawn build benchmarks: ${DAWN_BUILD_BENCHMARKS}")

message(STATUS "Dawn build PIC: ${DAWN_ENABLE_PIC}")

message(STATUS "Dawn build with ASAN: ${DAWN_ENABLE_ASAN}")
message(STATUS "Dawn build with TSAN: ${DAWN_ENABLE_TSAN}")
message(STATUS "Dawn build with MSAN: ${DAWN_ENABLE_MSAN}")
message(STATUS "Dawn build with UBSAN: ${DAWN_ENABLE_UBSAN}")

# We don't build Tint when building with Emscripten so silence these messages.
if (NOT ${DAWN_ENABLE_EMSCRIPTEN})
message(STATUS "Tint build command line executable tools: ${TINT_BUILD_CMD_TOOLS}")
message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}")
message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}")
message(STATUS "Tint build GLSL writer: ${TINT_BUILD_GLSL_WRITER}")
message(STATUS "Tint build GLSL validator: ${TINT_BUILD_GLSL_VALIDATOR}")
message(STATUS "Tint build HLSL writer: ${TINT_BUILD_HLSL_WRITER}")
message(STATUS "Tint build MSL writer: ${TINT_BUILD_MSL_WRITER}")
message(STATUS "Tint build SPIR-V writer: ${TINT_BUILD_SPV_WRITER}")
message(STATUS "Tint build WGSL writer: ${TINT_BUILD_WGSL_WRITER}")
message(STATUS "Tint build Syntax Tree writer: ${TINT_BUILD_SYNTAX_TREE_WRITER}")
message(STATUS "Tint build fuzzers: ${TINT_BUILD_FUZZERS}")
message(STATUS "Tint build IR binary: ${TINT_BUILD_IR_BINARY}")
message(STATUS "Tint build IR fuzzer: ${TINT_BUILD_IR_FUZZER}")
message(STATUS "Tint build benchmarks: ${TINT_BUILD_BENCHMARKS}")
message(STATUS "Tint build tests: ${TINT_BUILD_TESTS}")
message(STATUS "Tint build checking [chromium-style]: ${TINT_CHECK_CHROMIUM_STYLE}")
endif()

set(IS_ASAN ${DAWN_ENABLE_ASAN})

if (NOT ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS} STREQUAL "")
Expand Down Expand Up @@ -423,11 +474,8 @@ set(BUILD_SHARED_LIBS_SAVED ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS 0)

add_subdirectory(src/utils)
add_subdirectory(src/tint)

# Only build Tint when we are not building under Emscripten.
if (NOT ${DAWN_ENABLE_EMSCRIPTEN})
add_subdirectory(src/tint)
endif()
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_SAVED})

if (DAWN_ENABLE_D3D11 OR DAWN_ENABLE_D3D12 OR DAWN_ENABLE_METAL OR DAWN_ENABLE_NULL OR DAWN_ENABLE_DESKTOP_GL OR DAWN_ENABLE_OPENGLES OR DAWN_ENABLE_VULKAN OR DAWN_ENABLE_EMSCRIPTEN)
Expand Down
Loading

0 comments on commit d850c2a

Please sign in to comment.