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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
BUG=tint:779
Change-Id: Ibcedb998671dd2bf189cc795299ea92846196ade
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66780
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
BUG=tint:1247
Change-Id: I48f7b1e1679bcba43e4c284b2f97a02210feabb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66740
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Defining a destructor for the RandomGenerator would
throw an error when calling the copy constructor of
the class.
Change-Id: I1cff86cb75b2e252a52e3fbd03ecb08e7a11b519
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66181
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
The new test proves that the algorithm needs to advance 'pos'
past the replacement string.
Change-Id: Ia8fdf6b2c08d6af09e8e631c1d8661752edcb7ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66660
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
When using Tint as a subproject of another CMake project.
Change-Id: I4acdc2d2965b2fa770101c8a21ad23d8dba9adcc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66604
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
ast::Node has a deleted copy constructor, so the derived classes cannot be implicitly copied.
Change-Id: I57f74a4ab35dd00b3290b964cb6492f4fa4505a5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66602
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Methods and functions are `CamelCase()`
Public fields are `snake_case` with no trailing `_`
Private fields are `snake_case` with a trailing `_`
Remove pointless getters on fully immutable fields.
They provide no value, and just add `()` noise on use.
Remove unused methods.
Bug: tint:1231
Change-Id: If32efd039df48938efd5bc2186d51fe4853e9840
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66600
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
We previously rejected nested structures for entry point IO only if
there was an attribute on the member in the outer struct. This change
rejects all nested structures instead.
Change-Id: I0d30c8521141154a63915e6c6d8fa31bc23f310e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66520
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
These are legacy methods that were written before the semantic type nodes.
These methods do not consider aliases, and any use of these is likely to be broken for aliases.
Fix up uses of these methods to use the semantic types instead.
Change-Id: Ia66749b279eddff655d3d755fef54a6263643e69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66601
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This is causing code bloat. Move common code out to a single function that's implemented in the .cc file.
Saves about 25k from the all-features-enabled Release build of tint for x64.
Bug: tint:1226
Change-Id: Idc2fef1b9ca92a2f48dfc5e252a3853721d048aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66447
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
These constructor parameters of StructMember take a uint32_t.
The compiler will normally warn / error about this, but there's some quirk of std::make_shared that makes the compiler silence this warning (possibly because the constructor call is in the STL?).
Was noticed when experimenting with BlockAllocator::Create() to reduce binary size.
Change-Id: I8cdf5078150927e5624752ee7374305c0a5982f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66448
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This is causing code bloat. Move common code out to a single method that's implemented in the .cc file.
Saves about 10k from the all-features-enabled Release build of tint for x64.
Bug: tint:1226
Change-Id: I80b76e69521c3cc890c74b4bc73a68f1c9bdd3df
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66446
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This is no longer used.
Fixed: tint:1225
Change-Id: I0cfe9955687a2b7ded3e645c573f3bffbc2f1f84
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>