[spirv-writer] Output name for constant global variables.
When emitting a global constant we'd early exit the emission code before emitting the debug statement for the constants name. This Cl adds the needed code to emit names for global constants. Change-Id: I1a7a3660b4ff31879393a6a776a9f00e895de216 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26923 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
b08e253886
commit
dd99471420
|
@ -556,6 +556,9 @@ bool Builder::GenerateGlobalVariable(ast::Variable* var) {
|
|||
error_ = "missing constructor for constant";
|
||||
return false;
|
||||
}
|
||||
push_debug(spv::Op::OpName,
|
||||
{Operand::Int(init_id), Operand::String(var->name())});
|
||||
|
||||
scope_stack_.set_global(var->name(), init_id);
|
||||
spirv_id_to_variable_[init_id] = var;
|
||||
return true;
|
||||
|
|
|
@ -157,6 +157,8 @@ TEST_F(BuilderTest, GlobalVar_Const) {
|
|||
EXPECT_TRUE(b.GenerateGlobalVariable(&v)) << b.error();
|
||||
ASSERT_FALSE(b.has_error()) << b.error();
|
||||
|
||||
EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %5 "var"
|
||||
)");
|
||||
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
|
||||
%1 = OpTypeVector %2 3
|
||||
%3 = OpConstant %2 1
|
||||
|
|
Loading…
Reference in New Issue