diff --git a/internal/shader/stmt.go b/internal/shader/stmt.go index e653105b7..311f4a749 100644 --- a/internal/shader/stmt.go +++ b/internal/shader/stmt.go @@ -642,7 +642,7 @@ func (cs *compileState) assign(block *block, fname string, pos token.Pos, lhs, r } t := rhsTypes[i] if t.Main == shaderir.None { - // TODO: This is to determine a type when the rhs is a constant, + // TODO: This is to determine a type when the rhs values are constants (not literals), // but there are no actual cases when len(lhs) != len(rhs). Is this correct? t = toDefaultType(rhsExprs[i].Const) } diff --git a/internal/shader/testdata/assign_multiple2.expected.vs b/internal/shader/testdata/assign_multiple2.expected.vs new file mode 100644 index 000000000..5af7e3172 --- /dev/null +++ b/internal/shader/testdata/assign_multiple2.expected.vs @@ -0,0 +1,14 @@ +void F0(out vec2 l0); + +void F0(out vec2 l0) { + float l1 = float(0); + float l2 = float(0); + float l3 = float(0); + float l4 = float(0); + l2 = 1.0; + l1 = l2; + l4 = 2.0; + l3 = l4; + l0 = vec2(l1, l3); + return; +} diff --git a/internal/shader/testdata/assign_multiple2.go b/internal/shader/testdata/assign_multiple2.go new file mode 100644 index 000000000..a40527f1e --- /dev/null +++ b/internal/shader/testdata/assign_multiple2.go @@ -0,0 +1,6 @@ +package main + +func Foo() vec2 { + r1, r2 := 1.0, 2.0 + return vec2(r1, r2) +}