[spirv-writer] decorations are annotations
Change-Id: Iaf1c11b2be3fbc2dacda801d1eb32d3e091b76db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20680
Reviewed-by: dan sinclair <dsinclair@google.com>
diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc
index 7efd156..78d302c 100644
--- a/src/writer/spirv/builder.cc
+++ b/src/writer/spirv/builder.cc
@@ -450,19 +450,19 @@
if (var->IsDecorated()) {
for (const auto& deco : var->AsDecorated()->decorations()) {
if (deco->IsBuiltin()) {
- push_debug(spv::Op::OpDecorate,
+ push_annot(spv::Op::OpDecorate,
{Operand::Int(var_id), Operand::Int(SpvDecorationBuiltIn),
Operand::Int(ConvertBuiltin(deco->AsBuiltin()->value()))});
} else if (deco->IsLocation()) {
- push_debug(spv::Op::OpDecorate,
+ push_annot(spv::Op::OpDecorate,
{Operand::Int(var_id), Operand::Int(SpvDecorationLocation),
Operand::Int(deco->AsLocation()->value())});
} else if (deco->IsBinding()) {
- push_debug(spv::Op::OpDecorate,
+ push_annot(spv::Op::OpDecorate,
{Operand::Int(var_id), Operand::Int(SpvDecorationBinding),
Operand::Int(deco->AsBinding()->value())});
} else if (deco->IsSet()) {
- push_debug(
+ push_annot(
spv::Op::OpDecorate,
{Operand::Int(var_id), Operand::Int(SpvDecorationDescriptorSet),
Operand::Int(deco->AsSet()->value())});
diff --git a/src/writer/spirv/builder_global_variable_test.cc b/src/writer/spirv/builder_global_variable_test.cc
index 8763d87..dd40711 100644
--- a/src/writer/spirv/builder_global_variable_test.cc
+++ b/src/writer/spirv/builder_global_variable_test.cc
@@ -162,7 +162,8 @@
Builder b(&mod);
EXPECT_TRUE(b.GenerateGlobalVariable(&dv)) << b.error();
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "var"
-OpDecorate %1 Location 5
+)");
+ EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %1 Location 5
)");
EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32
%2 = OpTypePointer Output %3
@@ -185,7 +186,8 @@
Builder b(&mod);
EXPECT_TRUE(b.GenerateGlobalVariable(&dv)) << b.error();
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "var"
-OpDecorate %1 Binding 2
+)");
+ EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %1 Binding 2
OpDecorate %1 DescriptorSet 3
)");
EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32
@@ -209,7 +211,8 @@
Builder b(&mod);
EXPECT_TRUE(b.GenerateGlobalVariable(&dv)) << b.error();
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %1 "var"
-OpDecorate %1 BuiltIn Position
+)");
+ EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %1 BuiltIn Position
)");
EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32
%2 = OpTypePointer Output %3