Make all test programs valid.
Change-Id: Id7eb790519e3dec30a5b826f06585d277995b9b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50720
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>
Move the doxygen CMake output from `out/docs` to `<build>/docs`
`out/docs` requires a GN build or manual directory creation.
Fixed: tint:791
Change-Id: If072f962f444a2d60c368d7c38fd1bb4c5b97caf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50309
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
WGSL only has vector normalize, not scalar.
Scalar normalize is always 1.0, so return that directly.
Bug: tint:765
Change-Id: I08332c20922f5834f65284b9aaeb22995423171d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50603
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Emit AST equivalent to:
var foo: sampler;
instead of
var<handle> foo: sampler;
This is necessary to pass new checks in the resolver.
Change-Id: I5eca30ace5871086bc3c1783cde2225f1aee34ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50602
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
But I liked the comment where it was.
I think the linter was wrong, but it doesn't like my argument.
Change-Id: Ie3bb6e2b4bd08fae6d72a076622b1e74f517f23c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50680
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Bug found when passing program through spirv writer and then reader.
This failed in the writer.
Bug: tint:792
Change-Id: I512798240710fd262da81a73d6646deb975ac5e9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50563
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This has been moved into the Spirv sanitizer, and Dawn is now using
this path.
Change-Id: Iffcbbc1c84e6bad0ebc51ded82d998bb307e2d6d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50564
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Bug found when passing program through spirv writer and then reader.
Bug: tint:792
Change-Id: I2acb17554b122c840cf3cc69149f6e004fb37bc7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50562
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Adds a transform that adds an additional 'level' parameter to textureLoad calls
when used with a texture_external. Adds a test for the textureLoad
transform. Additionally adds a test for calls to textureDimensions with
a texture_external.
Bug: dawn:728
Change-Id: I613ce8185e9a4c49529fd8e48323e586c95dde04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50420
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
The only multisampled texture type supported by WGSL is
texture_multisampled_2d
Fixed: tint:780
Change-Id: Ie968311c802f858d087a411cda8f336627ad657b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50446
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
Bug found when passing program through spirv writer and then reader.
Bug: tint:792
Change-Id: I904b959ba1d540b4377f8b9027286182ee0c34e9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50561
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This was originally used to find and fix tests that were not
initializing constants, but these were independently fixed by jrprice@
recently (see https://dawn-review.googlesource.com/c/tint/+/50042)
recently. Still, this change is useful to avoid this happening again.
Bug: tint:792
Change-Id: I0119a1a6ade7a70a0d110ef0aac80f4eaf37a7b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50560
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Validate that:
* That resource variables have resource bindings
* Only resource variables have resource bindings
* That a [[binding]] decoration is paired with a [[group]]
* That binding points are not reused in the same entry point
Fixed: tint:235
Fixed: tint:645
Bug: tint:645
Change-Id: I2542934b4c6a2b4bbde48242932c04c796033a90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50500
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
These originate from a time before Castable, and there were hand-written Is<T>() methods on each of the base types.
Castable has its own tests that ensure the Is<T>() and As<T>() work as expected.
We don't need to check that this logic works for every type that derives from castable.
Change-Id: Iaa376dc4b4b5ee413a83fc5f9113cd3ef91dfe4a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50540
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Give them sensible names.
Make them act consistently.
Remove those that were not used.
Change-Id: Ib043a4093cfae9f81630643e1a0e4eae7bca2440
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50305
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
We don't want the WGSL parser to have to maintain type lookups.
If the WGSL language is updated to allow module-scope variables to be declared in any order, then the single-pass approach is going to fail horribly.
Instead do the check in the Resovler.
With this change, the AST nodes actually contain the correctly declared storage class.
Fix up the SPIR-V reader to generate StorageClass::kNone for handle types.
Fix all tests.
Bug: tint:724
Change-Id: I102e30c9bbef32de40e123c2676ea9a281dee74d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50306
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
With the parsers now using ast::Types, nothing should be producing these any more.
This change also removes Resolver::Canonical(), which is now unneeded as there are no sem::Aliases to remove.
Bug: tint:724
Change-Id: I0c1a49f49372c1fcc37864502f07c5c76328d471
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50304
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Don't create disjoint AST type nodes.
Instead use a new bespoke type hierarchy that can Build() the required
AST nodes.
Change-Id: I523f97054de2c553095056c0bafc17c48064cf53
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49966
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>
Adds the external texture transform to always run in the spirv, msl, and hlsl writers.
Bug: dawn:728
Change-Id: I15a96e877e1e88f9a4a4b015cf47251b41b18e35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50024
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
WGSL now supports type inferencing with `let` declarations, so `var->type()` may return nullptr.
Calling a method (`Is<T>()`) on a nullptr object is UB. Instead used the free-function form which can handle nullptr objects.
Change-Id: I8faf875e1550eac1306ad731a65f3662bc4e5b43
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50307
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <brandon1.jones@intel.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Using semantic info.
Change-Id: Iec9a592d9d66930535ead78fab69a6085a57a941
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50302
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
There's now no need to have both.
Removes a whole bunch of Sem().Get() smell, and simplifies the resolver.
Also fixes a long-standing issue where an array with an explicit, but equal-to-implicit-stride attribute would result in a different type to an array without the decoration.
Bug: tint:724
Fixed: tint:782
Change-Id: I0202459009cd45be427cdb621993a5a3b07ff51e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50301
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
BUG=tint:773
Change-Id: I94e8624647c645efe7ed558caa3d3bd05dd72f63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50260
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This makes it easier to triage test failures.
Bug: tint:765
Change-Id: I72d12e9eff3466d3d02952edce14499a61a4782b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49842
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
If a directory is specified, then check shader source files there.
Otherwise, use shader source files in the same directory as the test
script.
Enhance error checking and messages.
Change-Id: I6ea40e2a44128ba3ce103faaad5326b89bbf4ed7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49841
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
BUG=tint:753
Change-Id: Idb1f942defe6233421ea735a56bab8da8add8024
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50360
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
There's now no need to have both.
Removes a whole bunch of Sem().Get() smell, and simplifies the resolver.
Bug: tint:724
Fixed: tint:761
Change-Id: I756a32680ac52441fd6eebf6fc53dd507ef5e538
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49961
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>