tint: Make CreateScalar and ZeroValue members

This avoids the need to pass the `use_runtime_semantics_` flag at each
callsite.

Change-Id: I2cce3f147226e1295b5dfa0239beeacd519d5bb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118641
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price 2023-02-06 22:01:48 +00:00 committed by Dawn LUCI CQ
parent 288969f735
commit fc2083a616
2 changed files with 205 additions and 263 deletions

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
#include <stddef.h>
#include <string>
#include "src/tint/number.h"
#include "src/tint/type/type.h"
#include "src/tint/utils/result.h"
#include "src/tint/utils/vector.h"
@ -1093,6 +1094,17 @@ class ConstEval {
/// Adds the given note message to the diagnostics
void AddNote(const std::string& msg, const Source& source) const;
/// CreateScalar constructs and returns a constant::Scalar<T>.
/// @param source the source location
/// @param t the result type
/// @param v the scalar value
/// @return the constant value with the same type and value
template <typename T>
ConstEval::Result CreateScalar(const Source& source, const type::Type* t, T v);
/// ZeroValue returns a Constant for the zero-value of the type `type`.
const constant::Value* ZeroValue(const type::Type* type);
/// Adds two Number<T>s
/// @param source the source location
/// @param a the lhs number