[spirv-writer] Generate load for var initializer, if needed
Change-Id: I609860bb05fae3e6e5eb21a471f869030f384ad0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20721 Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
parent
de4259ef80
commit
c8c10e83df
|
@ -416,6 +416,7 @@ bool Builder::GenerateFunctionVariable(ast::Variable* var) {
|
|||
push_function_var(
|
||||
{Operand::Int(type_id), result, Operand::Int(ConvertStorageClass(sc))});
|
||||
if (var->has_constructor()) {
|
||||
init_id = GenerateLoadIfNeeded(var->constructor()->result_type(), init_id);
|
||||
GenerateStore(var_id, init_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,15 @@ OpStore %7 %6
|
|||
)");
|
||||
}
|
||||
|
||||
TEST_F(BuilderTest,
|
||||
DISABLED_FunctionVar_WithNonConstantConstructorLoadedFromVar) {
|
||||
// fn main() -> void {
|
||||
// var v : f32 = 1.0;
|
||||
// var v2 : f32 = v; // Should generate the load automatically.
|
||||
// }
|
||||
FAIL();
|
||||
}
|
||||
|
||||
TEST_F(BuilderTest, FunctionVar_Const) {
|
||||
ast::type::F32Type f32;
|
||||
ast::type::VectorType vec(&f32, 3);
|
||||
|
|
Loading…
Reference in New Issue