This enables usage with DAWN_TRY_ASSIGN in Dawn in simplify error
handling.
Bug: tint:306
Change-Id: I91a96b6670341943c26d9972058ecc3ad8162db0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34640
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds the Move constructor to castable base as the default one is
deleted due to the defined destructor and the Node subclass defines a
Move constructor.
Change-Id: I0eaac140719e74adfab1aeccf6ea663faff031e5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34580
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Both OpImageRead and OpImageFetch map to WGSL textureLoad.
Bug: tint:109
Change-Id: I3c99840c2e62c52dcaaf7177773a3c972de90cc1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34425
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
This CL updates the WGSL-Reader to remove the decoration keywords as
they are no longer reserved in the spec. The old `::` token is removed
as well as namespaces don't exist anymore.
Change-Id: I1dfa16c1d7e4866f6c2f9ea7b4f93a48ff5a23d7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34481
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This assert is only enforcing that the input is valid, not that it is
safe. This should be deferred until validation.
Bug: dawn:578
Change-Id: I083a62292ff7ca0fc35080d8c66dabf3188c7bca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34480
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Deep-clones all `Node`s and `Type`s into a new module.
Instead of writing a million standalone tests that'll only ever test the
existing fields of each type, I've opted to write the tests using
wgsl<->ast<->wgsl conversion. This means the tests require the enabling
of TINT_BUILD_WGSL_READER and TINT_BUILD_WGSL_WRITER, but I believe this
is much easier to maintain.
I'm aware there are probably gaps in the tests, and that even full
coverage is likely to rapidly rot, so I've also added
fuzzers/tint_ast_clone_fuzzer.cc - a fuzzer based test that ensures that
all AST modules can be cloned with identical reproduction.
I've run this across 100 cores of a 3990x for 4 hours, fixing the
single issue it detected.
Note: Expressions do not currently clone their `TypeManager` determined
types. This is for two reasons:
(a) This initial CL is mahoosive enough.
(b) I'm uncertain whether we actually want to clone this info, or to
re-run the `TypeDeterminer` after each AST transform. Maybe it should
be optional. Time will tell.
Fixed: tint:307
Change-Id: Id90fab06aaa740c805d12b66f3f11d1f452c6805
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33300
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
They already exist in a `ast::type` namespace, so `ast::type::BlahType` is just stuttering.
This is more important now that Is<> and As<> use the full type name.
Change-Id: I7c661fe58cdc33ba7e9a95c82c996a799786661f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34321
Reviewed-by: dan sinclair <dsinclair@chromium.org>
No need to prefix with `ast::` when you're in the ast namespace already.
Change-Id: Iac6cd3a215c05a80ee2035d582500f1d6c882a06
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34320
Reviewed-by: dan sinclair <dsinclair@chromium.org>
The following DecorationKinds were sub-types of core decoration types:
kStride, kStage, kWorkgroup, kStructMemberOffset, kAccess, kBinding, kBuiltin, kConstantId, kLocation
These only existed for casting (not for error messages), and are no longer needed, so remove them.
Change-Id: I1e4bb9bf51952c6e86bac984d0d667a071ca80bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34303
Reviewed-by: dan sinclair <dsinclair@chromium.org>
And replace the use of`ast::As(Decoration* deco)` with `Castable::As<T>()`.
These were used for dynamic casting, but is now replaced with Castable.
Change-Id: Ie5fe19ad4db4bc4d19f5386d2cfddaaf84b215d0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34302
Reviewed-by: dan sinclair <dsinclair@chromium.org>
The hand-rolled `AsBlah()`, `IsBlah()` methods will be migrated in future changes.
Change-Id: I078c100b561b50018771cc38c1cac4379c393424
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34301
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reduces the per-instance size for an extra vtable entry.
Change-Id: Ie087e0b8d8524adf85663ab1224fb0ae1a5e0000
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34300
Reviewed-by: dan sinclair <dsinclair@chromium.org>
The hand-rolled `AsBlah()`, `IsBlah()` methods will be migrated in future changes.
Change-Id: I46a350a560f9eda8ca15f8ba8c95b17b9b6010b7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34261
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>