Remove ast::Variable::constant_id()
The backends now use sem::Variable::ConstantId() instead, since the AST does not have the correct ID when the parameterless version of the override attribute is used. Change-Id: I816295c8b2e4baa1671c9d042920bf001b1b4336 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50845 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
parent
81759d0009
commit
a2d6793efa
|
@ -62,14 +62,6 @@ Variable::BindingPoint Variable::binding_point() const {
|
||||||
return BindingPoint{group, binding};
|
return BindingPoint{group, binding};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Variable::constant_id() const {
|
|
||||||
if (auto* cid = GetDecoration<OverrideDecoration>(decorations_)) {
|
|
||||||
return cid->value();
|
|
||||||
}
|
|
||||||
TINT_ASSERT(false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Variable* Variable::Clone(CloneContext* ctx) const {
|
Variable* Variable::Clone(CloneContext* ctx) const {
|
||||||
auto src = ctx->Clone(source());
|
auto src = ctx->Clone(source());
|
||||||
auto sym = ctx->Clone(symbol());
|
auto sym = ctx->Clone(symbol());
|
||||||
|
|
|
@ -142,10 +142,6 @@ class Variable : public Castable<Variable, Node> {
|
||||||
/// @returns the binding point information for the variable
|
/// @returns the binding point information for the variable
|
||||||
BindingPoint binding_point() const;
|
BindingPoint binding_point() const;
|
||||||
|
|
||||||
/// @returns the pipeline constant id value for the variable. Assumes that
|
|
||||||
/// this variable has an override decoration.
|
|
||||||
uint32_t constant_id() const;
|
|
||||||
|
|
||||||
/// Clones this node and all transitive child nodes using the `CloneContext`
|
/// Clones this node and all transitive child nodes using the `CloneContext`
|
||||||
/// `ctx`.
|
/// `ctx`.
|
||||||
/// @param ctx the clone context
|
/// @param ctx the clone context
|
||||||
|
|
|
@ -169,15 +169,6 @@ TEST_F(VariableTest, BindingPointMissingBindingDecoration) {
|
||||||
EXPECT_EQ(var->binding_point().binding, nullptr);
|
EXPECT_EQ(var->binding_point().binding, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VariableTest, ConstantId) {
|
|
||||||
auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr,
|
|
||||||
DecorationList{
|
|
||||||
create<OverrideDecoration>(1200),
|
|
||||||
});
|
|
||||||
|
|
||||||
EXPECT_EQ(var->constant_id(), 1200u);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(VariableTest, Decorated_to_str) {
|
TEST_F(VariableTest, Decorated_to_str) {
|
||||||
auto* var = Var("my_var", ty.f32(), StorageClass::kFunction, Expr("expr"),
|
auto* var = Var("my_var", ty.f32(), StorageClass::kFunction, Expr("expr"),
|
||||||
DecorationList{
|
DecorationList{
|
||||||
|
|
Loading…
Reference in New Issue