mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-02 18:25:56 +00:00
We define the canonical type as a type stripped of all aliases. For example, Canonical(alias<alias<vec3<alias<f32>>>>) is vec3<f32>. This change adds Resolver::Canonical(Type*) which caches and returns the resulting canonical type. We use this throughout the Resolver instead of UnwrapAliasIfNeeded(), and we store the result in semantic::Variable, returned from it's Type() member function. Also: * Wrote unit tests for Resolver::Canonical() * Added semantic::Variable::DeclaredType() as a convenience to retrieve the AST variable's type. * Updated post-resolve code (transforms) to make use of Type and DeclaredType appropriately, removing unnecessary calls to UnwrapAliasIfNeeded. * Added IntrinsicTableTest.MatchWithNestedAliasUnwrapping to ensure we don't need to pass canonical parameter types for instrinsic table lookups. * ProgramBuilder: added vecN and matMxN overloads that take a Type* arg to create them with alias types. Bug: tint:705 Change-Id: I58a3b62538356b8dad2b1161a19b38bcefdd5d62 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47360 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>