Commit Graph

3116 Commits

Author SHA1 Message Date
Ben Clayton 51aed1c732 main: Return non-zero status code on GLSL validation error
Change-Id: I55b49cec665947fb735037f762ae8692d990c24d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68521
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-11-05 22:45:23 +00:00
Antonio Maiorano 02acf59184 HLSL backend: work around FXC ignoring switch with only default case
In HLSL code, if a switch statement has only a default case, FXC will
effectively ignore the code in that case. In this change, we detect this
and work around it by emitting the code in the default block without the
switch.

Bug: tint:1188
Change-Id: I69b405cdb4c669fb093eb49aa138923419dcf8f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68440
Kokoro: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
2021-11-05 20:39:07 +00:00
Ben Clayton 189dc7d3fd instrinsics: Implement dot() for integer vector types
Fixed: tint:1263
Change-Id: I642ea0b6c9be7f04930cf6ea1a8059825661e326
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68520
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-05 18:37:16 +00:00
Ben Clayton a9156ff091 Rework Resolver so that we construct semantic types in a single pass.
The semantic nodes cannot be fully immutable, as they contain cyclic
references. Remove Resolver::CreateSemanticNodes(), and instead
construct and mutate the semantic nodes in the single traversal pass.

Give up on trying to maintain the 'authored' type names (aliased names).
These are a nightmare to maintain, and provided limited use.

Significantly simplfies the Resolver, and allows us to generate more
semantic to semantic references, reducing sem -> ast -> sem hops.

Note: This change introduces constant value propagation across constant
variables. This is unlocked by the earlier construction of the
sem::Variable.

Change-Id: I592092fdc47fe24d30e512952511c9ab7c16d7a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68406
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-11-05 16:51:38 +00:00
Ben Clayton 2423df3e04 sem: Rename Function methods
Explicitly name references as either Direct or Transitive.
Rename workgroup_size() to WorkgroupSize().
Remove the return_statements. These were not used anywhere.

Change-Id: I7191665db9c3211d086dd90939abec7003cd7be7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68405
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-11-04 22:29:22 +00:00
Ben Clayton cc26a4166d utils: Add index operators to UniqueVector
And put it into the utils namespace.

Change-Id: Ib4c6fadc63954196d572148d0e96ffec6e3bbb38
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68404
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-04 22:29:22 +00:00
Ben Clayton 89d8b2b7a5 Clean up the ScopeStack interface
There's no need for the ScopeStack to include 'global' information. This
is easily obtainable from the element type.
Replace the get-by-reference, with a simpler return value.

Change-Id: Ic6f4c0f656a2019417d68ffb3fe85ba8343ad15e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68403
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-11-04 22:29:22 +00:00
Ben Clayton 307eff0da4 utils: Add more functionality to EnumSet
Add equality operators for EnumSet <-> Enum.
Add unidirectional iterator.
Add ostream support.

Change-Id: I8ea9e905bf17e618c6b12004200d37f65ccfb68c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68402
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-04 22:29:22 +00:00
James Price 85170d76bc Disallow taking the address of a vector component
Update or remove tests that try to do this.

Fixed: tint:491
Change-Id: I1f351a4abf68ae9bc6b100885fb1bcea08b31211
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68242
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-11-04 19:55:57 +00:00
James Price def9d97609 spirv-reader: Sink pointer-to-vector-component
WGSL does not support pointer-to-vector-component, so the SPIR-V
reader needs to sink these pointers into their use.

Bug: tint:491
Change-Id: Ib5ae87d2f6bbac13280314ba11369d7ced505b56
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68241
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-11-04 19:55:57 +00:00
Ben Clayton e7323f1a36 Cleanup intrinsic table tests
These were using `[EXPECT|ASSERT]_THAT` when they could be using `[EXPECT|ASSERT]_EQ`

Change-Id: Id967571ed121b5805f15b16d263c03c716296e1a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68401
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-11-04 19:36:25 +00:00
Stephen White c5aab619f3 GLSL: implement bitcast operators.
Bug: tint:1265
Change-Id: I6768bde2be8da7281c9516528485e49f6c7c0460
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68380
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-11-04 17:40:15 +00:00
James Price e0e45a4d47 Remove --dump-ast from help text and README
This flag was previously removed.

Change-Id: I8b6ed8dd8966fcf7b587a65e78dcc06c2b2a9cd2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68240
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-11-03 16:43:05 +00:00
Stephen White e9216ce595 GLSL: emit [] for runtime-sized arrays, not [0].
Bug: tint:1262
Change-Id: Ic58729f075353f957c5d974c742b531e1e2cf518
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-11-01 19:23:46 +00:00
Ryan Harrison d148be4f00 Infra: Use Python 3 for the Tint recipe
BUG=chromium:1256440

Change-Id: If1983c22da65ef14f21c992edf89face29f7a388
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68020
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-11-01 19:00:52 +00:00
Ryan Harrison d3f628b303 Fully support initializing fuzzer utilities using a seed value
Adds a constructor to TransformBuilder that takes a seed value.
Removes accessing internal details of the fuzzing utilities.
Also a bunch of little clean ups through out the code.

BUG=tint:1261

Change-Id: Iac7ace25b91fa96959e6c07b1df963900a1f7100
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67700
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-11-01 18:14:42 +00:00
David Neto 98dc04329f spirv-reader: Add test for mixed-size vector shuffle
The other test use the same vector width for the operands.

Change-Id: I2437c2ebef9f87eef4dc91c266460c837c019cd4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67500
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-11-01 14:18:51 +00:00
Stephen White 85a4282de6 GLSL: perform Y flip in vertex shader.
Change-Id: If7d038b4739f475bd26e0f7b3eaeec364df35ad5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67860
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-10-28 19:24:48 +00:00
James Price 2f17549702 resolver: Add test for sem::Function::CallSites()
Fixed: tint:835
Change-Id: I22bc5d478061afbc279a0e881e4c1eeb0183c68a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67645
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-28 15:00:39 +00:00
James Price 8d7551cc27 Add a helper for DisableValidationDecoration
This is slightly different from the other helpers, since this AST node
does not have a source.

Change-Id: I56e72eb0f26f80d52be9e4f51dd42c3d5149cb00
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67644
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-28 15:00:39 +00:00
James Price e548db90f6 msl: Handle buffer variables in transform
This removes a lot of awkward logic from the MSL writer, and means
that we now handle all module-scope variables with the same transform.

Change-Id: I782e36a4b88dafbc3f8364f7caa7f95c6ae3f5f1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67643
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-28 15:00:39 +00:00
Stephen White c6ce5785d0 GLSL: don't emit "set=<group>" layout qualifier.
Only Vulkan-flavoured GLSL has these. Dawn will have to pack
everything into the binding= decoration for OpenGL.

Bug: 1223
Change-Id: I7ffdbc1b2f37e176411c41e4ff65b93b8f0f5ec6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67640
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-10-28 11:49:28 +00:00
Shrek Shao 97c692d337 Support reflecting if pipeline overrideable constants has numeric ID specified
Bug: tint:1155
Change-Id: I362adf36a84ed470fa1bf7ab2c9a1fbe0a54da5a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67602
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-10-27 19:33:37 +00:00
Ryan Harrison e7ca884b3d Add seed value constructor to DataBuilder
This is needed for experimenting with alternate fuzzing frameworks
that can generate a seed value without needing to hash the input.

Change-Id: I8207fd16c83265268c7e5764b707456e59f79a07
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67501
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-26 16:30:42 +00:00
Ben Clayton 6c4effe654 writer/spirv: Fix [[override]] for zero-init defaults
These expressions were not emitted as spec-ops, failing new CTS tests.

Change-Id: I56e8f56a22de2b8dac9a8bd7a2d694d8d81dca35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67480
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-10-26 10:05:02 +00:00
Stephen White 0436d045ab GLSL: ensure interface blocks have unique names.
Bug: tint:1260
Change-Id: I59aeb7272462c80bfb739c6f4759327d12145ac8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67440
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-10-25 19:53:01 +00:00
James Price 91689fb6f0 Add support for matrix construction from scalars
Use a transform to convert these to the vector form for the MSL and
SPIR-V backends.

MSL only has the scalar form from version 2.0 onwards.

Fixed: tint:1123
Change-Id: I384abd9872d9eae52a10a37cbd6aa96004692e9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67360
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-25 19:20:31 +00:00
Ben Clayton c73b57f2c6 Address late review comments from 67064
Use spec-spelling of 'constructible'.
Add missing test file to 'test/BUILD.gn'

See https://dawn-review.googlesource.com/c/tint/+/67064

Change-Id: Ie39773617fd0a363d63cc6449bf3905c9eb6786d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67380
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-25 14:26:55 +00:00
Ben Clayton 33c13c6e28 writer/hlsl: Do not emit `(void) call_expr;`
Just emit `call_expr;` instead.

Fixed: tint:1259
Change-Id: I84a2976d82f891e9263f3e11e5774fcb01ea09bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67381
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-25 11:00:44 +00:00
Ben Clayton 7b776f18b0 Deprecate Ignore()
It's been removed from the spec:
https://github.com/gpuweb/gpuweb/pull/2127

Fixed: tint:1213
Change-Id: I163fe807765bb1ac0580b398f4897daea555216a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67067
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-22 06:23:12 +00:00
Ben Clayton c2fa68e551 Migrate more tests from Ignore() to phony-assignment
The `Ignore()` intrinsic is about to be deprecated, so don't use it for testing.

Bug: tint:1213
Change-Id: I314ecaeb9a9c337c7b6980189054120a74807ebd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67066
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-22 00:21:44 +00:00
Ben Clayton cc7c4f309b ProgramBuilder: Migrate away from using Ignore()
The `Ignore()` intrinsic is about to be deprecated, so don't use it for testing.

Bug: tint:1213
Change-Id: Ib5d5966da6d566a9f02940970ebd79d520b5e0e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67065
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-21 23:28:44 +00:00
James Price a41694e9a3 validation: Allow interpolate(flat) on integral IO
Produce a warning if the attribute is missing for integral vertex
outputs or fragment inputs. This will become an error in the future,
as per the WGSL spec.

Add the attribute to E2E tests.

Bug: tint:1224
Change-Id: Ia1f353f36cb7db516cf9e8b4877423dec3b3e711
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67160
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-10-21 23:08:44 +00:00
Ben Clayton 1aa98e62c0 Implement phony assignment
Bug: tint:1213
Change-Id: Ib1ebc4947405c4ada7a9bdbc6bd5a36447bbd234
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67064
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-21 23:04:44 +00:00
Stephen White 092326894e GLSL: emit UBO and SSBO interface blocks.
Do not emit block-decorated structs.
Combine them with the variable into a uniform or buffer interface block.

Bug: tint:1223
Change-Id: I16263ea449ecab705319dc440275b7d169021bc9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67243
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-21 21:24:14 +00:00
Stephen White 1e896001e6 GLSL: Don't use a typedef for array returns.
Covered by GlslGeneratorImplTest_Function.Emit_Function_WithArrayReturn

Bug: tint:1258
Change-Id: I181641ebe170ec359d9833e9022e6e70747fde9a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67240
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-10-21 20:43:15 +00:00
Ben Clayton f164a4a723 ast: Add TraverseExpressions()
An ast::Expression traversal helper extracted from Resolver.

Change-Id: I88754cbc86cc12cbf8348fb36a3f038904017f3d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67202
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-10-21 20:38:54 +00:00
Ben Clayton 72789de9f5 resolver: Remove rule that call statements to functions must return void
Fixed: tint:1256
Change-Id: Ibff78a1009d57afd7af8867952a9444daaf13a9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67201
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-10-21 20:36:04 +00:00
Stephen White 38ed53ce8f GLSL: factor out the emission of struct members.
This will be needed for emitting UBO and SSBO interface
blocks.

Bug: tint:1223
Change-Id: I1cdc75b67a4fe612dcf8094a7d73b8bf1f85f40a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67242
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-10-21 19:49:44 +00:00
Ben Clayton 8fca34546b ast: Add PhonyExpression
Represents the `_` in a phony assignment `_ = <expr>`

Bug: tint:1213
Change-Id: Ifb070277b7872aa5ae405e467e28191e625c4c5a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67062
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-21 18:33:14 +00:00
Ben Clayton 042bd02747 fuzzers: Fix build
error: identifier 'writeonly__bindings' is reserved because it contains '__' [-Werror,-Wreserved-identifier]

I see no reason for the local variables, so I've just removed them.

Change-Id: Ib4047e12d5b55a204c56b06196052fef04def97d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67200
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-10-21 17:21:04 +00:00
Ben Clayton 8cab28c9f9 intrinsics: Add scalar overload of all() & any()
Fixed: tint:1253
Change-Id: I0bdc865a9df9e0171c09daa9918b25bba033ba3b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67061
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@chromium.org>
2021-10-21 09:39:13 +00:00
David Neto 347c74e671 wgsl: decimal float: point is optional; can use E for exponent
Also: Check for too-small non-zero magnitude on negative numbers too.

Fixes: tint:1255
Change-Id: I3c231ce197c56e1ec517708b8073d49a8ae67ccb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67100
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-10-20 22:07:43 +00:00
Ben Clayton e81d7dc3c8 reader/wgsl: Lex underscore tokens
Bug: tint:1213
Change-Id: Ic5f2bfb2da0bf0f9511f029a93c7007266b2984c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67063
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-20 19:59:23 +00:00
Peter Kasting 0da0c95dc3 Silence -Wunused-but-set-variable in new code.
Bug: chromium:1203071
Change-Id: Id94bf93784f939c212c8da2be4755160cfb9f8e0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67081
Auto-Submit: Peter Kasting <pkasting@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-10-20 19:33:53 +00:00
Ben Clayton 7103f51603 writer/msl: Fix swizzling on packed vectors
Metal 1.x does not support swizzling on packed_vec types.
Use array-index for single element selection (permitted on LHS and RHS of assignment)
Cast the packed_vec to a vec for multiple element swizzles (not permitted as the LHS of an assignment).

Fixed: tint:1249
Change-Id: I70cbb0c22a935b06b3905d24484bdc2edfb95fc2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67060
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-10-20 16:12:33 +00:00
Ryan Harrison 8645953be2 Refactor Inspector fuzzing
It is always on now when using tint::CommonFuzzer, and runs before &
after the transform step.

This CL also adds missing API coverage to the Inspector fuzzing code.

Errors found with the Inspector are now reported as fuzzer failures
and should generate bug reports.

BUG=tint:1250,tint:1251,tint:1250

Change-Id: I1c1bcbddf81a35620f89c5b7a648c44e6a1f2952
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66980
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Alastair Donaldson <afdx@google.com>
2021-10-20 05:01:03 +00:00
Alastair Donaldson 54180d6631 Remove WGSL and SPIR-V reader fuzzers
Fuzzing of the WGSL and SPIR-V readers is well covered by fuzzers that
do both reading and writing. This change removes the fuzzers that only
do reading.

Fixes: tint:1254
Change-Id: Ice93016a6e95be7a2e8418387c35f20be13266e5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66923
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-20 00:59:31 +00:00
Alastair Donaldson c34f08dd45 Turn fuzzers' FatalError into a macro
To enable better bug de-duplication with ClusterFuzz, FatalError has
been turned into a macro. This means that frames one step further down
the stack are considered by the de-duplicator.

Change-Id: Ib5e4a87c9333960178fa17fafff38815293fb053
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66921
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-10-19 20:58:43 +00:00
Ben Clayton 8648120bbe Make all ast and sem pointers const
And remove a whole load of const_cast hackery.

Semantic nodes may contain internally mutable fields (although only ever modified during resolving), so these are always passed by `const` pointer.

While all AST nodes are internally immutable, we have decided that pointers to AST nodes should also be marked `const`, for consistency.

There's still a collection of const_cast calls in the Resolver. These will be fixed up in a later change.

Bug: tint:745
Change-Id: I046309b8e586772605fc0fe6b2d27f28806d40ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66606
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-10-19 18:38:54 +00:00