Commit Graph

2570 Commits

Author SHA1 Message Date
Sarah 465c5aa51d validation: clean up function attributes validation and unit-tests
- clean up function decorations unit tests
- clean up interpolate and invariant validation and unittest
- add separate unit-tests for each shader stage input and output
- add [[builtin(position)]] tests
- add validation and test for:
structures with 'location' decorated members cannot be used as compute shaders input

Bug: tint:1007
Change-Id: I12e97e163b3a77bc76ce21faba241683eec5d917
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58942
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-23 13:23:20 +00:00
Sarah f76c227cee parser: fix wgsl expect_const_expr()
Bug: tint:1025
Change-Id: I35aab866ffce57681662f59e4b8e701bb03cf718
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-23 13:15:10 +00:00
Alastair Donaldson f7e73d4ee3 Add tests derived from VK-GL-CTS
This adds SPIR-V assembly and WGSL tests derived from VK-GL-CTS commit
571256871c2e2f03995373e1e4a02958d8cd8cf5. The following procedure was
followed:

- Those .amber files in VK-GL-CTS wholly owned by Google were
  identified

- All GLSL and SPIR-V shaders were extracted from the Amber files and
  converted into SPIR-V binaries

- The compact-ids pass of spirv-opt was applied to each binary

- Duplicate binaries were removed

- spirv-opt -O was used to obtain an optimized version of each remaining
  binary, with duplicates discarded

- Binaries that failed validation using spirv-val with target
  environment SPIR-V 1.3 were discarded

- Those binaries that tint could not successfully convert into WGSL were
  put aside for further investigation

- SPIR-V assembly versions of the remaining binaries are included in
  this CL

- test-runner with -generate-expected and -generate-skip was used to
  generate expected .spvasm, .msl, .hlsl and .wgsl outputs for these
  SPIR-V assembly tests

- Each successfully-generated .expected.wgsl is included in this CL
  again, as a WGLSL test

- test-runner with -generate-expected and -generate-skip was used again,
  to generate expected outputs for these WGSL tests

Change-Id: Ibe9baf2729cf97e0b633db9a426f53362a5de540
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58842
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-23 13:10:12 +00:00
Alastair Donaldson bd3edb564f Disable size assertions in SPIR-V Tools fuzzer
The SPIR-V Tools fuzzer asserts that the binaries it receives have sizes
that are multiples of 4 bytes, as it should only ever run on valid
binaries. This is failing in ClusterFuzz, likely due to the fuzzer being
misconfigured, so for now these assertions have been replaced with early
exits. They should be reinstated once the fuzzer is correctly
configured.

Fixes: chromium:1232308
Change-Id: I1fa980d09ce9e5c349a2cfcebe0246ebad6613fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59440
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Alastair Donaldson <afdx@google.com>
2021-07-23 11:21:41 +00:00
Ben Clayton ba93d14c9a fuzzers: Fix use-after-free
Diagnostics hold a pointer to the source, used for printing the source in the error message.
Because of this, the source must live at least as long as the diag::list.

Fixed: chromium:1232097
Change-Id: Iad8b30a2bd69f505dd8bb0eadc5a35115400d047
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59360
Auto-Submit: Ben Clayton <bclayton@google.com>
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-07-22 22:53:24 +00:00
Ben Clayton fced350b3d sem::Type: Replace GetDefaultAlignAndSize() with Size() and Align()
This is a cleaner API, and the implementation doesn't have to know a bunch of information about all the derived types.

Change-Id: I96bebcb9f3ceda86fa34bd8e70961dee63fd7e13
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59301
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-22 18:56:54 +00:00
Ben Clayton f5ed2ba906 sem: Rename `Vector::size()` to `Vector::Width()`
`Size()` will be added which is the size of the type in bytes.

Change-Id: If997820d7859cd9d1bb0631d1b72150378e6a24b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59300
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-22 18:31:34 +00:00
James Price 4261466a84 writer/hlsl: Ignore struct member offset attribute
These are generated by the SPIR-V reader. Structures used by the
storage and uniform storage classes are handled separately, so we can
safely ignore this attribute for the other storage classes which are
not shared with the host.

Fixed: tint:1027
Change-Id: I8df4b41c687922a97f3b0ed97804cecc17d8997a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-22 14:41:37 +00:00
James Price eb39420ae6 reader/wgsl: Add support for block comments
Handles nested block comments.

Allow unterminated block comments at EOF, as it is not clear whether
WGSL will allow this or not.

Bug: tint:881
Change-Id: Ieae4e0073dab69f773adb32018a9bdaf4f352116
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59180
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-22 14:41:37 +00:00
Ryan Harrison 18d7e785d3 Fuzz WGSL and MSL generator options
BUG=tint:973

Change-Id: I94dc136444e9650dcf3d1c81a52e6d4491b21a16
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59221
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-22 13:25:54 +00:00
Ben Clayton 4ffcf067a3 sem: Add Owner() to sem::Parameter
Change-Id: I3de1e2437b9604378b8368494363e19070443670
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59201
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-07-22 13:24:59 +00:00
Ben Clayton 0f2d95dea3 sem: Split sem::Variable into global, local and parameter
Each of these may contain information specific to their kind.

Change-Id: Ic8ac808088132b7bc2e43da6ce46a06571e0fed5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59200
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-07-22 13:24:59 +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
Ben Clayton fe3ba95e6a inspector: Use diagnostic lists
Instead of concatenating to a string

Change-Id: Ib70bba2b0dbf9fcb04a232e0e78d3b576ab3ba88
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59203
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-21 19:34:03 +00:00
Ben Clayton 81d4ed0d9c Fix operator% for f32 and vecN<f32>
https://github.com/gpuweb/gpuweb/pull/1945 changes the SPIR-V mapping of this operator so that it now maps to OpFRem instead of OpFMod. Polyfill OpFMod with `x - y * floor(x / y)`

Also map the MSL output of this operator to use `fmod()`.

Behavior of this operator is now consistent across all backends.

Fixed: tint:945
Fixed: tint:977
Fixed: tint:1010
Change-Id: Iefa009b905989c55ace24e073ab0e261c7cf69b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58393
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-21 14:11:01 +00:00
Ben Clayton 1ec484410a .vscode: Fix quotations in windows 'configure' task
It seems the tweaks to always force "cmd" to be the shell seemingly changes the way single quotes are handled.  ¯\_(ツ)_/¯

Change-Id: I82310bc798b0dc5af8a4e53886110ef2c6468a97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59028
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-21 13:24:21 +00:00
Alastair Donaldson 8800ba091d Fix assertion strings and tidy up memcpy call
These changes were intended for submission as part of 58386.

Change-Id: I23f7ada1e8940dce6855176724ade1f2bb7687f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59024
Auto-Submit: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-07-21 13:23:51 +00:00
Ben Clayton 7ec7794046 Remove accidental commit
Change-Id: Ied931db182c11f26bffda4900641e41a1e9b5ee8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59027
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-21 12:37:31 +00:00
Sarah a4696681eb validation: invariant attribute on struct members
Bug: tint:1008
Change-Id: If3c398b01952f6b482c60cf86ab8ddf724d385a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59060
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-21 12:16:35 +00:00
Ben Clayton f3fffdaded Build fixes
fuzzer: GetErrors() was replaced with Diagnostics()
remote-compile: Add missing header for macOS
Change-Id: I7697fd41b3cc4e3b59e10a6c395d610a51ec8daf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59025
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-07-21 09:40:41 +00:00
Sarah 36b49e8834 validation: fix error msg: textureSample*() offset must be a const_expr
Bug: tint:1016
Change-Id: I631ac820f3174ec7ad12e51396b7584df55b27f1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59001
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-21 03:34:34 +00:00
Alastair Donaldson 0c7332b2ba SPIR-V Tools fuzzer: check binary size
Adds assertions to check that the SPIR-V Tools fuzzer is not
inadvertently applied to SPIR-V binaries of an invalid size, which
guards against the fuzzer being run in a misconfigured fashion.

The CL also moves a memcpy that populates a SPIR-V binary buffer so
that the memcpy only happens when the input really is SPIR-V. This
avoids frequent redundant memory copies when fuzzing WGSL.

Change-Id: Iafccaa107ff34941d8878ed5be72a2e6d38d0f49
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58386
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-07-20 20:56:30 +00:00
Ben Clayton 33afd6ce97 Revert "writer/hlsl: Special case negative zero"
This reverts commit efceb83536.

Reason for revert: Possibly broke tint -> dawn roll (again)

Original change's description:
> 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>

TBR=bclayton@google.com,jrprice@google.com,bclayton@chromium.org,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ic3042dabbd5a399851185714a6dd5e33ba8a5fc6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59023
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-07-20 20:35:41 +00:00
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