Commit Graph

2547 Commits

Author SHA1 Message Date
Ben Clayton f6660aa125 tools: Add snippets tool
Gathers information about changes merged and reviewed for team weekly reports.

Change-Id: I53e3acc45679b4822c506d16980393fbaf337b3b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59022
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-20 20:25:38 +00:00
Ben Clayton 6e8ace016e test: Add a case for resources used through lets
A hypothetical case discussed in the WG call, which I wasn't entirely sure was going to work. It does.

Change-Id: I855f1e02af2fe62214e3fb964f6937e3d88016eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59021
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-20 20:25:38 +00:00
Ben Clayton 88bd8a1690 fuzzers: Fix Reader::vector<T>()
count != size

Bug: chromium:1231169
Change-Id: I11420fd665db787546df5616ab3f884b5c972abf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59020
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-07-20 18:59:10 +00:00
Ryan Harrison a294371151 Add an infra specific PRESUBMIT.py
This will run the standard LUCI config checks.
These include running the validation tool, catching issues with ACLs
and remote hosts.

They do no gauarantee complete correctness, but catch common programming
errors.

Change-Id: I83a8d325d1f491bd81d1d1dc095a43a52150ef90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59000
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-07-20 18:48:26 +00:00
Antonio Maiorano 68a6dd0073 Resolver: make IsConstructible non-recursive for arrays and struct members
Also fix cases of implicit conversions of bool to int when creating
sem::Array.

Bug: tint:917
Change-Id: I5392fb737efc410f039b4dbd96cffc5daa4fd3a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58783
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-20 18:28:31 +00:00
Ben Clayton 701820b1f4 writers: Add flag to disable workgroup memory init
Bug: tint:1003
Change-Id: Ia30a2c51b5d3f8c6a01bed5299eac51dc3ad6337
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58843
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-20 18:23:06 +00:00
Sarah 3d441d48bb validation: validate function call pointer parameter
Each argument of a function call of pointer type must be one of:
- An address-of expression of a variable identifier expression
- A function parameter
Also added source location to duplicate struct member name unittest

Bug: tint:983
Change-Id: Ic5ab010b2ed76207a1d8d3ef9f66140ea95f7e72
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58480
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-20 18:14:02 +00:00
Ryan Harrison 6d27f23451 Force Python 3 in presubmit
BUG=tint:1020

Change-Id: I8c4dba4367076922bd4dd039b1d91960eaf224a3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58940
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-20 17:16:31 +00:00
James Price 9889ff0bcd writer/msl: Emulate scalar length and distance
Fixed: tint:921
Change-Id: I90fe01fa854d64cfff9453898153a38b360b52de
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58822
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-07-20 16:35:00 +00:00
Ben Clayton b29396e472 fuzzers: Don't pointlessly format diagnostics
Fuzzers like to generate silly long source, and formatting large spans of these can take considerable time.
Only format the diagnostic if it is going to be displayed.

Significantly speeds up some fuzzing tests, fixing some timeouts.

Also add a minor optimization to the formatter repeat() implementation.

Fixed: chromium:1230313
Change-Id: Ib1f6ac0b31010f86cb7f4e1432dc703ecbe52cb0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58841
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-07-20 14:39:50 +00:00
Ben Clayton efceb83536 writer/hlsl: Special case negative zero
Fixed: tint:960
Change-Id: I04de8713fe299607f32fd93288a22b75a9dff381
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58760
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-20 12:45:30 +00:00
Corentin Wallez c6a73298c4 BUILD.gn: Directly depend on spvtools targets
Spvtools recently added support for the vkdebuginfo instructions,
causing roll failures since Tint build files didn't generate the
headers for them. Instead of adding more generator stuff in Tint's
BUILD.gn files, this commit removes everything in favor of directly
referencing spvtools' targets.

In follow-up work, the references to spvtools_internal_config will
be changed to a more narrowly scoped target so that spvtools'
warning suppressions don't get propagated to Tint.

Bug:chromium:1228274

Change-Id: I5e28c9cd978afd3cfbc941c09decf5a6e7e1554a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58840
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-20 12:34:00 +00:00
Corentin Wallez dbbe193b68 Remove stray print in generate_wgsl_corpus.py
This print shows up when building with no context which could lead to
confusion.

Change-Id: Ic29b9c8d91d6e2e2de9a527e2caaa67a04266f31
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58762
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-20 11:14:50 +00:00
James Price c41d940650 Parse num_workgroups builtin and reject it
We have chosen not to implement this for origin trial, so just parse
it and produce an error in the validator.

Bug: tint:752
Change-Id: I40ebf0b4051fb0b8bab9d4c733e555b836320cd4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58780
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-19 21:32:27 +00:00
David Neto 94a5fd476e spirv-reader: polyfill scalar refract
Compute it in 2 dimensions, with a 0-valued y component,
then extract the x component of that result.

Fixed: tint:974
Change-Id: Ie23668d3403e68be14f34da9540f27f6f3c3aca2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58782
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-19 21:31:59 +00:00
Ben Clayton 0c3ddc9649 parser/wgsl: Error if type decorations are not consumed
Fixed: chromium:1230604
Change-Id: Ia847e58c30f2c5787db4c239d561e4fe5da01355
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58761
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-07-19 21:23:39 +00:00
Ken Rockot ac9db206eb inspector: reflect workgroup storage size
This reflects the total size of all workgroup storage-class variables
referenced transitively by an entry point.

Bug: tint:919
Change-Id: If3a217fea5a875ac18db6de1579f004e368fbb7b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57740
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
2021-07-19 20:30:09 +00:00
Ben Clayton b291cfced9 Resolver: Validate that var/let has a type or initialzier
Fixed: chromium:1230324
Change-Id: I05f6e82696d38014fa1bd16f663c4d39e138d7d5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58682
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-19 19:50:52 +00:00
Ben Clayton 68596d8a55 vscode/tasks.json: Be explicit about using 'cmd'
... for the shell.

Without being explicit, the shell used for these tasks is the one specified in the user's config.
If the default shell is non-powershell, then these tasks silently fail to execute.

Change-Id: I7916a3461a3d561d669bd94e1bf32da1b60d0b69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58223
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-19 18:55:39 +00:00
Sarah 0bbe24d4ce validation: struct member name must be unique
Bug: tint:964
Change-Id: I45e324f65fb6e7c20488a154510daca6ae347e47
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-19 17:38:20 +00:00
James Price 1fa28acc7a Add support for converting bool to other types
The only non-trivial case is SPIR-V, which generates OpSelect to
choose between 1 or 0.

Fixed: tint:997
Change-Id: Ifda7b3ec1e0a713843a2da7ed59c3449d4eec8bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58521
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-19 17:35:39 +00:00
David Neto 93d4501e67 spirv-reader: refactor handling pipeline IO decorations
This is in preparation for handling the "invariant" decoration.

Bug: tint:972
Change-Id: I17465946932ab37a32dfd3c477525649ab622c6f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58580
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-19 17:02:36 +00:00
Antonio Maiorano a94d1a9c81 Remove TINT_EXPECTS_UBOS_TO_BE_MULTIPLE_OF_16 macro
This was a temporary measure to be able to roll Tint into Dawn with this
change. Dawn's usage of this macro was removed in:
https://dawn-review.googlesource.com/c/dawn/+/58365

Bug: tint:984
Change-Id: Ie6ab047a6398aa1a29b56c3181ec38691f34498d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58322
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-07-19 14:54:19 +00:00
Ben Clayton 9a052177d0 tools: Fix test-runner --filter flag on windows
Likely got broken with https://dawn-review.googlesource.com/c/tint/+/56776

Change-Id: Ie9db21e11084435a47f6fa0bfc809a590a353685
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58396
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-19 14:47:39 +00:00
Ben Clayton 73f0dde6d0 fuzzers: Fix memcpy in Reader::read
We were copying to the address-of the `out` pointer parameter, not the actual pointer.
It's seriously troubling that the fuzzers didn't fail sooner on this.

Fixed: chromium:1230266
Fixed: chromium:1230352
Fixed: chromium:1230356
Fixed: chromium:1230358
Fixed: chromium:1230376
Fixed: chromium:1230377
Fixed: chromium:1230378
Fixed: chromium:1230384
Fixed: chromium:1230395
Fixed: chromium:1230406
Change-Id: I4f67f10127e89f873ab628e5af76b7455d113276
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58681
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-19 10:38:39 +00:00
Ben Clayton 890363145a fuzzers: Fix function not returning a value warning
This was preventing the dawn -> chromium autoroller

Change-Id: Iea260e8b454766e08cdb69cea65222391a4022bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58680
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-19 09:35:19 +00:00
Ben Clayton cdcec6d08c fuzzers: Don't call data() on empty std::vector
UBSAN takes objection to this.

Fixed: chromium:1230344
Fixed: chromium:1230346
Fixed: chromium:1230372
Fixed: chromium:1230439
Fixed: chromium:1230457
Change-Id: I351bca06911f2e87f929f08d2aa78a1d8d43d296
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58399
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-07-19 09:33:19 +00:00
Ben Clayton 595b0547d4 writer[spirv,hlsl]: Call UnwrapRef() for splats
The TypeConstructorExpression logic that tested for splats was not considering references. This led to broken emission for the SPIR-V and HLSL backends.

Fixed: tint:992
Change-Id: I9824b71f526997f91d380c09b459f4fd73065b19
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58397
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-18 15:41:25 +00:00
James Price 76feb6b626 reader/wgsl: Add source info to CallStatement
We were not printing source information for errors involving call
statements.

Change-Id: I576b4d095162333d4392d6be590e827a49918d3d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58520
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-07-18 14:45:24 +00:00
David Neto a01bb4c984 spirv-reader: reject undef and null pointers
This is defensive.  Without variable pointers capabilities, this is
definitely invalid, but not yet checked by the SPIRV-Tools validator.

Bug: tint:807
Change-Id: If9b0b19573b1ca14a1c55aa20c9d42784ec12568
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56700
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-17 19:19:16 +00:00
Ben Clayton 20c2ff60d2 transform/Robustness: Re-work the accessor clamping
Rework the clamping so that it unifies the logic for arrays, matricies
and vectors. Try to preserve constant signess, and only clamp the values
if they're possibly out of bounds.

Use ConstantValue() instead of scanning for ScalarConstantExpressions.
As ConstantValue() improves, so will the performance of robustness.

Change-Id: I013a67e15f43350d0a57bcd8ba9ae0c1bcb1eaec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-07-17 18:26:06 +00:00
Ben Clayton cd7eb4f968 Resolver: Validation for continuing blocks
Check they do not contain returns, discards
Check they do not directly contain continues, however a nested loop can have its own continue.

Bug: chromium:1229976
Change-Id: Ia3c4ac118ffdaa6cca6025366c19f9897718c930
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58384
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-17 18:09:26 +00:00
Ben Clayton 725159c17c resolver: Limit the number of parameters to 255
See: https://github.com/gpuweb/gpuweb/issues/1959

Fixed: chromium:1228642
Change-Id: Iadedd0a1396ebb6a006caa99e0931a92eb2c008e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58390
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-17 17:45:25 +00:00
Ben Clayton b85099ae73 test: Split binary_expressions into separate tests
Tests should be as fine-grained as possible.
Not all the permutations were covered.
Not all the backends were actually generating anything useful, as the
functions were not called by an entry point.

Change-Id: I76658533d3112d202f7482a19531079550e66f83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58392
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-17 17:38:46 +00:00
Ben Clayton 8f144a09f6 fuzzers: Fix buffer overrun
Fixed: tint:1005
Change-Id: I3655ee7b54811b55736cbf0e05c63cb27de6cd72
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58391
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-07-16 21:15:24 +00:00
Ben Clayton 50b6d024d6 fuzzers: Don't drop writter errors on the floor
A writer shouldn't error. If the input is invalid, then this should be caught by the parser or resolver.
Fail the test if the writer errors.

Change-Id: I89da602dc96fa7be2a8efa288a90310a61745124
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58389
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-16 21:07:25 +00:00
Alastair Donaldson 86dc88725a Add gn build support for spirv-tools + AST fuzzers
Allows the new transformation-based fuzzers to be built using gn, so
that they can be deployed on ClusterFuzz.

Fixes: tint:1002
Fixes: tint:1006

Change-Id: Ib9624e507e40836541eb424e710705345a198db1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58387
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-07-16 20:56:55 +00:00
Alastair Donaldson 5d71531abe Fix SPIR-V emptiness condition in fuzzer
Fixes a problem where the fuzzer was ignoring non-empty SPIR-V
binaries.

Fixes: tint:1004
Change-Id: I9fa98764b7408dbd53d5b56424805e2fa331a118
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58385
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-16 20:34:55 +00:00
Ben Clayton 883fb63e01 transform: Don't unroll arrays in DecomposeMemoryAccess
Arrays can be extremely large, and having the load and store functions unroll the elements can make the complier explode.

Fixed: chromium:1229233
Change-Id: Ieb5654254e16f5ce724a205d21d954ef9a0cd053
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58382
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-16 19:47:44 +00:00
Sarah c33503069c validation: location decoration is not valid for compute shaders
Bug: tint:981
Change-Id: I15024e0cf836af4f3ad7a14b8cd51c24fc3cd536
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58067
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-16 19:11:54 +00:00
David Neto 5f994247a2 reader: fix ordering of select operands
Updates:
spirv-reader
hlsl-writer
spirv-writer

Bug: tint:1001
Change-Id: I7359d35c3384e164d149a6af03cbdc959a2eea76
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-07-16 18:17:05 +00:00
Ben Clayton 29c70796d3 parser/wgsl: Fix stack overflow in postfix_expression()
Have postfix_expression() use a loop instead of recursively calling itself.

Fixed chromium:1229669

Change-Id: Ied7684d00ba453a8b89ab0251d42e2a72169421f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58381
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-16 17:55:14 +00:00
Vasyl Teliman fa4d4341f4 Fix AST fuzzer message serialization
Currently, AST fuzzer requires that all fuzzed binaries are serialized protobuf messages.
In principle, we don't need this when we don't record mutations (which is the case right
now). Hence, this CL removes that requirement.

Change-Id: Ibe677d1ac7d34d640d6e3a368af50df5b4fe474a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58225
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
2021-07-16 17:50:04 +00:00
David Neto e087a95706 spirv-reader: support remaining interpolation decorations
NoPerspective interpolation maps to 'linear'

Centroid maps to 'centroid'
Sample maps to 'sample'
Otherwise, allow 'center' to be defaulted.

Fixed: tint:935
Change-Id: I0b040da0c57d2a363f9dc9474c1ac889e0fe2278
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-07-16 16:20:25 +00:00
Sarah 71198438ac validation: textureSample*() offset argument must be literal or const_expr
Bug: tint:939
Change-Id: I4ba44902948e38aa9ce3e9ecae9b3b4b593bd93d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-16 13:38:05 +00:00
Vasyl Teliman 979a0b4446 Fix CLI parameters in fuzzers
This CL changes the prefix of CLI parameters in AST and SPIRV-Tools
fuzzers from `--` to `-` to make these fuzzers compatible with ClusterFuzz.
Additionally, a `tint_` prefix was added to all CLI arguments to prevent their
name collisions with LibFuzzer arguments.

Change-Id: Id2e087e59f04b495d5a7edb3b62d55de652c1acd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58226
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-07-16 10:26:34 +00:00
Vasyl Teliman 365af046ca Fix SPIRV-Tools fuzzer
This CL fixes a regression in SPIRV-Tools fuzzer after the changes in https://dawn-review.googlesource.com/c/tint/+/57101. Additionally, a bunch of sanity fixes are added to the CommonFuzzer.

Change-Id: Ie6512ddca20572d23634c4b5265b39540a42b4bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58224
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Vasyl Teliman <vasniktel@gmail.com>
2021-07-16 09:25:14 +00:00
Antonio Maiorano 4c9b440515 Fix FloatToString printing with not enough precision when using `fixed` floatfield format
Setting precision to `std::numeric_limits<float>::max_digits10` is valid
when using the `scientific` floatfield format when printing values.
However, we used `fixed` to make our floats more human-readable. This
change keeps the output in `fixed`, except if doing so loses precision,
in which case we fall back to `scientific`.

This fixes the rendering differences seen in the Babylon.js examples
(https://crbug.com/tint/944) between Dawn using Tint vs SPIRV-Cross, as
Tint's output was emitting values that had lost too much precision
(e.g. very small numbers being output as 0).

Bug: tint:944
Change-Id: I8deea23ad876825bbe390fc26907d4bbbd4b966e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58321
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-16 08:55:14 +00:00
Ben Clayton 1da4073870 test: Add case for tint:977
Bug: tint:977
Change-Id: I50778c6e1778717c0ad9b02b2ea25b13c4a3da97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58065
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-15 22:36:44 +00:00
Ben Clayton 0bff3fb3b7 writer/wgsl: Fix printing of for-loops
Fix various issue with formatting for loop. Add tests.

Bug: tint:952
Change-Id: I704341a15f0050ebf82df219d0c7d068a3a63c26
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58064
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-15 22:20:29 +00:00