Commit Graph

163 Commits

Author SHA1 Message Date
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 99d6c14a3b CMake: set DAWN_ENABLE_WGSL to ON by default.
Bug: dawn:605
Change-Id: Ie18e438b4db81c5197290afd02fb7392196cd1c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35283
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-09 15:13:57 +00:00
Corentin Wallez f3717fa249 CMake: Add a flag to control whether to built tint_unittests
Bug: dawn:605
Change-Id: I03860c263746939112e03544fbc3579631423c37
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35282
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-12-09 14:47:30 +00:00
Ben Clayton ed2b97811e ast: Add Module.Clone()
Deep-clones all `Node`s and `Type`s into a new module.

Instead of writing a million standalone tests that'll only ever test the
existing fields of each type, I've opted to write the tests using
wgsl<->ast<->wgsl conversion. This means the tests require the enabling
of TINT_BUILD_WGSL_READER and TINT_BUILD_WGSL_WRITER, but I believe this
is much easier to maintain.

I'm aware there are probably gaps in the tests, and that even full
coverage is likely to rapidly rot, so I've also added
fuzzers/tint_ast_clone_fuzzer.cc - a fuzzer based test that ensures that
all AST modules can be cloned with identical reproduction.

I've run this across 100 cores of a 3990x for 4 hours, fixing the
single issue it detected.

Note: Expressions do not currently clone their `TypeManager` determined
types. This is for two reasons:
(a) This initial CL is mahoosive enough.
(b) I'm uncertain whether we actually want to clone this info, or to
    re-run the `TypeDeterminer` after each AST transform. Maybe it should
    be optional. Time will tell.

Fixed: tint:307
Change-Id: Id90fab06aaa740c805d12b66f3f11d1f452c6805
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33300
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-12-01 18:04:17 +00:00
Ben Clayton adb10d60de Add option and target for generating code cov info
The new `tint-generate-coverage` CMake target can be used with the clang toolchain to generate a `lcov.info` file at the root of the project, along with a `coverage.summary` human readable plain text file.

The `lcov.info` file can then be used by various tools to display code coverage information in your IDE / code editor.

Useful for ensuring decent test coverage.

Change-Id: I3d846f6da3af25d3d600d8e028f27b89e35b545f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31121
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-10-27 21:04:59 +00:00
David Neto 762b7c3457 Fix CMake build when building examples
Add subdirectory src/utils only once.

Change-Id: I3437e0a4c9ff250f4518ce485763117291889cd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31103
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-10-27 19:38:27 +00:00
dan sinclair f6fdcb1114 Set target defines PUBLIC.
This CL sets the target defines as PUBLIC so downstream CMakeFiles can
correctly setup the defines when including the tint headers

Change-Id: Idcb38761ed73ecda652945287ff096a11e7b2b01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30840
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-10-23 17:04:10 +00:00
dan sinclair bb3d7981ec CMake updates.
This CL updates the CMake file to allow building Dawn with WGSL support
enabled. A few other required fixes are included.

Bug: None
Change-Id: I11a09710f0ad075a07e23c44ff884826850655e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30841
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-10-23 13:10:20 +00:00
dan sinclair 1877c27c98 Remove HOMEPAGE_URL from cmake project.
The HOMEPAGE_URL is a CMake 3.12ism, and seems to cause some issues on
3.10

Change-Id: I567bd86bb86db7d383efcde8526e57ce8714844f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-10-20 19:46:21 +00:00
Corentin Wallez e557087870 CMakeLists: make DAWN_THIRD_PARTY_DIR an option.
Also output more context when failing to run the code generator.

Bug: None
Change-Id: I6685c062a074ad11a8fd67f19b8698ce9bcf6694
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-10-20 14:26:10 +00:00
dan sinclair b8d90ead93 Move visibility=hidden directive.
This CL moves the visibility=hidden directive from the top level applied
flags to libtint specifically. This fixes up an issue between
SPIRV-Tools and the sample app when using std::rfind which ends up with
different visibility.

Change-Id: Ib06949b3755db66027d3656d3d6ce2504bfda81e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29460
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-10-06 15:11:17 +00:00
Ryan Harrison b07cb63896 Add SPIR-V Reader Fuzzer
Also clean up the mess I made of the build rules, so they actually work.

BUG=tint:57

Change-Id: I9c92d043a7be8f51ed7885a29eb153f078cc66d9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26125
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-30 21:24:29 +00:00
dan sinclair feffa9d887 [hlsl-writer] Scaffold the HLSL backend.
This CL adds the scaffolding for the HLSL backend.

Bug: tint:7
Change-Id: Iaf9f5159bc409f3ac71fcec281229258bdfa021b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25000
Reviewed-by: David Neto <dneto@google.com>
2020-07-20 22:13:37 +00:00
dan sinclair b0391c6fa4 [msl-writer] Add struct offset support.
This CL adds support for injecting padding into structs in the MSL
backend.

Bug: tint:8
Change-Id: I83631a71ce4a2f00b61974ee2c0c7ca1b97f3028
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24601
Reviewed-by: David Neto <dneto@google.com>
2020-07-15 20:54:48 +00:00
David Neto 5b46d71ae7 Enable Tint as part of a larger CMake project
- Add googletest and spirv-tools local builds only if their CMake targets
  are not already configured.
- Add local spirv-headers as an include directory only if the associated
  CMake directory does not already point to a directory.

Change-Id: I53ebb0d8fdf7703e8219000b78c75c30859c91a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24020
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-06-26 22:29:27 +00:00
dan sinclair 2a59901483 [metal-writer] Stub out the Metal Shading Language backend.
This CL adds the basis of the Metal Shading Language backend.

Bug: tint:8
Change-Id: I85976250eb41ac12203a5db116444e993c3d09d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23700
Reviewed-by: David Neto <dneto@google.com>
2020-06-23 17:48:40 +00:00
Ryan Harrison be45ff5081 Create tint.h for external users
tint.h selectively includes headers depending on what features are enabled. It
is based off of the original sample code, so should give users access to all of
the functionality demonstrated in there.

This is located in include/tint/, so that users can have a pretty include of
tint/tint.h.

BUG=tint:87

Change-Id: I8659c789c154349e4e8e7730dc334da4fb6eba70
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23124
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-06-11 19:35:20 +00:00
dan sinclair 6ca2699eaf Windows fixes.
This CL fixes up some issues which give compile errors when building
with Visual Studio.

Change-Id: Ib76644d869dd2adccd579621d18804d84b65a74c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20940
Reviewed-by: David Neto <dneto@google.com>
2020-05-04 18:58:24 +00:00
Ryan Harrison 563d3e9975 Add support for running [chromium-style] checks in CMake builds
Adds a new option to insert the needed flags, as well instructions on
how to run the checks to README.md.

BUG=tint:62

Change-Id: Id154555c4846f1dea29bad1fba5a3cd73ac7fb04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20540
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-28 19:27:38 +00:00
Ryan Harrison 13a652963c Rename tint_fuzz to tint_wgsl_reader_fuzzer
This is in anticipation of future fuzzer implementations.

BUG=tint:56

Change-Id: I73492c135bed7d5bee9c114ec336a837b4f447ac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20243
Reviewed-by: David Neto <dneto@google.com>
2020-04-23 13:51:39 +00:00
Ryan Harrison 3170bebba1 Fix building fuzzer
BUG=tint:53

Change-Id: I0462baf302d5183b089dbdfd595045f8376f7a53
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20145
Reviewed-by: David Neto <dneto@google.com>
2020-04-22 00:25:10 +00:00
Corentin Wallez 42450c6d1c Fix the CMake build because of CMP0077
Prior to CMake 3.12 option() is a cache variable operation which meant
that the overriding of third_party project variables in
third_party/CMakeLists.txt needs to write to the cache.

Also remove a couple extra commas that were causing warnings.

Bug: None
Change-Id: I35efce70cf3e0cb923ebdbad654b2b9883b8f734
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-10 17:04:31 +00:00
dan sinclair b595052ea3 Set root folder for linter.
This CL sets the root folder to be used by the linter when determining
header guards.

Bug: tint:23
Change-Id: I52ce8d3cd67e9882d4ea8a2c9cbd2d5d5650d5b7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17205
Reviewed-by: David Neto <dneto@google.com>
2020-03-19 13:03:35 +00:00
dan sinclair 4b71b9ed2b Expand build flags for Tint.
This CL extends the build options to Tint to make the various readers
and writers all optional.

Change-Id: I913e1830b1bb2243eff5deb4b8079ba592dd52e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16801
Reviewed-by: David Neto <dneto@google.com>
2020-03-18 14:08:48 +00:00
dan sinclair e4392c9ab5 Create SPIR-V writer skeleton.
This CL creates the skeleton for the SPIR-V writer.

Bug: tint:5
Change-Id: I849d8766d32d48314a51096710272f9821e2c1c4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16641
Reviewed-by: David Neto <dneto@google.com>
2020-03-17 21:00:22 +00:00
dan sinclair 37dbf99e34 Always define TINT_BUILD_SPV_PARSER.
This CL always sets the define for building the SPV_PARSER. This fixes
undefined errors on certian platforms.

Change-Id: I5f84295cb7ddf23d64efd9a4d00717c84bc698aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16800
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-03-11 18:43:12 +00:00
David Neto bbd8987e71 Instantiate a stubbed SPIR-V parser if file ends in .spv
- spv parser just errors out for now
- link against SPIRV-Tools-opt
- Fixe CMake variable TINT_ENABLE_SPV_PARSER --> TINT_BUILD_SPV_PARSER

Bug: tint:3
Change-Id: Ie4ef9b03e001fca3cc11f65a425612755857feac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16600
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:12 +00:00
Dan Sinclair 6e581895a5 Initial commit 2020-03-02 15:47:43 -05:00
Corentin Wallez 33466973bc CMake: Add support for the D3D12 backend
Bug: dawn:333
Change-Id: I61defcd7d5a66fc728c92d1e702ed09b5c84968f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16000
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-24 13:27:28 +00:00
Corentin Wallez d353ca0881 CMake: Add support for the Vulkan backend
Bug: dawn:333
Change-Id: Id509e5f06862d6fee517ef47c40418077ccf4759
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15941
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-02-18 02:12:35 +00:00
Corentin Wallez 7fe6efba4a Add initial CMakeLists.txt files
Adds CMake support for:
 - Generating the Dawn headers and C++ wrappers
 - libdawn_wire
 - libdawn_native with the Metal backend for now
 - All the examples.

Bug: dawn:333

Change-Id: I6ffbe090b0bd21d6a805c03a507ad51fda0275ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15720
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2020-02-05 17:16:05 +00:00
Corentin Wallez 146edf5bec Remove support for CMake builds
This also removes support for Travis and AppVeyor, as well as git
submodules for dependencies.

It also adjusts .gitignore to include dependencies (submodules are
implicitly ignored but are removed in this commit).

Finally, removes some CMake-specific code from the code generator.

BUG=

Change-Id: I4ebc04e530a574b412ef0ca81e4672db01f0ed92
Reviewed-on: https://dawn-review.googlesource.com/c/2040
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-10-31 10:53:11 +00:00
Corentin Wallez f9f44ae289 Update which backends are enabled by default
This changes the Vulkan backend to be enabled by default on Windows and
Linux as well as changes the OpenGL backend to be disabled by default on
OSX.
2018-08-02 13:39:07 +02:00
Corentin Wallez bdc867713a Make dawn_wire a shared library
Also moves the TerribleCommandBuffer to utils:: because it isn't part of
the implementation of the wire, renames dawn::wire to dawn_wire, moves
src/wire to src/dawn_wire and puts the interface of dawn_wire in
src/include/dawn_wire.
2018-07-30 17:22:45 +02:00
Corentin Wallez 012c149fd9 Build with nortti/exceptions and fvisibility=hidden
This both makes the CMake build closer to the Chromium build, and
reduces the binary size heavily.
2018-07-30 17:22:45 +02:00
Corentin Wallez 5dcaadb0f9 Make libdawn a shared library, add a DAWN_EXPORT macro 2018-07-25 21:03:49 +02:00
Corentin Wallez 6c27fd9c94 CMakeLists: Generate Dawn headers separately from libdawn
libdawn will be one of the libraries produced but other libraries like
libdawn_native don't need to link against it. However they do need the
Dawn headers so we generate them separately.

This also makes all internal targets depend on the header generation and
have the include directories necessary for those headers.

Also has a small fix for setting compile flags only for C++ files.
2018-07-25 21:03:49 +02:00
Corentin Wallez deb5d33643 Multithread compilation of Dawn targets on MSVC 2018-07-25 21:03:49 +02:00
Corentin Wallez d37523fbde Move src/backend to src/dawn_native 2018-07-25 11:27:55 +02:00
Corentin Wallez fde3f2b5e0 Rename NXT -> Dawn in the rest of CMakeLists 2018-07-18 22:54:06 +02:00
Corentin Wallez d148aebf3f Rename CMakeLists targets nxt -> dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez f1ded9bea2 Rename CMakeLists variables NXT_* to DAWN_* 2018-07-18 22:54:06 +02:00
Corentin Wallez 4a9ef4ee21 Rename the copyright authors from NXT to Dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez b1341db700 Add a NXT_NO_DISCARD that is C++17 [[nodiscard]] where available 2018-05-31 15:00:28 -04:00
Corentin Wallez 00935daffc Use shaderc_shared and don't build unnecessary targets
This should speed up compilation on Travis a little bit.
2017-12-12 01:02:35 -05:00
Kai Ninomiya 8e587e8b42 MSVC: /EHsc to silence a warning and maybe even improve performance 2017-09-15 14:02:02 -07:00
Kai Ninomiya fc9775f7df .gitignore + disable in-source builds (#98) 2017-08-03 11:45:12 -07:00
Kai Ninomiya 78c8b837ea clang/gcc: enable a bunch more warnings (#91)
* clang/gcc: enable -pedantic warnings

* suppress a GCC-specific warning in stb_image

* And some clang-specific warnings

* -Wconversion (clang) -Wold-style-cast (clang+gcc)

and fix a few warnings that show up with these (and a few more with
-Wconversion on gcc, even though that's not enabled by default)

* bunch more warnings

* fixes

* remove merge error
2017-07-21 17:00:22 -07:00
Kai Ninomiya 59dc03f101 Correctly configure NXT_ENABLE_ASSERTS on multiconfiguration generators (#88)
And also set a default build type for single-configuration generators
2017-07-20 07:28:00 -07:00
Corentin Wallez 28684d93ed Fix CMake OS dependent default options.
The defaults were setting local variables, while the "option" command
uses the values from the CMake cache. This made the CI not build the
D3D12 or Metal backend on their platforms.
2017-07-14 14:06:12 -04:00
Corentin Wallez 4db6327f78 Use WIN32_LEAN_AND_MEAN on Windows
This makes Windows.h includes less headers that we don't want and will
help with compilation.
2017-07-13 14:55:23 -04:00
Corentin Wallez 275817a93a Add proper defines for backend enablement 2017-07-13 14:55:23 -04:00
Corentin Wallez 3df6441a8c Group the target sources for the VS solution explorer 2017-07-11 13:59:15 -04:00
Corentin Wallez 0f833f30ed Enable warnings on Windows 2017-07-11 13:59:15 -04:00
Corentin Wallez 6fb3aebf0c Better namespace CMake folders for Visual Studio
This helps Visual Studio users have less clutter in their solution
explorer. This also updates spirv-tools to a newer version that folders
itself. This also updates spirv-headers so that spirv-tools compiles.
2017-07-11 13:59:15 -04:00
Corentin Wallez fd589f3919 Add an internal ASSERT macro
This macro has some advantages over the standard library one:
 - It prints the place where the macro was triggered
 - It "references" the condition even in Release to avoid warnings
 - In release, if possible, it gives compiler hints

It is basically is stripped down version of the ASSERT macros I wrote
for the Daemon engine in src/common/Assert.h

This commit also removes the stray "backend" namespaces for common/
code.
2017-07-10 19:35:21 -04:00
Corentin Wallez bd0594bab8 Enable warnings on non-MSVC 2017-07-10 19:35:21 -04:00
Corentin Wallez fffe6dfa16 Split backend/common in backend/ and common/
This directory used to contain both the state tracking code for the
backends, and the common utilities that could be used both by the
backends and the rest of the code. Things are now:

 - src/common is utility code for the whole repo
 - src/backend contains libNXT's code
 - src/utils is utility code that we don't want in libNXT

This commit also changes all includes to use global paths from src/
bacause it had to touch a bunch of #include statements anyway.
2017-07-06 17:54:52 -04:00
Corentin Wallez 1bd219d8a8 Split BackendBinding from example/Utils into src/utils
This will make it possible to reuse the backend bindings for test suites
2017-06-20 07:40:17 -07:00
Corentin Wallez 944b60fb75 Fix compilation on Windows
There are still a bunch of warning that we should remove.
2017-05-30 10:48:32 -07:00
Corentin Wallez 26275d0a16 Make all libraries STATIC for now
For shared library to work on Windows to work, we need to add
declspec(export) and declspec(import) annotations to the symbols to
export. This fixes the problem by making all libraries static on
Windows, but we'll need to revisit and do proper symbol exports.
2017-05-30 10:48:32 -07:00
Corentin Wallez 0a58812f34 Consolidate unittests in one binary 2017-05-19 10:41:36 +02:00
Corentin Wallez f07e3bd4c9 Initial commit of all the NXT integration.
More like squashed history, contributors were:
 - Kai Ninomiya
 - Corentin Wallez
2017-04-20 14:38:20 -04:00