shader: Add more tests about 'for' loops

This commit is contained in:
Hajime Hoshi 2020-08-09 22:26:57 +09:00
parent dee8690502
commit 5dc0d4e1a4
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,20 @@
void F0(out vec2 l0);
void F0(out vec2 l0) {
vec2 l1 = vec2(0);
vec2 l3 = vec2(0);
l1 = vec2(0.0);
for (int l2 = 0; l2 < 100; l2++) {
vec2 l5 = vec2(0);
l3 = vec2(0.0);
l1 = l3;
}
l3 = vec2(0.0);
for (int l4 = 0; l4 < 100; l4++) {
vec2 l5 = vec2(0);
l5 = vec2(0.0);
l3 = l5;
}
l0 = l1;
return;
}

15
internal/shader/testdata/for3.go vendored Normal file
View File

@ -0,0 +1,15 @@
package main
func Foo() vec2 {
v := vec2(0)
for i := 0; i < 100; i++ {
v2 := vec2(0)
v = v2
}
v3 := vec2(0)
for i := 0; i < 100; i++ {
v4 := vec2(0)
v3 = v4
}
return v
}