Commit Graph

3022 Commits

Author SHA1 Message Date
Ben Clayton 294ce9394f ast: Rename ImageFormat to TexelFormat
This is what its called in the spec.

Issue: tint:1361
Change-Id: I512c4224191fd2bbf04522da2093872f79ee02a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75581
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-06 17:20:22 +00:00
Stephen White c1faee9395 Add new GLSL test expectations.
All failures are now SKIP'ed.

Bug: tint:1358
Change-Id: If04d57b9e0b71dd877468b5dc277fbff82f36692
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-06 15:31:21 +00:00
Ben Clayton 6165cca1a6 reader/wgsl: Remove texel format names as keywords
These were removed in https://github.com/gpuweb/gpuweb/pull/2474.
`read`, `write` and `read_write` were already excluded as keywords.

Fixed: tint:1359
Change-Id: I5424f780f4bd67bb336320a22dd2097ed03b4bd6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-01-06 12:16:11 +00:00
Ben Clayton 7b0686a922 build: Update tint to use C++17.
Mirrors changes and DEPS toolchain SHAs found in https://dawn-review.googlesource.com/c/dawn/+/75061

Change-Id: I69a3b6bb091e00207d81d5dbc288b9b68fc961fc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75241
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-06 09:23:11 +00:00
Ben Clayton 7dc901fa4f tools roll-release: Bump branchLegacyCutoff to M96
The tool was getting slow, due to the number of branches being examined.
M96 is the latest stable release. We aren't applying fixes to this or older branches.

Also avoids an issue where the M95 branch was missing a cherry-pick, which the tool wanted to merge with each run.

Change-Id: I8a8b1466c10633d9539725cd4f9b1b0514e41e93
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75067
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-01-05 21:03:10 +00:00
Ben Clayton c00cc43e53 reader/spirv: Optimize FindUnusedDerivedName()
Store the last search id suffix so that we don't research the same suffixes over and over again.

Bug: oss-fuzz:38098
Bug: oss-fuzz:38606
Bug: oss-fuzz:39300
Bug: oss-fuzz:40339
Change-Id: I295147d91bb9f805170c49114267033bbb781e4d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75427
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-05 20:42:50 +00:00
Ben Clayton 1c4f8de30b reader/spirv: Optimize MakeNullValue()
Constructing a null vector, matrix or array does not need to provide an explicit list of null elements. `T()` is a more efficient and readable equivalent.

Fuzzers like to generate enormous pathological composite types, which has been triggering OOM failures.

Bug: oss-fuzz:38095
Bug: oss-fuzz:39235
Bug: oss-fuzz:39246
Bug: oss-fuzz:39874
Change-Id: I910bb04bdd0e80532c09fc038be895ec37d3d380
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75426
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-05 20:24:22 +00:00
Ben Clayton 4a143a40a3 reader/spirv: Prevent nullptrs being passed to ast::CallExpression.
nullptrs are caused by errors. Detect and return before passing nullptrs to places they shouldn't go.

Also: Rename 'params' to 'args'. These are arguments, not parameters.

Bug: oss-fuzz:38074
Fixed: tint:1355
Change-Id: I77f97b4a8e5dab21802b300ba3eedad767ac2ad5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75425
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-05 20:11:41 +00:00
Ben Clayton 5c99ed046a intrinsics: Add degrees() and radians()
Fixed: tint:1329
Change-Id: I5fb927268fc9cb8047a2b365d26e813a8546605a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75423
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-05 20:11:00 +00:00
David Neto 4beeaea9da spirv-reader: support OpImageDrefGather
Also, issue an error when a gather or dref-gather operation
is used with a Bias or Grad image operand.

Fixed: tint:1336
Change-Id: Ife11d2f52a1a2d1b75e26269373db5cc4b3440bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74801
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2022-01-04 22:00:59 +00:00
David Neto 5791197e80 fix spirv-reader test: add Block decoration
Fixes a SPIR-V validation error.

Change-Id: I51bf887d1e2b55760e5512648074ae349a90a15e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74802
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-01-04 20:23:19 +00:00
Ben Clayton 1372222215 wgsl: Replace 'elseif' with 'else if'
Bug: tint:1289
Change-Id: I72432391e60cf5ff173aa51a6d4a2bc8ef58fbf2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75240
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-01-04 20:06:49 +00:00
David Neto 7d88368c56 spirv-reader: support OpImageGather
Bug: tint:1336
Change-Id: I771b09e7568f1f022a316f2ba0bc72c03f735aa1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74800
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-01-04 15:46:39 +00:00
Corentin Wallez f09a23a3f7 Fix MSVC narrowing warnings in newer MSVC versions.
Bug: dawn:824
Change-Id: I4be68ab47e5aa846583240c1024e286d7ec2e115
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75073
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-04 15:31:24 +00:00
Corentin Wallez 09c49b34d9 Fix -Wunreachable-code-return with newer clang version.
When the emit_continuing lambda always returns true, clang is able to
detect it and finds that some code is unreachable.

This commit changes places that use the lambdas directly to instead use
the stored emit_continuing_ member.

Bud: dawn:824
Change-Id: Idfd804a6ec53ac793e8988dce79991c659fbbc36
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75060
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-04 10:18:39 +00:00
David Neto 7913982f87 wgsl reader: Allow 0X as a hex prefix for ints and floats
Fixed: tint:1353
Change-Id: I8252cc9d055657e361c4bceadcc59f7703f98c23
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74380
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-23 22:25:21 +00:00
Antonio Maiorano 9943de6813 Fix FXC compile errors on modulo by zero
Just like for divide, FXC fails with the exact same error when
performing a modulo on a value that FXC determines to be zero. We
address it in the same way as we do for divide.

This also fixes a couple of the vk-gl-cts tests for which I manually
generated expectation files for.

Bug: tint:1083
Change-Id: Ia388bf002112afded542adb791d37e88e35a77ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74220
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-22 15:02:09 +00:00
Stephen White cc4d97b6e3 GLSL: use "Offset" forms of texture intrinsics when appropriate.
Also ensure correct paramter ordering: bias is always after offset.

Bug: tint:1351

Change-Id: I41ee66b86cd9d912f3857e5377b660c50d035c6e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73720
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-12-21 16:53:36 +00:00
Antonio Maiorano 821f9bb525 Fix FXC compile errors on divide by zero
FXC fails to compile when it determines that the rhs of an integral
division is zero with "error X4010: Unsigned integer divide by zero".

bclayton's fix (https://dawn-review.googlesource.com/c/tint/+/60500)
addressed cases for division by an integer constant 0. This CL adds the
missing support for division by integral vectors with 0 components.

FXC also fails on division by integral expressions that it can fold to
0. To handle these cases, we now emit a runtime check for 0 and replace
by 1. In the cases I've tested, FXC seems able to optimize these checks
away.

Bug: tint:1083
Change-Id: I02f08e9077882f03c1e42b62dacb742a48fa48ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-21 14:48:26 +00:00
Stephen White 5965c6ed1f Update GLSL expected results.
Change-Id: I32aaefe71ea728ae5118de08e5dd9073ddf2269e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-12-21 01:48:13 +00:00
Antonio Maiorano c5f2fe4c78 CMake: fix clang-cl build
Add two more warnings to ignore. These show up when including glslang
headers in samples/main.cc.

Change-Id: Icdb9fa9914bfe6fdafb4727ed8bf774fe9b930bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73660
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-20 21:39:35 +00:00
David Neto 66e7569e15 spirv-writer: Fix termination of basic blocks
There are a few places where a branch or return is created,
conditionally on whether a terminator was the last thing seen.
The goal is to generate a SPIR-V basic block terminator exactly
when needed, and to avoid generating a branch or return immediately
after a prior terminator.

Previously, the decision was based on the last thing seen in the AST.
But we should instead check the emitted SPIR-V instead.

This fixes cases such as a break or return inside an else-if.
That's because an if/elseif is actually a selection inside a selection.
Looking at the AST only works when trying to terminate the *inside*
selection.  In the outer recursive call, the last AST node is
no longer a terminator, and we would skip generating the branch
to the merge block.

Fixed: tint:1315
Change-Id: I6b886ce85d1d681f2063997e469e0c1b4e5973a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73480
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-12-20 16:46:55 +00:00
Antonio Maiorano a9d6c34d86 e2e tests: generate missing expected files
Change-Id: I6b4aee4bb08b0f4c02c015f469edc24be1623fc3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-18 21:28:23 +00:00
David Neto 667bc2d929 Roll SPIRV-Tools and SPIRV-Headers, fix spvasm
This picks up validation to ensure a struct of builtins on
the input or output interface is also decorated with Block.
See https://github.com/KhronosGroup/SPIRV-Tools/pull/4665

Fix SPIR-V in end2end tests that was breaking the rule.

Change-Id: Ic0e9c8936eb6b3f086b084d86b649e9e237fc3b3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73242
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-17 20:45:22 +00:00
David Neto 188b1fb8f5 spir-reader: fix tests: struct with BuiltIns must have Block
Fixes https://github.com/dneto0/spirv-samples/issues/2

Change-Id: Ie3ab62f31ba7e3d7c8d4dd56f8dc9a87046e1b92
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73241
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-16 22:07:51 +00:00
David Neto 11d9a08287 spirv-reader: remove test with invalid SPIR-V
SPIR-V validation fails when an object has multiple ArrayStride
decorations. Remove the SPIR-V reader tests that did this.

Change-Id: Iaac0f0f0c9230ccbc7dde5414d6aaf6f0e972534
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73240
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-16 21:50:51 +00:00
David Neto 9360046a86 spirv-reader: Use GenerateExpressionWithLoadIfNeeded more
* Rename GenerateNonReferenceExpression to
  GenerateExpressionWithLoadIfNeeded.
  This version takes an ast::Expression
* Add a variant that takes a sem::Expression, because the sem
  expression already knows the resolved type, and so we can save
  a lookup.
* Replace most uses of GenerateExpression ... GenerateLoadIfNeeded
  with a call to one of the above.

This is a non-functional change.
Followup to the fix in tint:1343.

Bug: tint:1343
Change-Id: If19a1bc7670edd2badc1533861d8b42f0825c7b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72720
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-14 22:15:39 +00:00
David Neto 5ad482744d spirv-writer: Generate load if needed for continue block conditional exit
Fixed: tint:1343
Change-Id: Ic105e407c572f1c309da8f21908a16c08b081f7f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72641
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-14 15:16:11 +00:00
Antonio Maiorano 9b9132c715 Fix OOB access while dumping struct layout for invalid storage class layout
A one letter typo would lead to invalid memory access in the very
specific case of outputting the layout for a struct within a struct with
field alignment padding, and the inner struct has more members than the
outer.

Bug: tint:1344
Bug: oss-fuzz:72642
Change-Id: I749e3fb172e78a20ece68b40be1a0a57dc5746f4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72642
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-13 23:36:38 +00:00
David Neto f885941100 Add cstddef for definition of size_t
Change-Id: Ic92072a680951145f4925a2ac640f74a8f8b4335
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72640
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-12-13 21:14:48 +00:00
Antonio Maiorano 654149fd69 Kokoro: run e2e tests with FXC validation
* Fixed DXC installation so that we download the latest release, and
patch it with the latest artifact build. This ensures that the correct
dxil.dll is next to dxc.exe, rather than having dxc.exe pick up whatever
dxil.dll is in PATH.

* To run tests with FXC requires the correct d3dcompiler_47.dll. To do
this, I modified the script to download the Windows SDK, and install
only the feature that contains the DLL.

* To avoid issues with DXC and FXC finding exes/dlls in PATH, modified
the script to temporarily set PATH as needed.

Bug: tint:940
Change-Id: Ic83b0b97f72ccc1f37b4b495eae6a6ab3421a95a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72560
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-13 19:19:58 +00:00
Antonio Maiorano f748f2ae22 Kokoro: use ninja to build faster for Windows builds
Saves about 5 minutes per Windows build.

Bug: tint:940
Change-Id: Ib03fb6ca9d51575d8ee82324be7040153e5536bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72540
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-13 19:15:28 +00:00
David Neto 6d67dad7fe spirv-reader: Ignore duplicate decorations
Vulkan allows them, but WGSL does not.

A duplicate decoration is purely redundant.
A parameterized decoratio with different parameterization is
an inconsistency and a semantic error, at least for currently defined
SPIR-V decorations.

So for each target, only take the first decoration of each kind.

Fixed: tint:1337
Change-Id: I6ed5c39cf2e213c695cb8217ed1b97814da3db56
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72500
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-12-13 17:54:21 +00:00
Antonio Maiorano d733fdb85c HLSL: work around FXC failures when dynamically indexing arrays in structs
FXC fails to compile code that assigns to dynamically-indexed fixed-size
arrays in structs on internal shader variables with:

error X3500: array reference cannot be used as an l-value; not natively
addressable

This CL detects this case, and transforms such assignments into copying
out the array to a local variable, assigning to that local, and then
copying the array back.

Also manually regenerate SKIPs for HLSL/FXC after this change, which
fixes 30 tests. Also exposes some "compilation aborted unexpectedly" now
that  "array reference cannot be used as an l-value" has been fixed. For
tests that fail for both DXC and FXC, updating SKIPs to the DXC one to
help distinguish actual FXC bugs from valid errors.

Bug: tint:998
Bug: tint:1206
Change-Id: I09204d8d81ab27d1c257538ad702414ccc386543
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71620
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-13 15:55:11 +00:00
David Neto 5923803f7e Document that ast::Variable::type can be null
Change-Id: I7a29c1de49cbd082a5c3e0fc4bdcdead9dd2c956
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70340
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-10 21:51:05 +00:00
Ben Clayton 30d55fabc9 docs: Move OT changes to M99
These missed the M98 boat.

Change-Id: Ic15e8323457d78eea1ea3c59c104b2901c883b1b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72321
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-12-09 22:53:14 +00:00
David Neto 9c179a601c wgsl-reader: hex prefix only is an error
These are errors:

    let a = 0x;
    let b = -0x;

Fixes: tint:1338
Change-Id: I9d26ad66e32deb954550c0ecfbda0a9005bcd380
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72380
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 22:35:44 +00:00
James Price 1461b032aa glsl: Don't emit structs with runtime-sized arrays
The GLSL emitted for these was invalid, and we don't need these
structs since they're only used as the store types of buffers, which
are handled elsewhere.

Change-Id: I17c15e408b5c36e9b895e5950528a6d02d1802a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72381
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 18:54:35 +00:00
James Price 57489928c6 test: Remove [[block]] for recently added tests
This attribute is now deprecated, and the warning is causing these
tests to fail.

Bug: tint:1324
Change-Id: I0665c9f3b657c8cb56e2252a23eb6184ea876075
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72420
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 18:54:35 +00:00
Ben Clayton 4e6e113816 reader/spirv: Allow leading underscore in identifiers
Bug: tint:1292
Change-Id: I738c981f503545075115101a3ead30941a19d95a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72320
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-12-09 16:55:04 +00:00
David Neto 01e4b54497 null character on input is an error
Fixes: tint:1311
Change-Id: Id80adc2c14c6d2cd5ee884e081d1d84f021e6620
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72200
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-09 15:57:30 +00:00
James Price 170a50353c reader/wgsl: Deprecate the [[block]] attribute
Bug: tint:1324
Change-Id: Ic8e9cd4a2e924498397659b5d23d6ac6d602588d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72088
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
James Price a5d3986a0a tests: Stop using the [[block]] attribute
This has been deprecated and will soon be removed.

Bug: tint:1324
Change-Id: If5dbbc3a40d7591591fb2802dbe9c8dd5f96d299
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72087
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price 3530c6bf06 reader/spirv: Do not generate block attributes
These are no longer necessary and will soon be deprecated and removed.

Bug: tint:1324
Change-Id: I3fa076e7ce5eb36466d24c80fd1c83658c28c5ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72086
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price ebdfa5d303 transform: Do not generate block attributes
These are no longer necessary, and the attribute will soon be
deprecated and removed.

Bug: tint:1324
Change-Id: Ia3cdd4e9d9bd7bca45d734a06466993199b3e838
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72085
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price 7c0693d9fe Remove {ast,sem}::Struct::IsBlockDecorated()
No code should rely on the presence of the block attribute, which will
soon be deprecated and removed.

Bug: tint:1324
Change-Id: I868d5e795e66a93bdf99b94389c07dec98cb0ec2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72084
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price c7c80c053d glsl: Always emit structures
Skipping those that are block-decorated is not correct, as
block-decorated structures can also have non-buffer usages. This is
even clearer now that WGSL has removed the block attribute.

Bug: tint:1324
Change-Id: I6484766a5c541d39e2dc08beb3ae7b889759a3fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72083
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
James Price 3a4443a681 spirv: Add block decorations with a transform
Any struct which is used as the store type of a buffer variable needs
to have a block decoration. If that struct is nested inside an array
or another struct, we wrap it inside another struct first.

This removes the SPIR-V backend's reliance on the [[block]] attribute,
which will soon be deprecated and removed.

Bug: tint:1324
Change-Id: Ib6ad54f24a3e4a090da9faeed699f266abcb66ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72082
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
James Price ac8975f291 validation: Remove requirement for block attribute
Replace all validation rules that rely on the block attribute with the
new rules based on fixed-footprint types.

Bug: tint:1324
Change-Id: I02656537bee66e6e1af95875e503a37bf23d4a6b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72081
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
Ben Clayton 81b3948649 resolver: Implement element inference of vecN and matNxM
Fixed: tint:1334
Change-Id: Idc94d49ecd41e37354bb93138348e3af3e733932
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72143
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 14:37:37 +00:00