Commit Graph

81 Commits

Author SHA1 Message Date
Stephen White 21ce5d2965 Split #defines for OpenGL and OpenGL ES backends.
This permits enabling the OpenGL and OpenGL ES backends independently.
This change also enables the OpenGL ES backend on Windows.

This will cause the end2end tests to run on OpenGL ES on the
GPU-less bots, via SwANGLE.

Bug: dawn:580

Change-Id: I43d514b18862d176610b95e97013a67723ddac20
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50881
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-05-17 18:04:48 +00:00
陈俊嘉 02336e6f99 Add UWP support
Add necessary cflags and cflags_cc for winrt compilation.
Add 'dawn_is_winuwp'.
Set 'dawn_enable_vulkan' and 'dawn_supports_glfw_for_windowing' when compiling for UWP.
Link d3d12, d3d11 and dxgi stub libs when compiling for UWP.
Use LoadPackagedLibrary instead of LoadLibraryA in DynamicLib when compiling for UWP.

Swapchain related changes will be in another commit.

Bug: dawn:766
Change-Id: I1210798a21cc175bab77281403d262d4bfb02d99
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48480
Commit-Queue: 陈俊嘉 <cjj19970505@live.cn>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
2021-04-23 02:16:12 +00:00
Corentin Wallez a0bdba1dfc Make Dawn's Tint version visible when recursedepsing in Dawn
Bug: tint:700
Change-Id: I24b862822ca728afa7aebead53c8eb07e9cdc440
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46622
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-04-01 23:42:23 +00:00
Corentin Wallez 9037669b2e Remove the dependency on shaderc and glslang.
With all tests converted to WGSL we only use shaderc to assemble SPIRV
assembly to binary. shaderc requires glslang but we don't use it at all.
By using SPIRV-Tools directly to assemble SPIR-V, we can remove both the
shaderc and glslang dependencies.

Bug: dawn:572
Bug: chromium:1150045
Change-Id: I1588428dfb9478e7b724478bec662d002ee920e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45765
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-24 16:02:13 +00:00
Austin Eng be621bd0e6 Update the wire-based fuzzers to always assume an injected error
This also removes the ability for the fuzzer to perform error
injection to generate testcases. The preferred method is to
use one of the Dawn test binaries to produce the trace directly.

Bug: dawn:629
Change-Id: If7295f9e6da5618be8f44e9301aa12dc56fcdfef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40301
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-03-23 16:47:50 +00:00
Corentin Wallez a9439199b7 Use Tint/WGSL unconditionally
Bug: dawn:706
Change-Id: I102c37e67e7833bb7441ed8a355a4411bd7b9fb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45421
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-03-22 21:23:36 +00:00
Corentin Wallez 92a0588ac8 Enable WGSL unconditionally in GN builds.
Bug: dawn:706
Change-Id: I1fdd0f8e61710f3375b6b2fb0152acdff4569528
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44862
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-16 19:17:19 +00:00
Stephen White 77fcdf7eaa Add ANGLE to Dawn build.
Bug: dawn:447, dawn:580
Change-Id: I77726651ca00d64768bddc0bb476fd920e11851f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35081
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-11 15:52:12 +00:00
Stephen White f1fa60b912 Use Jamie's 7-layer burrito of Vulkan DEPS.
This allows us to roll all Vulkan- and SPIRV-related dependencies
simultaneously (which are often inter-dependent).

This change also implicitly rolls the dependencies to the revs in ANGLE.

Change-Id: I50a1e5b2ef706ffbfbc22f5783321820bb50ae96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36500
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-06 17:41:50 +00:00
Corentin Wallez a7278454b2 Make dawn_use_x11 = use_x11 when building inside Chromium
The variable use_x11 in Chromium takes into account more thinks like
whether we are building in LaCrOS mode and more. If we don't do this,
compilation of Chromium fails when Dawn tries to include X11/Xlib.h

Bug: chromium:976495
Change-Id: I8b4e865f50f60235466c8ba72683927124aa094e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30220
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-10-15 14:30:23 +00:00
Hidehiko Abe 948b3a0555 Expand is_linux to is_linux || is_chromeos.
Currnetly ,is_linux GN variable is set to true on Chrome OS build,
but it is planned to be set false. This CL is the preparation
to keep the bahavior compatible.

Bug: chromium:1110266
Test: Build locally.
Change-Id: Iffbfafe3ac5b00899804afa7471a04709046610a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28340
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
2020-09-11 02:24:16 +00:00
Ryan Harrison c4c4ff9eb4 Enable WGSL support by default
Explictly turned off for Skia, since it does not yet have Tint in its DEPS.

Roll third_party/tint/ e8c12f32f..c5cd8f5bd (3 commits)

https://dawn.googlesource.com/tint/+log/e8c12f32f9a9..c5cd8f5bd382

$ git log e8c12f32f..c5cd8f5bd --date=short --no-merges --format='%ad %ae %s'
2020-07-28 rharrison Remove binutils from DEPS and pull in changes to build.gni from Dawn
2020-07-28 rharrison Get 'gn gen --check' passing
2020-07-28 idanr Fix Tint ninja build

Created with:
  roll-dep third_party/tint

BUG=tint:123

Change-Id: Icd26c2d1b7329c94afa6f23c5c057de8efaee3e8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25523
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-07-28 21:57:18 +00:00
Corentin Wallez 8bd3bcf434 Revert "Turn on WGSL support by default in Dawn"
This reverts commit e1d976ed91.

Reason for revert: crbug.com/tint/123

Original change's description:
> Turn on WGSL support by default in Dawn
> 
> Tint is available in Chromium now, so we can turn this on. For situations were
> WGSL support is not needed it can still be turned off via args.gn.
> 
> Roll third_party/tint/ 16890b9ce..13904a612 (15 commits)
> 
> https://dawn.googlesource.com/tint/+log/16890b9ce8b7..5f43fedcd
> 
> $ git log 16890b9ce..5f43fedcd --date=short --no-merges --format='%ad %ae %s'
> 2020-07-16 rharrison Clean up how deps are defined in BUILD.gn
> 2020-07-16 dsinclair Remove refs.cfg.
> 2020-07-16 dsinclair Fixup group list name
> 2020-07-16 dsinclair [msl-writer] Emitting of program constants.
> 2020-07-16 dsinclair [msl-writer] Fixup matrix and array constructors.
> 2020-07-16 dsinclair Differentiate size and stride in array type name.
> 2020-07-16 dneto [spirv-reader] Support duplicate type definitions
> 2020-07-15 dsinclair [msl-writer] Add struct offset support.
> 2020-07-15 dsinclair [msl-writer] Add builtin support
> 2020-07-15 dsinclair Add helpers for referenced variables.
> 2020-07-15 dsinclair [msl-writer] Refactor some entry point variable code.
> 2020-07-15 dsinclair [msl-writer] Generate entry point functions.
> 2020-07-14 dsinclair [msl-writer] Handle emitting user function calls.
> 2020-07-14 dsinclair Inherit refererenced globals up the call stack.
> 2020-07-14 dsinclair [msl-writer] Generate input/output structs
> 
> Created with:
>   roll-dep third_party/tint
> 
> Change-Id: Ia437e8dc309b06a64ddd4d91ec3af1499af13553
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24920
> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
> Reviewed-by: dan sinclair <dsinclair@chromium.org>
> Reviewed-by: Ryan Harrison <rharrison@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,dneto@google.com,rharrison@chromium.org,dsinclair@chromium.org

Change-Id: I21513d5b5d461eccd42aa650fa4b46e85daf642f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-22 14:34:49 +00:00
Ryan Harrison e1d976ed91 Turn on WGSL support by default in Dawn
Tint is available in Chromium now, so we can turn this on. For situations were
WGSL support is not needed it can still be turned off via args.gn.

Roll third_party/tint/ 16890b9ce..13904a612 (15 commits)

https://dawn.googlesource.com/tint/+log/16890b9ce8b7..5f43fedcd

$ git log 16890b9ce..5f43fedcd --date=short --no-merges --format='%ad %ae %s'
2020-07-16 rharrison Clean up how deps are defined in BUILD.gn
2020-07-16 dsinclair Remove refs.cfg.
2020-07-16 dsinclair Fixup group list name
2020-07-16 dsinclair [msl-writer] Emitting of program constants.
2020-07-16 dsinclair [msl-writer] Fixup matrix and array constructors.
2020-07-16 dsinclair Differentiate size and stride in array type name.
2020-07-16 dneto [spirv-reader] Support duplicate type definitions
2020-07-15 dsinclair [msl-writer] Add struct offset support.
2020-07-15 dsinclair [msl-writer] Add builtin support
2020-07-15 dsinclair Add helpers for referenced variables.
2020-07-15 dsinclair [msl-writer] Refactor some entry point variable code.
2020-07-15 dsinclair [msl-writer] Generate entry point functions.
2020-07-14 dsinclair [msl-writer] Handle emitting user function calls.
2020-07-14 dsinclair Inherit refererenced globals up the call stack.
2020-07-14 dsinclair [msl-writer] Generate input/output structs

Created with:
  roll-dep third_party/tint

Change-Id: Ia437e8dc309b06a64ddd4d91ec3af1499af13553
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24920
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-07-21 15:43:44 +00:00
Kai Ninomiya 82961129b0 Use canned CheckPatchFormatted instead of our own linting
This calls into git cl format, so it should always be consistent with
that.

Removes all the old clang-format scripts and dependencies.

Change-Id: I879577a5c1df81617ec0d33096ce7884f4413659
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24840
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-07-15 20:47:57 +00:00
Kai Ninomiya 01aeca22a9 Add .clang-format files and format more files
The .clang-format files tell clang-format to ignore certain directories
(replacing code in lint_clang_format.sh which will be removed).

$ git ls-tree -r master --name-only | grep '\.\(c\|h\|cpp\|gn\|gni\|mm\|m\|py\)$' | xargs ./append-space-to-files
$ git checkout -- generator/templates third_party/khronos/{KHR,vulkan}
$ git cl format --full --python

Followed by manual reformatting of a few things in Python for
readability.

Bug: none
Change-Id: I4c9e472cc9a5cd80c07286e808f4e597cfef5428
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24785
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-15 19:51:17 +00:00
Kai Ninomiya 3d80b5c378 lint_clang_format.sh: Un-skip tests and examples
These were previously skipped because clang-format was messing up our
builder-pattern code. But we got rid of the builder pattern long ago.

The actual files will be autoformatted in the next CL.

Bug: none
Change-Id: Ia01a2cabc2daa9d94a15bf44687bc2e5801b49bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24621
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-10 19:41:38 +00:00
Ryan Harrison 92554d75f3 Update path of third_party/spirv-tools to SPIRV-Tools
Change-Id: Id0ee4940c7cec255558bcca3bfa578ee4bdb87ab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24421
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-07-06 21:31:00 +00:00
Ryan Harrison a84ab48150 Add support for different default branches in roll-shader-deps
tint has moved to using origin/main, and shaderc is soon to migrate

Change-Id: I578e4df91330351e10513874b2ca2728e4227803
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-06-17 23:52:19 +00:00
Jiajie Hu 3e332cd475 Set a default value for dawn_glm_dir like other GN build overrides
Bug: dawn:437
Change-Id: Iffdb281df32a506b1cf21823d27ee18710427457
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22102
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiajie Hu <jiajie.hu@intel.com>
2020-05-27 01:33:33 +00:00
Ryan Harrison 4f3811c064 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>
2020-05-07 21:15:55 +00:00
Ryan Harrison 991b947173 Add Tint to DEPS for standalone checkouts
BUG=dawn:386

Change-Id: I0f518bed7e81e4d42ed2a1ef154738d9e8fa4a9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-05-06 23:15:54 +00:00
Sean Gilhuly c9e28b1463 Use dawn_has_build in dawn_component
//build/config/gcc:rpath_for_built_shared_libraries is being pulled in
on Skia Linux builds. Don't include it if //build isn't present.

Bug: chromium:1072449
Change-Id: I92f2d0ae0b4325ae672a86d6a38caf241929b65b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20320
Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-23 16:24:42 +00:00
Corentin Wallez 59382b7d3f Use python3 for all of Dawn's python scripts
Bug: dawn:389
Change-Id: I5034ab2791f0cca0b7690eae5f4d7f4e6efc4bd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19863
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 20:43:07 +00:00
Corentin Wallez 0925720ecb Add the Vulkan loader as an optional dependency and use it on Mac
On macOS we can't rely on having the Vulkan loader installed in the
system. So we add the Vulkan loader as an optional dependency of Dawn
and use it on macOS when building Dawn in standalone with Vulkan
support.

Usage of building our own loader might broaden if the loader gains
features that are useful on other OSes. For example the ability to pass
in the "root ICD" entrypoint to the loader so we can have both
Swiftshader and the system driver at the same time.

Bug: dawn:388

Change-Id: I7ade4961cce0463c66846ad17aebf95224f1afcc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19723
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 08:22:25 +00:00
Corentin Wallez b31015b836 Split examples, test and utils in their own BUILD.gn
The basic change was to copy-paste targets in the new BUILD.gn files and
fixup paths / add includes. There's a couple more changes that had to be
done at the same time:

 - Multiple files need to know if GLFW is supported so the variable was
moved to dawn_features.gni.
 - The gtest_and_gmock target used to abstract between Dawn's copy of
GTest/GMock is only needed by tests and was moved in src/tests/BUILD.gn.
 - A leftover dawn_end2end_tests target is left in the main BUILD.gn
file that is an exact copy of the on in src/tests/BUILD.gn. This is
because the GN path is hardcoded in Chromium's isolate_map.pyl that also
can't support GN groups. The only way to move a target I could figure
out was to duplicate it temporarily.

Bug: chromium:1064305
Change-Id: I96820e9d6510b8c9b9112c3e6cd8df2413f04287
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19201
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-10 08:20:10 +00:00
Corentin Wallez 6574f92747 Fix the @rpath of dawn_components
When the libdawn_native target was renamed to dawn_native, the output
library name stayed the same (GN inserts a lib prefix if it isn't
present) but the @rpath annotation changed to be just dawn_native.dylib.

Fix this by adding the lib prefix in the rpath annotation. This requires
changing libdawn_proc to dawn_proc otherwise the rpath annotation would
be liblibdawn_proc.dylib.

Bug: dawn:380
Change-Id: Id8610a6318af3468dcc486ee8d3c035f0273fe0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-04-09 17:31:40 +00:00
Zhenyao Mo d9d9d1ec73 Make the Vulkan Validation Layers an optional dependency.
The build_overrides directory for the VVL will default to "" which
causes support for them to be skipped if the dependents don't set the
dawn_vulkan_validation_layers_dir variable.

Bug: chromium:1064305
Change-Id: I0a31f5d1d55982b5c953ce8ac6542d38829eedb5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19085
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@google.com>
2020-04-08 20:00:12 +00:00
Corentin Wallez 30ec4fc626 Fixes to be able to build Dawn inside Skia
Add a dawn_has_build override similarly to angle_has_build that makes
Dawn not depend on Chromium //build if it can avoid it. (this was
previously used for mac_sdk.gni).

Only load the Vulkan Validation Layers' gni if it is enable via
dawn_enable_vulkan_validation_layers.

Fix a GN build warning where the source of dawn_components would be
built twice: for example libdawn_native.MetalBackend.o would be built
once for libdawn_native static and once for libdawn_native shared. Fix
this by making libdawn_native as a static library libdawn_native_static.

Change-Id: Ib8fb72282435eb475d7a11dae0d5a9977572fd57
Bug: chromium:1064305
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18963
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-07 19:35:47 +00:00
Bryan Bernhart 4b1be08ec9 perf_tests: Update perf_test_runner format.
CL#14740 modified the result format but
the test runner script was never updated.
This fixes the result format and metric check.

Bug: dawn:208
Change-Id: I3a128b91e20ff8629b091ef4bf8fdd6fb616ba0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17921
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-03-26 17:46:25 +00:00
Austin Eng eb1ca45df7 Fix Vulkan fuzzer on mac_libfuzzer_chrome_asan
This commit fixes two problems:
1) It includes testing/libfuzzer/libfuzzer_exports.h which exports
   the LLVMFuzzerInitialize symbol. On Mac, not doing so causes it
   to be removed by the linker.
2) It makes it so that dawn_use_swiftshader is enabled by default
   when fuzzing, and enabling swiftshader also enables the Vulkan
   backend.

Bug: chromium:1042426
Change-Id: Ic0ae0d59c91476b0079148f33a4b1ebd1cc6743c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15462
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-25 02:14:39 +00:00
Corentin Wallez 3a1746e71c Introduce wgpu::Surface and implement it for HWND, X11 and Metal
This is another step to implement webgpu.h swapchains, Surface is
essentially a union type of all the types of windows that can be used to
create swapchains.

Changes to allow implementing wgpu::Surface and test its creation are:

 - Add GLFWUtils.cpp/.h/_metal.mm  that contains helpers used to use
WebGPU with GLFW. This deprecates BackendBinding.h that will be removed
when the NXT swapchain is removed.
 - Add a `dawn_use_x11` GN variable to factor all the places in BUILD.gn
where we checked whether we should use X11.
 - Add a `supports_glfw_for_windowing` GN variable in the main BUILD.gn
file to control which configuration tests and samples using GLFW can be
built.
 - Add a ObjCUtils.h to contain some ObjC functionality that we'd need
in files that otherwise would be C++ (so that they can be compiled on
all platforms).

Bug: dawn:269

Change-Id: I25548142a1d1d1f05b0f4d71aa3bdc4698d19622
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15081
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-15 13:14:12 +00:00
Austin Eng c3609d224a Reland "Use Swiftshader by default when fuzzing"
This is a reland of d08a14b709

It gates dawn_use_swiftshader on dawn_enable_vulkan because the
Vulkan backend isn't supported on Mac. We may support Swiftshader
Vulkan on Mac in the future, but that will first require changes
to how we initialize the Vulkan backend.

Original change's description:
> Use Swiftshader by default when fuzzing
>
> Note: This still requires Chromium to have set dawn_swiftshader_dir
> to take effect.
>
> Bug: dawn:295
> Change-Id: I0c953196630dd2694f68d290e6f3f1e427c20a2f
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14821
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:295
Change-Id: Ia125005b35951021702104a99a78712bcd47dd1e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14941
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-08 22:59:47 +00:00
Austin Eng 9b2712456f Revert "Use Swiftshader by default when fuzzing"
This reverts commit d08a14b709.

Reason for revert: This breaks the Mac fuzzer builds because it tries
to build with Swiftshader without Vulkan enabled. Reverting this now
to unblock the roll while I work on a fix.

Original change's description:
> Use Swiftshader by default when fuzzing
> 
> Note: This still requires Chromium to have set dawn_swiftshader_dir
> to take effect.
> 
> Bug: dawn:295
> Change-Id: I0c953196630dd2694f68d290e6f3f1e427c20a2f
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14821
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:295
Change-Id: I7b73d5edc844e090d5d2c8efe9efacc60040463e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-08 18:16:47 +00:00
Austin Eng 470921fe46 Reland "fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer"
This is a reland of f58f69f66b

The whitebox dawn_end2end_tests are updated to link statically against
libdawn_native. This is required because the test link against and use
libdawn_native as sources. It is an error with MSVC to both import and
export symbols from libdawn_native.

Original change's description:
> fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer
>
> This option will be used by backends that support error injection so
> that errors can be injected into a "clean" corpus to generate a seed
> corpus with good examples of injected error conditions.
>
> Bug: dawn:295
> Change-Id: I837acdde6dd4274adb56edf8e4307427f8d6333b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14681
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:295
Change-Id: Ifa092d28aa7ac57cfb197aa4daeb8408f8036d4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14820
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-06 19:56:17 +00:00
Austin Eng d08a14b709 Use Swiftshader by default when fuzzing
Note: This still requires Chromium to have set dawn_swiftshader_dir
to take effect.

Bug: dawn:295
Change-Id: I0c953196630dd2694f68d290e6f3f1e427c20a2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14821
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-06 19:42:47 +00:00
Austin Eng 87d3138158 Revert "fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer"
This reverts commit f58f69f66b.

Reason for revert: This breaks the MSVC build because the whitebox end2end tests try to both import and export the error injector symbols from libdawn_native

Original change's description:
> fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer
> 
> This option will be used by backends that support error injection so
> that errors can be injected into a "clean" corpus to generate a seed
> corpus with good examples of injected error conditions.
> 
> Bug: dawn:295
> Change-Id: I837acdde6dd4274adb56edf8e4307427f8d6333b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14681
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org

Change-Id: I14a15fcd094d431cbb8a29d5642a4a7fe6a11f4c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:295
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14741
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-20 23:07:40 +00:00
Austin Eng 2cb76ab598 perf_tests: Manually serialize JSON and remove dependency on jsoncpp
jsoncpp causes some flaky failures because of inconsistencies in nested
DEPS. We barely use it for JSON serialization so the simplest solution
is to just manually write the serialization for perf test tracing data.

Bug: dawn:208
Change-Id: Ie5e4b5436e2c9e32e6817d64c6e95c774cb8751f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-20 19:39:10 +00:00
Austin Eng f58f69f66b fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer
This option will be used by backends that support error injection so
that errors can be injected into a "clean" corpus to generate a seed
corpus with good examples of injected error conditions.

Bug: dawn:295
Change-Id: I837acdde6dd4274adb56edf8e4307427f8d6333b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-20 15:52:20 +00:00
Austin Eng 5e98e38744 fuzzing: Remove download of existing testcases in seed corpus script
ClusterFuzz already has facilities to minimize testcases daily. It is
not necessary to do so in our update script.

Bug: dawn:295
Change-Id: I9869d25f657b40f1af1aac90c27200a59f46b9c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14621
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-18 00:35:06 +00:00
Austin Eng 6ea362cae0 fuzzing: Add error injection macros to the Vulkan backend
This will enable fuzzing the Vulkan backend with randomly injected
errors to help ensure the backend properly handles all errors. It also
redefines VkResult in the dawn_native::vulkan namespace such that a
VkResult cannot be used unless it is explicitly wrapped.

Bug: dawn:295
Change-Id: I3ab2f98702a67a61afe06315658a9ab76ed4ccc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14520
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-17 00:47:40 +00:00
Austin Eng 97fb51f4af Add script to generate fuzzer seed corpus from tests
This adds a script which runs the end2end_tests, captures a wire trace,
and then minimizes the corpus with the fuzzer. Minimizing the corpus
requires libfuzzer, so this only works in a Chromium checkout.

Unseeded, the fuzzer starts with coverage of about 600 features.
Using a seed corpus captured from the tests, the fuzzer quickly
increases coverage to about 10,000 features.

Change-Id: I8d0db5121745bd5ee4a350cf46fb37cfa434e3dc
Bug: dawn:295
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14242
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-13 01:27:31 +00:00
Corentin Wallez 673146475f Allow compilation of Dawn on Android
BUG=dawn:286

Change-Id: Ia65b57fde12a1260d29913f61f9b24eded7dbc30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13822
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-28 09:40:54 +00:00
Corentin Wallez 74cebd6879 Allow using swiftshader with the Vulkan backend
This adds swiftshader as a dependency of Dawn, and when it is present
dawn_use_swiftshader=true will force usage of it. (due to a Vulkan
loader limitation we can't have both regular drivers and swiftshader in
the same VkInstance).

BUG=dawn:283

Change-Id: Ib94f4dcca652eb380e994f007cdcfb145b1a5102
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-26 18:21:51 +00:00
Ryan Harrison 80d71ecd12 Remove build rules for spvc support & spirv-cross fuzzers
Disabling this while refactoring how dependencies are set up to avoid
breaking various builds and rolls.

BUG=dawn:285

Change-Id: Iaca2614fb73277a1ea850f90a487693cd4c54fcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-26 17:42:51 +00:00
Ryan Harrison 48bf745b96 Revert "Convert spvc build flag to a runtime toggle"
This reverts commit 1954436fe2.

Reason for revert:
The shaderc side of this multi-patch brings in a dependency on glslang, which uses a static initializer, which chromium doesn't like.

Original change's description:
> Convert spvc build flag to a runtime toggle
> 
> Also moves some of the spirv_cross code into the main library that was
> feature guarded, since spvc requires it.
> 
> BUG=dawn:281
> 
> Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,rharrison@chromium.org

Change-Id: Ia9a025fb4440c96874d1b45776a9f97023ca591d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13941
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-21 20:31:05 +00:00
Ryan Harrison 1954436fe2 Convert spvc build flag to a runtime toggle
Also moves some of the spirv_cross code into the main library that was
feature guarded, since spvc requires it.

BUG=dawn:281

Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 18:08:15 +00:00
Brian Ho 858f93b86f Disable Vulkan validation layers on Chrome OS
An earlier CL [1] enabled Vulkan validation layers on Linux which
also enables validation layers on Chrome OS. Unfortunately, this
changes breaks the Chrome OS build of Dawn:

.../vulkan.h:63:10: fatal error: 'xcb/xcb.h' file not found

This is because including the validation layers also includes
the Vulkan-Headers repo which has a BUILD file that defines
VK_USE_PLATFORM_XCB_KHR [2]. XCB (and all of X11, for that matter)
is not supported on Chrome OS even though it is a Linux platform.

This is a quick fix for the problem to unbreak the BUILD, but I
think we should discuss what a long-term fix looks like. Do we send
a patch to Khronos to add an "is_chromeos" branch to their BUILD
file a la Fuchsia?

Also, as mentioned by cwallez@ in a different CL of mine, we should
really set up a Chrome OS trybot to catch these earlier. I can
assign a bug to myself for that!

[1] https://dawn-review.googlesource.com/c/dawn/+/13787
[2] https://github.com/KhronosGroup/Vulkan-Headers/blob/master/BUILD.gn#L23

Change-Id: Ic5fb4fa7990cc2232a7416145877e24b10a2a7b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13880
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
2019-11-20 20:31:31 +00:00
Ryan Harrison 8f3dc5836b Add in flag for using spvc instead of direct spriv-cross access
Currently does nothing interesting, future CLs will flesh out the
functionality.

BUG=dawn:281

Change-Id: I89750a45ff5a42a13e1494cafd433bb7ef719b10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13841
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-20 18:10:11 +00:00
Jiajie Hu 9e5b9edb43 Enable Vulkan validation layers on Linux
When vkDestroyDebugReportCallbackEXT() is called in Backend::~Backend()
and Vulkan validation layers are in use, the variable unique_id_mapping
is referenced internally[1]. However, the variable is global[2] and it's
destructed before Backend::~Backend(), which causes a use-after-free
issue. The issue was unnoticed on Windows, but we observed the crash at
exit on Linux.

[1] 9fba37afae/layers/generated/layer_chassis_dispatch.cpp (4961)
[2] 9fba37afae/layers/generated/chassis.cpp (40)

Bug: dawn:150
Change-Id: I505373a88ef9795243dd18da9785fb49d253e498
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13787
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-20 09:45:41 +00:00