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>
Implements `As<Blah>()` and `Is<Blah>()` automatically.
There are several benefits to using this over the pattern of hand-rolled `IsBlah()`, `AsBlah()` methods:
(1) We don't have to maintain a whole lot of hand written code.
(2) These allow us to cast from the base type to _any_ derived type in a single cast. The existing hand-rolled methods usually require a couple of intermediary casts to go from the base type to the leaf type.
(3) The use of a template parameter means these casts can be called from other template logic.
Note: Unlike the hand-rolled `AsBlah()` methods, it is safe to call `As<T>()` even if the type does not derive from `T`. If the object does not derive from `T` then `As` will simply return `nullptr`. This allows the calling logic to replace the common pattern of:
```
if (obj.IsBlah()) {
auto* b = obj.AsBlah();
...
}
```
with:
```
if (auto* b = obj.As<Blah>()) {
...
}
```
This halves the number of virtual method calls, and is one line shorter.
Change-Id: I4312e9831d7de6703a97184640864b8050a34177
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34260
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This CL adds a tricium config file for Tint.
Change-Id: I08409df9b6b79bdd3ffecf4f28867674435ae14a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34360
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Also ensure that the number of texture coordinates is exactly
the right number required for the given texture dimension.
I think SPIR-V is looser in this respect.
Assumes coordinates are floating point.
Bug: tint:349
Change-Id: I4512c333fada3647c66f13ef31897b2d73b46cf0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33982
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
reader/spirv/parser_impl.cc was using an overload of a function that's
recently added in SPIRV-Tools so rolling Tint would require rolling
SPIRV-Tools at the same time, which is not currently possible because of
a breaking change in spirv-headers.
Bug: chromium:1153258
Change-Id: I4e8cf87a3f11adbd8b6ef289260c6159faf9580c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34142
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Allows this to be formatted similarly to the severity.
Change-Id: I74cd863d8f1d94089ce753ab76a2c70784eb5553
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33938
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>