Commit Graph

2965 Commits

Author SHA1 Message Date
Ryan Harrison 5f5d43ff51 Disallow copy and assign for DataBuilder & RandomGenerator
BUG=tint:1247

Change-Id: I48f7b1e1679bcba43e4c284b2f97a02210feabb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66740
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-10-18 18:46:57 +00:00
emiljanogj 8045166b16 Remove RandomGenerator destructor
Defining a destructor for the RandomGenerator would
throw an error when calling the copy constructor of
the class.

Change-Id: I1cff86cb75b2e252a52e3fbd03ecb08e7a11b519
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66181
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-10-18 00:53:27 +00:00
Stephen White 540992ba90 Fix storage buffer structs, test output.
Bug: tint:1223
Change-Id: Idbf8f882f44a7bc3dc51bd046d48da3b78a609e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-15 19:52:50 +00:00
David Neto 186618dfef add test for tint::utils::ReplaceAll
The new test proves that the algorithm needs to advance 'pos'
past the replacement string.

Change-Id: Ia8fdf6b2c08d6af09e8e631c1d8661752edcb7ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66660
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-15 19:24:10 +00:00
Ben Clayton 153f09e29c CMakeLists: Make it easier to override options
When using Tint as a subproject of another CMake project.

Change-Id: I4acdc2d2965b2fa770101c8a21ad23d8dba9adcc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66604
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-15 19:10:50 +00:00
Ben Clayton 8c9458271c ast: Simplify SizeExprToString()
Clean up as recommended in review:
https://dawn-review.googlesource.com/c/tint/+/66380/6/src/ast/array.cc#34

Change-Id: I70d66ab552de4a4a4d869aedd2f3c3d9f59d2712
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66603
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-10-15 18:45:40 +00:00
Stephen White 9e631b1645 GLSL: add gl_ reserved words.
Bug: tint:1221
Change-Id: I13985c9a8807af625bc0801740294227f0d50b13
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66361
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-10-15 18:44:20 +00:00
Ben Clayton 2bd1321133 ast: Remove pointless deleted copy constructors
ast::Node has a deleted copy constructor, so the derived classes cannot be implicitly copied.

Change-Id: I57f74a4ab35dd00b3290b964cb6492f4fa4505a5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66602
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-15 17:40:39 +00:00
Ben Clayton 4f3ff57c28 ast: Keep style consistent
Methods and functions are `CamelCase()`
Public fields are `snake_case` with no trailing `_`
Private fields are `snake_case` with a trailing `_`

Remove pointless getters on fully immutable fields.
They provide no value, and just add `()` noise on use.

Remove unused methods.

Bug: tint:1231
Change-Id: If32efd039df48938efd5bc2186d51fe4853e9840
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66600
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-10-15 17:33:10 +00:00
James Price b3e6c0d62c validation: Reject nested shader IO structures
We previously rejected nested structures for entry point IO only if
there was an attribute on the member in the outer struct. This change
rejects all nested structures instead.

Change-Id: I0d30c8521141154a63915e6c6d8fa31bc23f310e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66520
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-10-15 14:55:39 +00:00
Ben Clayton 5029e70b6e ast: Remove helpers from ast::Type
These are legacy methods that were written before the semantic type nodes.

These methods do not consider aliases, and any use of these is likely to be broken for aliases.

Fix up uses of these methods to use the semantic types instead.

Change-Id: Ia66749b279eddff655d3d755fef54a6263643e69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66601
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-15 14:17:31 +00:00
Ben Clayton 4dfa394a3c ProgramID: Move hot code out of template function
This is causing code bloat. Move common code out to a single function that's implemented in the .cc file.
Saves about 25k from the all-features-enabled Release build of tint for x64.

Bug: tint:1226
Change-Id: Idc2fef1b9ca92a2f48dfc5e252a3853721d048aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66447
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-15 13:46:50 +00:00
Ben Clayton c40d15d5da resolver: Apply some missing explicit casts
These constructor parameters of StructMember take a uint32_t.
The compiler will normally warn / error about this, but there's some quirk of std::make_shared that makes the compiler silence this warning (possibly because the constructor call is in the STL?).

Was noticed when experimenting with BlockAllocator::Create() to reduce binary size.

Change-Id: I8cdf5078150927e5624752ee7374305c0a5982f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66448
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-14 22:43:21 +00:00
David Neto a6969c4359 wgsl-reader: Hex float exponents are optional
Fixed: tint:1210
Change-Id: I4256494e3ca3f98082f360e0447d0392964073bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66040
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-10-14 21:38:01 +00:00
Ben Clayton a095b26d17 CloneContext: Move hot code out of template members
This is causing code bloat. Move common code out to a single method that's implemented in the .cc file.
Saves about 10k from the all-features-enabled Release build of tint for x64.

Bug: tint:1226
Change-Id: I80b76e69521c3cc890c74b4bc73a68f1c9bdd3df
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66446
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-14 21:27:39 +00:00
Ben Clayton d1ee47a1cd ast: Remove to_str() and type_name()
This is no longer used.

Fixed: tint:1225
Change-Id: I0cfe9955687a2b7ded3e645c573f3bffbc2f1f84
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-14 21:25:49 +00:00
Ben Clayton a5b3f07ec7 reader/spirv: Test with WGSL writer intead of to_str()
This change replaces all the SPIR-V reader tests to their equivalent WGSL form.

Bug: tint:1225
Change-Id: Idf0e6050f49fad0a8223b50bac89014dbdcf9b2b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66444
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-14 21:22:19 +00:00
Ben Clayton 1364f202da Remove more uses of AST to_str() and type_name()
These methods are going to be removed as they provide little benefit over the WGSL form, are a maintainance burden and they massively bloat our codebase.

This change introduces sem::CallTargetSignature, which can be used as a std::unordered_map key.
This is used in writer/spirv to replace a map that was keyed off ast::Function::type_name().

Bug: tint:1225
Change-Id: Ic220b3155011f21b14d49eecc8042001148e4ca5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66443
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-14 21:17:29 +00:00
Ben Clayton 11ed0db30d resolver: Don't use ast to_str() methods
These return weird names that love the use of '__' and have little relation to WGSL.

Improve the duplicate case error message.

Clean up control_block_validation_test.cc by making used of the ProgramBuilder helpers.

Bug: tint:1225
Change-Id: I8c4cf3943145cf8372c00d33ae0166c0c0bcbb8b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66442
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-14 20:30:29 +00:00
Ben Clayton 262210f12b utils: Add ReplaceAll() string helper
Helpful for template string substitutions in tests, to reduce string concat noise.

Change-Id: I612084e2c267d93d79c92cf3ac0231b6b904f0e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66440
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-14 20:24:50 +00:00
Ben Clayton 89fb370b30 samples/main: Fix warning when TINT_BUILD_GLSL_WRITER==0
The compiler moans that the program and options parameters are not used, which can be treated as an error.

Change-Id: Idcc190204be42b722488e86a4cd354ff6a401eda
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66445
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-10-14 16:18:37 +00:00
Stephen White b281dd168d GLSL: implement atan2.
GLSL has no atan2() instrinsic, but a 2-parameter overloaded atan()
instead.

Bug: tint:1222
Change-Id: I368b3989117cd329fea1020cd941daa0a69525cd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66360
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-14 16:17:38 +00:00
Ben Clayton 7f1c8d98c5 tools: Fix file regex in fix-tests
The old regex was not allowing numbers in the filenames.

Change-Id: Ic16de247f9caadefda6d6eb05896923ba4399ba5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66441
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-14 16:16:48 +00:00
Stephen White 2f963aaf82 More GLSL fixes.
Remove register-and-space decoration.
Add "main" to GLSL keywords, to force renaming.
Output correct compute width decoration (not numthreads).
Remove static keyword.

Bug: tint:1218 tint:1219 tint:1220
Change-Id: I171f183690b6531c76218414e0d81f6ef5e22e6b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66340
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-14 16:16:19 +00:00
Stephen White 7cf3b28a87 GLSL writer: validate all entry points with glslang.
Generate and validate all entry points individually.
This is required since GLSL has separate shader files, and
can only have a single "main" entry point.

Bug: tint:1217
Change-Id: Ie5cb510aaef3b7c8a7573f5fa9446815284afecb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61920
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-14 14:39:36 +00:00
Ben Clayton f3f2d0a218 Resolver: Remove texture_storage read access
The intrinsics that did anything useful with this were deprecated
several releases ago.

Change-Id: I79e3c901b6a78583853a067ec46cfa98e346517c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66262
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-14 10:10:45 +00:00
Ben Clayton 14fc622161 ast: Rename CallExpression::params() to args()
Arguments are the values passed to a function.
Parameters receive arguments.

Fixed: tint:811
Change-Id: I82fe71aa795b8b365bc78981e84c86b419eb3eb2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66263
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-14 09:51:14 +00:00
Ben Clayton 11c9656b14 docs: Fix origin trial number
The listed changes aren't going to land into M97, as M96 has already been cut.

Change-Id: I7b636bf7a6da3b831ad8f121acd0f8c3f87a1423
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66381
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-14 03:17:32 +00:00
Ben Clayton 2aa6855914 intrinsics: Remove deprecated modf & frexp overloads
These have been deprecated for multiple chrome releases.

Change-Id: I4cc05a74ff8f085e6d13f93aefb93077480e52f5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66261
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-12 21:57:47 +00:00
Ben Clayton d57a129810 reader/spirv: Remove stdout spam in tests
Change-Id: I06361ae5bb0f69b3ac66c3ddc22abb5988e4c4fe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66260
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-10-12 17:35:27 +00:00
Alastair Donaldson 8f780f1022 Choose black-box fuzzer back-end based on data
Instead of uploading separate black-box fuzzers for each target
language, it will be more convenient to have the target language chosen
based on the data file being processed. This change facilitates that.

Bug: https://crbug.com/1246587
Change-Id: I39f225835f8ca06cb8b8ea1c791b6c872f0f9d8f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66180
Auto-Submit: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-10-12 17:08:27 +00:00
Ryan Harrison 37a666d91c Add robustness pass to reader writer fuzzers
BUG=chromium:1255257,tint:1208

Change-Id: Ia5daeff8d839cbb7810bbbc12feab21039d0b681
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66060
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-10-12 14:41:20 +00:00
Ryan Harrison ce90ac52f4 Remove BoundArrayAccessors
BUG=tint:1212

Change-Id: I054bedb6f20ef18d70408087f774ef252403b49c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66100
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-07 21:55:21 +00:00
Alastair Donaldson d4b8f887a5 Remove injected bug
Removes an abort that was injected to confirm that a fuzzer target was
working.

Bug: https://crbug.com/1246587
Change-Id: Ibe5270eacb3dfa2832b5de4c1fcf7b220af91fcc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66121
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-10-07 18:20:29 +00:00
Sarah 7ff308fd18 cts: write test URL in url() instead of description
test name: from "... + section name" -> "section name + ..."

bug: tint:1203
Change-Id: Ic71f2cd3ef3e45d335f382dde93cc8694d998204
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65980
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-06 22:00:58 +00:00
Stephen White a9f8c7db81 Implement GLSL writer backend.
This is a modified version of the HLSL writer.
Basic types, arrays, entry points, reserved keywords, uniforms,
builtin uniforms, structs, some builtin functions, zero initialization
are implemented. Textures, SSBOs and storage textures in particular are
unimplemented. All the unit tests "pass", but the output is not correct
in many cases.

triangle.wgsl outputs correct vertex and fragment shaders that pass
GLSL validation via glslang. compute_boids.wgsl outputs a valid but not
correct compute shader.

Change-Id: I96c7aaf60cf2d4237e45d732e5f51b345aea0552
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57780
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-06 18:55:10 +00:00
Alastair Donaldson 08146e2300 Fixes for 32-bit build of fuzzers
This change resolves some type-related issues that were leading to
loss-of-precision warnings when compiling for i386 in OSS-Fuzz.

Change-Id: I77912d6b3824a0f942d0f54f1e62914f69e14d7d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66000
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-10-06 17:54:28 +00:00
Ryan Harrison 71763c84c2 Update remaining fuzzers to use TransforBuilder
Missed some fuzzers in my last fix, because I was trying to git grep
between repos...

This should fix any outstanding issues with
NULL being passed into SetTransformManager in TintCommonFuzzer.

BUG=chromium:1255313

Change-Id: Idf71bc34bb75041accec303df3da0bc6f9cd15cc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65940
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-10-05 19:19:26 +00:00
James Price ceab140a8b validation: Reject struct builtins on wrong stages
Change-Id: I047f28c5be6a7d878b9f7ad37b6accc842b4fe98
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65840
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-05 15:02:17 +00:00
Ryan Harrison add3cb000b Convert fuzzer to use TransformBuilder
Missed this fuzzer when implementing this class.

BUG=chromium:1255122

Change-Id: Ic5c7ef031db04a779734faeffa1d72d972dd2254
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65880
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-05 14:51:28 +00:00
Alastair Donaldson 8b2181c98f Change injected failure from assert to abort
An assertion failure had been injected to check that black box fuzzing
is working, but as ClusterFuzz runs a release mode build this was not
triggering. This change turns the assertion failure into an abort. Once
it has been established that the abort is triggered by the black box
fuzzers, it should be removed.

Bug: https://crbug.com/1246587
Change-Id: I5afcea97132e5a7f13df4ba353121deccc901e60
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65901
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-10-05 14:49:17 +00:00
Sarah 22daca166b cts: Change uniqueId() parameter to string. Add how-to-contribute to description.
- Update the spec version used to:
  https://www.w3.org/TR/2021/WD-WGSL-20210929/
- replace extra white spaces with "\s" instead of "\n"
- github PR: https://github.com/gpuweb/cts/pull/770

Bug: tint:1189
Change-Id: Ib8d0aaf57eac3fff4fd6943b4a3d2d0a691a9a0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-10-04 14:54:37 +00:00
Ryan Harrison 7f3b68edd5 Explictly use 64-bit random engine
Avoids downcasting issues for the seed on platforms where the random
engine is actually 32-bit.

Change-Id: Ia9e4cffb688e7c82f3f088b71f99002b76ad1df3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65640
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-10-04 14:40:26 +00:00
Ryan Harrison 2271b9541c Support reflecting uninitialized pipeline overrideable constants
Also adds testing for constants type reporting

BUG=tint:852

Change-Id: Ic644f3a4e6687446a552ce755951966743c8ee97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65641
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-04 11:01:19 +00:00
Ben Clayton 5e35864c1b writer/spirv: Fix abs() on unsigned integers
GLSLstd450SAbs expects a *signed* integer.
abs() of an unsigned number is now a no-op.

Fixes WebGPU CTS tests:
webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:*

Bug: tint:1194
Change-Id: I65c5e9f2f03aac0b788b9ba88c383cbec136d7c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65620
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-10-01 08:41:55 +00:00
Ryan Harrison c57642cbd5 Refactor fuzzer transform generation
Also splits out various utility classes from tint_common_fuzzer and
uses consistent naming for utility classes.

BUG=tint:1106

Change-Id: Ic343741eea799366850c46834865d50885554a84
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65301
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-09-30 18:58:32 +00:00
Ryan Harrison 0e193ac03e Unpin OSX SDK version being used
This is no longer needed, and removing will avoid the possibility of
needing reinstall XCode on every CQ run.

Change-Id: I29fa99734ec71349102d19fd77f9e416db8979d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65300
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-30 18:08:40 +00:00
James Price ee23c17345 resolver: Deterministic constant ID allocation
Use global declaration order for allocating implicit
pipeline-overridable constant IDs, instead of iterating over an
unordered_map.

Bug: tint:1155
Change-Id: Ia5ff534c617b0d57e45fc20dd0a5a591854e6473
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65522
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-30 17:29:50 +00:00
James Price 5ffae32177 validation: Improve continue-bypasses-decl message
Attach the error to the continue statement, and add notes to show
where the variable is both declared and used.

Change-Id: Ie9939a5ca674e7216069bbb1d8dc82ab6949367c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65521
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-30 17:29:50 +00:00
James Price 7166f6ba93 validation: Fix continue-bypasses-decl check
An expression that is inside an if-statement condition does not have a
"current block", which is what we were using to see if the usage was
inside a continuing block. Use the current statement to find the
containing block instead.

Fixed: chromium:1251664
Change-Id: Icc808ca1cf6a1b51757da8303901fa5ecb693e83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65520
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-30 17:29:50 +00:00