Commit Graph

2072 Commits

Author SHA1 Message Date
Ben Clayton 09587e1d86 reader/wgsl: Parse '&' and '*'
Bug: tint:727
Change-Id: I1a2c93017b934fd0884570412f5ed25bf15991bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50820
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-13 16:56:32 +00:00
David Neto 2ef8033212 Add SPIR-V translation scheme for ptr-ref
Change-Id: I2a9871dafe675abe2b2cfe8e2ee689f96323029f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50803
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-13 16:37:12 +00:00
David Neto fa960335a6 Update SPIRV-Tools, SPIRV-Headers
Pull in validation fix
https://github.com/KhronosGroup/SPIRV-Tools/pull/4277
which is the root fix for crbug.com/tint/793

Change-Id: If7997617c8402144bc6e24aa65c8f6200f4afbe4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50804
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
Commit-Queue: Alan Baker <alanbaker@google.com>
2021-05-13 14:03:12 +00:00
Ben Clayton 52b06fb4c5 ast: Add address-of and dereference unary ops
Nothing currently generates these.
Resolver currently doesn't know how to handle these.
Backends currently stubbed enough to build without warnings.

Bug: tint:727
Change-Id: I4b9863ae098b903b51a63c36c10bc6e390efbbb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50746
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-13 13:36:32 +00:00
Ben Clayton 688fe4477d writer/wgsl: Cut dependencies on sem info
There's now one remainin use of the semantic info in the WGSL writer - the transformation of [[offset]] into padded fields.
This does not belong in the WGSL writer, but instead part of the transform::Wgsl sanitizer.

Bug: tint:798
Change-Id: I95ba11f022c41150cc12de84a4085cd7d42019fe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50822
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-13 12:38:12 +00:00
David Neto 9b1ee6bdea spirv-reader: HLSL-IO: Emit entry point as wrapper
Bug: tint:508
Change-Id: I68fa85726c5223b020a323a3d65b062133e96232
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49120
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-12 21:09:41 +00:00
Ben Clayton f6c84e4d45 Use StorageClass::kNone for ast local var decls
To declare a local variable, we write `var name : type`, not `var<function> name : type`.
This change fixes all the places where we were feeding StorageClass::kFunction into variable declarations.

Note that the resolved, semantic variable correctly infers the `kFunction` StorageClass.

Change-Id: I6221fabae1de0435044f29b9a91808421d5cace6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50821
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-12 21:08:22 +00:00
David Neto 884a4e2172 spirv-reader: Refactor decoration-getting for vars
Bug: tint:508
Change-Id: Ib176eb5e0dfdd6901635a9dd627aa9c7316f0a80
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49301
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-05-12 17:02:51 +00:00
Ben Clayton bd65d8ecbd Remove cpplint from DEPS
And update tools/lint to use cpplint.py from path.

DEPS was fetchling cpplint from `{chromium_git}/third_party/cpplint/google/styleguide`.

This repo no longer contains cpplint, and now instead is maintained in depot_tools.

The version in depot_tools contains a fix for python3.

Fixed: tint:794
Change-Id: I06c3f8a628ffa3e70887464b1da063b465c05c65
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50743
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-12 15:24:51 +00:00
David Neto 858d7a33f1 spirv-reader: valid SPIR-V in function_var tests
Bug: tint:765
Change-Id: Iab3eb6f612150153abfcd87a702c9a24ee5cf66a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50605
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-12 14:35:51 +00:00
Ben Clayton 3103a1f666 BindingRemapper: Allow for binding point collisions
Add a new parameter to BindingRemapper::Remappings that allows resulting binding points to collide.

When enabled, the output of the transform contains two or more module-scoped variables with the same binding point, used by the same entry point, then these variables will be decorated with an internal decoration to disable validation for the collision.

This is to work around collisions generated for the HLSL backend where the variables actually exist in different register classes, which is permitted by D3D12.

The transform will only generate these decorations if it needs to.

Fixed: tint:797
Change-Id: Id8a87523801bd0cd0dd54227ebabd4299bc20c27
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50742
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-12 13:30:51 +00:00
Ben Clayton 451f2cc68a Add ast::DisableValidationDecoration
An [[internal]] decoration that specifically disables certain validation checks.
Begin with a single kFunctionHasNoBody mode.
Migrate the Resolver to using this instead of allowing any InternalDecoration to disable the checks for no-body.

Bug: tint:797
Change-Id: I213b9a6844a456775ede06d60e456d9f77a449d0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50741
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-05-12 12:54:21 +00:00
Ben Clayton ad393296d5 Fix all linter warnings
Change-Id: Ic55036ea8fee583ffe81fb6345ec3870d368302d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50745
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-05-12 11:33:51 +00:00
Ben Clayton 5df7661659 Resolver: Move common logic into Variable()
Variable() is called for globals, locals and parameters. Much of the logic is the same.

Move all the common logic down into Variable(). This:
* Removes some yucky default parameters
* Adds type validation that was missing for globals (broken tests fixed)
* Gives me a single place to implement the Reference type wrapping

Bug: tint:727
Change-Id: I70f4a3603d7fa781da938508aa2a1bc80ec15d77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50580
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-05-12 10:41:21 +00:00
Brandon Jones ecd31c5ee6 Remove texture_external overload for textureSample and add textureSampleLevel
Removes the texture_external overload for textureSample and replaces it
with a texture_external overload of textureSampleLevel to match merged
spec. Adds a transform that adds the implicit level parameter to
textureSampleLevel. Modifies unit tests to reflect change.

Bug: dawn:728
Change-Id: I2dbc9232b4343db1075be79fda0054231860f3b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50701
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-12 10:37:03 +00:00
James Price 42f8999af5 writer/wgsl: Ensure that test programs are valid
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>
2021-05-12 10:06:21 +00:00
Ben Clayton 4ace822c4b Kokoro: Check lint and doxygen
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>
2021-05-12 08:15:41 +00:00
David Neto 6344d4c2f5 spirv-reader: Substitute 1.0 for scalar normalize
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>
2021-05-12 04:35:01 +00:00
David Neto 32b5018c5d spirv-reader: Don't mention handle storage class
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>
2021-05-12 01:14:01 +00:00
David Neto facd33199a spirv-reader: textureDimensions returns 3-elem vec for Cube,CubeArray
Fixed: tint:787
Bug: tint:765
Change-Id: If5cebb21bf169765f3baf8a5aec4a3dace19d707
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50601
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-05-11 23:16:31 +00:00
David Neto b5236b2783 Fix linter complaint
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>
2021-05-11 18:32:52 +00:00
Antonio Maiorano ce0b1c1c88 Fix test: "matrix scalar element type must be f32"
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>
2021-05-11 14:26:40 +00:00
James Price 77daee15bd Remove legacy EmitVertexPointSize transform
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>
2021-05-11 13:16:10 +00:00
Antonio Maiorano fe7f7b33fb Fix test: "No OpEntryPoint instruction was found"
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>
2021-05-11 13:11:30 +00:00
Brandon Jones 97a7d266e0 Transform textureLoad calls for texture_external
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>
2021-05-11 10:35:43 +00:00
David Neto 5a839b5818 spirv-reader: handle tests, valid SPIR-V, part 5
Bug: tint:765
Change-Id: I77772e8105da9d52baa996919a39dc7a85dbedcd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50460
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-11 04:31:53 +00:00
David Neto 2e80c83d7b spirv-reader: handle tests SPIR-V validity, part 4
Bug: tint:765
Change-Id: I6c25ed2c9d40d686e75517815b9d31d544d913ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50424
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-11 03:43:43 +00:00
David Neto b7b30b7598 spirv-reader: fix texel type for textureStore
Fixed: tint:381
Change-Id: I7521bac842b59c16c596e1cea39a14700a9e7f9a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50449
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-11 02:15:23 +00:00
David Neto 3dcf2398b7 spirv-reader: handle tests SPIR-V validity, part 3
Bug: tint:765
Change-Id: I22a4851218a3dbcc95d17334e6c6ff41393c7016
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50448
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-11 01:47:43 +00:00
David Neto cc1e9e04fd spirv-reader: fix Grad-based tests
Bug: tint:765
Change-Id: I5512553a27e8f3f8d00b72c5039fb489450e3874
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50447
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-11 00:39:03 +00:00
David Neto 36eba06811 spirv-reader: remove multisampled_2d_array support
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>
2021-05-10 23:20:23 +00:00
David Neto 716299075a spirv-reader: handle tests: make valid SPIR-V, part 2
Bug: tint:765
Change-Id: Ide499367637c460ebc1083da1de90b47ece21280
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50445
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-10 22:21:43 +00:00
David Neto 65a60c5c31 spirv-reader: handle test: make valid SPIR-V, part 1
Bug: tint:765
Change-Id: Ie203b6ee6ec481e9ff87421969723e2f4e77d9aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50444
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-10 21:26:06 +00:00
Antonio Maiorano f25ad24d1b Fix test: "unknown case statement" from spirv reader
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>
2021-05-10 21:11:36 +00:00
David Neto 1959cdec99 spirv-reader: rename test class for handle tests
Bug: tint:765
Change-Id: I8eb5eb40d2014c770a90f0ec74fed19f8203ece3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50443
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-10 20:57:06 +00:00
Antonio Maiorano e0448d3d64 ProgramBuilder: make Const helpers require a constructor arg
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>
2021-05-10 20:42:56 +00:00
David Neto a083f329a7 spirv-reader: import tests: make valid SPIR-V
Bug: tint:765
Change-Id: If6dc558a86bb64dfb7f61d237e774f41f735c732
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50442
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-10 20:34:26 +00:00
Ben Clayton ad19a63c54 Add sem::Reference
Bug: tint:727
Change-Id: I904d33b6c0678f478b4687fcc08589dc3cfd379d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50541
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-10 19:45:46 +00:00
Ben Clayton 3f968e7b05 Resolver: Validate resource binding decorations
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>
2021-05-10 19:16:46 +00:00
Ben Clayton 6ba446fa5e Remove "Is" tests
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>
2021-05-10 18:27:31 +00:00
Ben Clayton eebf0c97d9 Fix lint errors
Change-Id: Ia31d9fed7c9695e7f3e4d26fc3acf073ef42002d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50308
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-10 18:21:36 +00:00
Ben Clayton f14e0e1c8c Rename all type UnwrapXXX() methods
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>
2021-05-10 18:06:31 +00:00
Ben Clayton fcda15ef67 Move storage_class validation from wgsl to resolver
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>
2021-05-10 18:01:51 +00:00
Ben Clayton a34fa0ecb7 Remove sem::Alias
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>
2021-05-10 17:38:01 +00:00
Ben Clayton cbbe576415 reader/spirv - add type hierarchy
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>
2021-05-10 17:25:21 +00:00
Brandon Jones c705b6caac Add external_texture_transform to backend writers
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>
2021-05-10 16:15:31 +00:00
Ben Clayton 8f96595540 ExternalTextureTransform: Fix undefined behavior
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>
2021-05-10 16:06:51 +00:00
David Neto 1f68519dee spirv-reader: make valid SPIR-V for derivative tests
Bug: tint:765
Change-Id: I81a905e73d7435d85cffab4ff804934015de065b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50441
Reviewed-by: Alan Baker <alanbaker@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-05-10 16:01:11 +00:00
David Neto 799cecedb7 spirv-reader: rename test class for GetDecorationsFor
Bug: tint:765
Change-Id: I2b9a78baf45ba20168e23209f5d4cbf9bb231c7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50440
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Alan Baker <alanbaker@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
2021-05-10 13:54:06 +00:00
Antonio Maiorano 9fdfa1e323 Resolver: validate else condition is boolean
Bug: tint:786
Change-Id: I5e4987e4eeb0608c640fc5c8ea035c8dca0ef187
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50461
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-05-10 13:46:06 +00:00