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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>