Commit Graph

141 Commits

Author SHA1 Message Date
Ben Clayton d1c6f83341 CMake: Massage CMakeLists for use by NodeJS bindings
Allow the third_party directory to be controlled by the outer sub-project.

Change-Id: I11030c75254c264c1955150bdf1983771b33b614
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64500
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-20 19:47:05 +00:00
Shrek Shao 2f8f2518e5 Revert "Added Abseil as a third-party dependency"
This reverts commit 020d69905e.

Reason for revert: Causing Dawn Skia roll build fails

https://task-scheduler.skia.org/job/AZXXBm9h9ozj3kKiRJM5

Original change's description:
> Added Abseil as a third-party dependency
>
> Using the version in the Chromium repo in order to make use of the .gn
> files it contains.
>
> Doing so also appears to require us to switch where we pull googletest
> from so that the directory structure matches what the Abseil build
> config expects. Fortunately this doesn't seem to cause issues in our
> tests.
>
> Bug: dawn:563
> Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Auto-Submit: Brandon Jones <bajones@chromium.org>

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

Bug: dawn:563
Change-Id: I0fc4e5fc73ab9b0887591135ec01adde990edd6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64361
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-09-15 19:22:19 +00:00
Brandon Jones 020d69905e Added Abseil as a third-party dependency
Using the version in the Chromium repo in order to make use of the .gn
files it contains.

Doing so also appears to require us to switch where we pull googletest
from so that the directory structure matches what the Abseil build
config expects. Fortunately this doesn't seem to cause issues in our
tests.

Bug: dawn:563
Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
2021-09-14 16:56:15 +00:00
Alastair Donaldson 6a1eb45961 Adapt fuzzer CMake rules for OSS-Fuzz
Refactors the CMake rules for the tint fuzzers so that when OSS-Fuzz is
controlling the build process no specific fuzzer options are used. This
allows OSS-Fuzz to fully control the fuzzing engine.

Change-Id: Ic4423b981df12e66a14ca8f53c97168ac28bfa39
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63342
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-09-02 23:49:25 +00:00
Antonio Maiorano 0eaee0cda2 CMake: add TINT_BUILD_SAMPLES option (default ON)
If enabled, will build targets in the samples subfolder, which currently
only includes the "tint" executable.

Bug: tint:1140
Change-Id: I354d9b6e39ca2cd243649effedaebe3e0b97fc2f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-08-31 18:43:36 +00:00
egj cc6d5b464d Add regex fuzzer
A fuzzer that mutates a WGSL code by finding two regions enclosed by
semicolons and swapping them randomly.

Change-Id: I5b14eb21fd2924227d05ac516f806c6e2efa6198
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58395
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-07-28 11:11:26 +00:00
Alastair Donaldson 66b979d7fb Override CMake cache for fuzzer options
Enabling particular fuzzers requires that certain other CMake options
are enabled. For example, enabling the SPIR-V Tools fuzzer requires
enabling the CMake option for building spirv-fuzz. This change uses the
FORCE parameter to force the CMake cache to be overridden in such cases.
The change also adds FORCE to other options where it seems appropriate,
and improves some doc strings associated with CMake options.

Fixes: tint:1024
Change-Id: Ia72ddc0b3af625bb21ff1cc1c7121185ec3908b6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59204
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-07-22 10:14:34 +00:00
Vasyl Teliman c6bcab02fd Implement AST fuzzer
This change implements a new fuzzer. It mutates a WGSL shader by traversing
the AST of a program and applying various transformations that might or might not
be semantics preserving.

Change-Id: I6b144bd1067444c3f0b815ba1a646aaf6e739b52
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52160
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Alastair Donaldson <allydonaldson@googlemail.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-13 12:01:25 +00:00
Ben Clayton 54cfa0b9a1 [tools]: Add remote-compile
A tool for compiling shaders on a remote machine.
Helpful for combining with `test-all`, so that a single non-windows
machine can validate SPIR-V, MSL and HLSL.

Change-Id: I3a0f70e6e4edd13952eb5dc72fbbed7c495036ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56940
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-08 19:35:53 +00:00
Sergey Karchevsky 3a75b1cea8 CMake: update backend selection
The single DAWN_ENABLE_OPENGL flag in the root CMakeLists.txt did not define
DAWN_ENABLE_BACKEND_DESKTOP_GL or DAWN_ENABLE_BACKEND_OPENGLES, so examples
with `-b opengl` reported `Backend isn't present` and failed to start.

ENABLE_OPENGL flag in root CMakeLists.txt was replaced by ENABLE_DESKTOP_GL
and ENABLE_OPENGLES flags, repeating the logic of similar flags
in GN buildsystem as done in src/common/BUILD.gn
and scripts/dawn_features.gni.

Change-Id: I6302de7aa98436ddc0aa002d83dd6b3e7102e49c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56283
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Sergey K <sergey.ext@gmail.com>
2021-06-30 15:06:43 +00:00
陈俊嘉 610de1d725 CMake: couple fixes for UWP
Fix a capitalization error in CMakeLists.txt
Link dxgi.lib only in UWP compilation in CMakeLists.txt

Bug: dawn:766
Change-Id: I011f44c8147998a9f4b3a55b25888ca1ad05a3e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-06-28 08:19:28 +00:00
Antonio Maiorano e25a8fc7f0 Doxygen: set warning format for MSVC builds
When using Visual Studio (MSVC), have Doxygen output its warnings with
the file/line prefix in the MSVC standard, so that double-clicking on
the warnings brings you to the right source location.

Change-Id: If492f83a651cf6d4a38186c9e36ffcb57f1d72ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55801
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-25 14:53:06 +00:00
Antonio Maiorano 6241f962a1 Kokoro-Linux: fail on Doxygen warnings
Change-Id: Ib85e835ea70fd84a3cb4be03e7ff5afdd7782a82
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55641
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-25 14:00:36 +00:00
Vasyl Teliman 0b3611b8c8 Add spirv-tools fuzzer
This change adds a new tint fuzzer that uses SPIRV-Tools to fuzz SPIR-V binaries.
The fuzzer works on a corpus of SPIR-V shaders. For each shader from the corpus it uses
one of `spirv-fuzz`, `spirv-reduce` or `spirv-opt` to mutate and then runs the shader through
the Tint compiler in two steps:
- Converts the mutated shader to WGSL.
- Converts WGSL to some target language specified in the CLI arguments.

The list of all supported CLI arguments and their description is in the cli.h file.

Change-Id: I95c0741b78ccc600dd9a73c371d520bdf7814352
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41945
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Alastair Donaldson <allydonaldson@googlemail.com>
2021-06-24 18:10:46 +00:00
陈俊嘉 b2bc57ad22 Add UWP compilation support in CMake
Set BUILD_EXAMPLE to OFF in UWP.
Disable Vulkan in UWP.
Compile GLFW related sources only on supported platform.
Remove linking to user32.lib in UWP.
Add linking to dxgi.lib only in debug configuration.
Use EmptyDebugLogger in UWP.

Bug: dawn:766

Change-Id: I3e6149058048d1b597267dfb9d63342b6a54e0af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/55260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-06-24 07:00:16 +00:00
Ben Clayton 4ace822c4b Kokoro: Check lint and doxygen
Move the doxygen CMake output from `out/docs` to `<build>/docs`
`out/docs` requires a GN build or manual directory creation.

Fixed: tint:791
Change-Id: If072f962f444a2d60c368d7c38fd1bb4c5b97caf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50309
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-12 08:15:41 +00:00
Antonio Maiorano 5bdece5583 CMake: try to match Clang warning options when building with clang-cl on Windows
Change-Id: I24d6201adfd356f791458393d69be0b088814a0f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-04-27 19:24:47 +00:00
Ben Clayton 7687ec1fa3 Kokoro: Test that the _other.cc files also build
Change-Id: I908b9250de839435c3b355fb89b0bb72ab821a54
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48043
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-04-16 14:43:34 +00:00
Antonio Maiorano c6aa48e4ea CMake: disable "no-used-but-marked-unused" Clang warning
This warning arises when using gtest SCOPED_TRACE. Chromium doesn't
enable -Weverything, which is why the GN build doesn't produce this
warning.

Bug: tint:680
Change-Id: Ie90ea3b9378a1864165bfd889286071d9c0b88c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-03-31 23:39:46 +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
Antonio Maiorano 88d3d2e1de CMake: fix clang-cl builds on Windows
Broke this in https://dawn-review.googlesource.com/c/tint/+/45621
We don't want /MP enabled for clang-cl builds as this results in an
unused parameter /MP warning.

Also opportunistically clean up CMake script a little.

Bug: tint:665
Change-Id: I4047b75332c1aa64b32b695dfe050c255009e922
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45820
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-03-23 20:51:09 +00:00
Antonio Maiorano e547605da7 Fix msvc build and enable multiprocessor builds
Disable warning C4324: 'struct_name' : structure was padded due to
__declspec(align())

Multiprocessor builds are not enabled by default when using msbuild,
unlike for Ninja builds.

Bug: tint:665
Change-Id: I0e50c88ac91acd963c31c07cbbf2fae6b743e77d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45621
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-03-23 14:03:58 +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
Antonio Maiorano d600972e49 CMake: fix warnings on msvc builds
Remove /W3 from default flags, and disable a couple of warnings:

C4127: conditional expression is constant
C4458: declaration of 'identifier' hides class member

These match our warning settings of Clang/GCC more closely.
Also fix some valid warnings in some tests.

Change-Id: I46cb30b93ece74039db4aa0d6b52a675ee36859d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44960
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-03-17 13:32:54 +00:00
Antonio Maiorano ac39fb44bb CMake: bump warning level from 3 to 4 for msvc builds
This enables, among other things, warnings on unused variables, which
matches our default Clang and GCC builds.

Change-Id: I3f405b1a5c30e428542cd72d50f07910e477cea6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44880
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-03-16 15:05:33 +00:00
Ben Clayton 6341fa5801 CMake: Remove TINT_ENABLE_SHARED_CRT
And if tint is being built as a sub-project of another project, default to not building documentation or tests.

See dawn-review.googlesource.com/c/dawn/+/43961.

Change-Id: I1133511822efe3d1fc35675ed599de76914d1881
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44045
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-03-09 13:55:37 +00:00
Ben Clayton e879143801 Pull Is() out of castable and into a new TypeInfo
Allows you to query type inheritance without having an instance of the type.

Also add TypeInfo::name. Helpful for decent error messages. Strings can be removed from NDEBUG builds if we consider them too large.

Change-Id: Ie501b37f46e63d956cc020f8c9b68e91737472f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42920
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-03-02 20:30:08 +00:00
J-P Nurmi b3c4cc09a0 Fix typo: vulkan_deps vs. vulkan-deps
Change-Id: Ifad31bb254f2f1d6d72338ef1f68c34e6ba4de86
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36721
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-07 10:35:02 +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 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