mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
tint: Simplify the resolver constant evaluation
And expand the handling to include matrices. Bug: tint:1504 Change-Id: I6fd9ce239d13acf0e2f74b8ea19dfac3457e348c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91026 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
8f4f449540
commit
d3de38d7e3
@@ -81,7 +81,14 @@ class Constant {
|
||||
/// @return the value of the scalar `static_cast` to type T.
|
||||
template <typename T>
|
||||
T ElementAs(size_t index) const {
|
||||
return std::visit([](auto val) { return static_cast<T>(val); }, elems_[index]);
|
||||
return Cast<T>(elems_[index]);
|
||||
}
|
||||
|
||||
/// @param s the input scalar
|
||||
/// @returns the scalar `s` cast to the type `T`.
|
||||
template <typename T>
|
||||
static T Cast(Scalar s) {
|
||||
return std::visit([](auto v) { return static_cast<T>(v); }, s);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user