If the abstract numeric cannot materialize to the target type, we could
ICE before the validation handles this bad case. To fix, simply hoist
the validation earlier.
Bug: chromium:1337524
Change-Id: Icc603b056900131cfdb029b517f1c3d030b2ecb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94322
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Split the logic out of Resolver::Variable().
Primes the resolver for the introduction of 'const'
Bug: tint:1580
Change-Id: Id67280ed5c8c73a69c62728fb5a81a08f13628a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93785
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Split the logic out of Resolver::Variable().
Also correctly allows type inference of module-scoped 'var's.
Fixed: tint:1584
Change-Id: I32eb11f0a847775137fef937da6f4032a3b3c2b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93784
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
For this transform, this will help when we promote private variables
to function scope when only referenced by a single function.
Bug: tint:1509
Change-Id: I04f7b8e1a8531a13317617604a49cafe4f7d47f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94001
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
It's not valid for an explicit template specialization to declare a storage class (`static`). GCC correctly catches this, while Clang is too relaxed.
Use C++17's 'inline' instead. The alternative is to push the initializers and values into the cpp file.
This breakage was introduced in: https://dawn-review.googlesource.com/c/dawn/+/93604
Bug: dawn:1451
Change-Id: Ib3e61d233e16fd7828f8a2ae0909eedbd24ee52e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Split the main Process() function up into smaller functions to make it
less unwieldy.
Change-Id: Ibbe3141a82221879b9d4ed232eebdd0344f1698c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94000
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This uses the variadic template arguments to Client::Make to
pass more data to object constructors and move the copying of data from
descriptors into the constructors.
This required adding a descriptor to the textures created in
ReserveTexture. The descriptor should come from the outside to give the
correct reflection data to textures (for example textures from
GPUCanvasContext). So a descriptor argument is added to ReserveTexture
that currently defaults to nullptr, but will be required once current
uses are updated.
Bug: dawn:1451
Change-Id: I44cbd5718b8d75fdde3ab1321d24f69a8e2486de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93142
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL removes the src/include folder which was used to forward old
header includes to the new include/ location. The various BUILD rules
which referred to these folders are also removed.
Bug: dawn:1275
Change-Id: Ic0bdc8cf900833af25199ee3e41708953c7c1eec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94026
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL fixes build issues seen on the fuzzers when they disable
logging.
Bug: chromium:1337052
Change-Id: I91f6853a7550ccbffb924a5fb65cd89086f78853
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94241
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The depot_tools cpplint.py has been updated to accept the c++17 headers
so we no-longer need to mark with NOLINT.
Bug: dawn:1379
Change-Id: I938a4cac5ca881cd1b556f4b8d58741b6a1e6af1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94240
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Now that we have untyped literals, we can just add `1` rather than
adding either `1u` or `1i`.
Bug: tint:1488
Change-Id: I59512be8fc67b1bf45088478da7c93bed37a69b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94141
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit changes all the [Object]Allocators from the Client into a
PerType<ObjectStore> member that contains a bunch of ObjectStore acting
on ObjectBase.
Adds a new (template) member functions to the client, Make/Get/Free that
act on any object type, and update all the uses of previous
[Object]Allocator to use these new methods.
Also removes generated code that was generated per object type in favor
of using the type-generic ObjectAllocator.
Bug: dawn:1451
Change-Id: I6463b2fc4a827e3000c2a666abf08aa1a71c3b3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93141
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This change allows the DepthClipControl struct to be chained on the
render pipeline descriptor, but disallows it from being used unless
the feature is enabled. The feature is not enabled on any backend
yet.
Bug: dawn:1178
Change-Id: I37f5c991103dd86c0e61a6ad8cd71cbd86401a9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93948
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch make VectorizeScalarMatrixConstructors transform run for
reference to scalar as well as scalar types node, i.e. run for
`mat2x2<f32>(v[2])`, where `v` is a f32 vector, as well as
`mat2x2<f32>(1.0)`.
Bug: tint:1589
Change-Id: I5d3e367ee6a9826b3e1add3495aaac0ae326be14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94023
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This Cl moves the contents of the test/tint/BUILD.gn file into the
src/tint/BUILD.gn file. This moves the tests into the same build file as
what is being tested. This is more in line with how the CMakeLists.txt
file is setup.
This removes the need to update 2 BUILD.gn files when adding new files
and tests to tint.
Bug: tint:1517
Change-Id: I9beb8a8bff7c10ac875647246ad4362f7e60f7da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94040
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Validating sampled and multisampled texture types does not belong in Validator::Variable().
Change-Id: Ie0f2502508c28af6fb6d3f4d7803171d946c511b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93783
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Add the new classes:
* `ast::Let`
* `ast::Override`
* `ast::Parameter`
* `ast::Var`
Limit the fields to those that are only applicable for their type.
Note: The resolver and validator is a tangled mess for each of the
variable types. This CL tries to keep the functionality exactly the
same. I'll clean this up in another change.
Bug: tint:1582
Change-Id: Iee83324167ffd4d92ae3032b2134677629c90079
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93780
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch fix the issue that HLSL generator emit wrong constant
element index for vectors with all elements being the same, which may
cause error when emitting a matrix constant with sub columns having
identical elements.
Corresponding unit test is implemented.
Bug: tint:1588
Change-Id: Ia40b3f1a676d84aadaa5ce900677547fb15abe7f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94041
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
The generators were not setting `emit_continuing_` when emitting while
loops. This caused a crash when a `continue` was encountered. This CL
adds the `emit_continuing_` setup to the while emission. It also guards
the `emit_continuing_` usage with making sure the function is setup.
Bug: tint:1490
Change-Id: Ia89c49e567acda71a1f851a582103723cff71d49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93960
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
The while loop and let error message landed about the same time and there were
merging issues that didn't get caught by CQ.
Change-Id: I5cd606f1809cc29fa2366d3b78883fa0cfc3b394
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93961
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Standarize the messages, using 'let', 'override' or 'var'.
Module-scope 'let' needs to be replaced with 'const', but baby steps.
Bug: tint:1582
Change-Id: I290aede118a30ab0f4294c89ec43005371c87b45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93446
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This patch change DependencyAnalysis::SortGlobals() to make sure that
'enable' directive nodes go before any other global declarations in the
sorted global node list, and thus ensure that all extensions will be
registered by reslover before dealing with any other global declarations.
This is necessary because some transforms will add AST nodes before any
other global nodes, and these added nodes should be handled by resolver
after 'enable' nodes are handled.
Bug: tint:1472
Change-Id: Idc2253fc055b0f121cb0cafcaca5275c23ed7b0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93760
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Copy/pasting this transform as a starting point for new transforms
causes the `State` classes to clash, and weird things happen. This
prevents that from happening.
Change-Id: Ia1c6b2b96e4d6375309aed535d7a87372b839792
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93880
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The new spelling `smoothstep` was introduced in M102.
Fixed: tint:1483
Change-Id: Ia5e1401f8f09450a3a767b0bb975216bd85be8db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93360
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Currently nothing in Tint uses a different allocator type, but this
allows the CloneContext to support different allocators, the day we do.
Change-Id: I70367bd3710128d0708b3369f66b441344b789f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93602
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Parameters don't have storage classes or access qualifiers. This was
just (ab)using the fact that a parameter uses the same AST type as a
'var'.
Also simplify the parameter disable validation logic.
Bug: tint:1582
Change-Id: Ic218078a410f991e7956e6cb23621a94a69b75a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93603
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Add a validation to ensure zero-attribute for unused vertex
buffer slots (stepMode = VertexBufferNotUsed).
Fuzz tests found that non-zero-attribute with unused vertex
buffer can cause an error in swiftshader.
We may be able to think input data having non-zero-attribute
with unused vertex buffe is malformed. Refusing such input
data can avoid the error.
Bug: chromium:1333293
Change-Id: Ib58d526bdaefa683e459b5c813e348b72e81e13e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
Kokoro: Kokoro <noreply+kokoro@google.com>
This is currently identical to ast::VariableList, but once we break
ast::Variable up, this will become a different vector type.
Bug: tint:1580
Change-Id: Ib2db5772996a63cd1989e36f1034dc1fbd3b371a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93601
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Drop the vector typename from the initializer lists. These don't really
provide any significant help in understanding the arguments types, as
the list of element types can be easily inferred.
This is done to simplify the refactor ast::VariableList ->
ast::ParameterList.
Bug: tint:1580
Change-Id: Ibf8564ca9b2bafd2eaa2e4aa54c29be6bbe7a682
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93600
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>