From 5dc0d4e1a45953347966c01c6998c8ef24edb76a Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 9 Aug 2020 22:26:57 +0900 Subject: [PATCH] shader: Add more tests about 'for' loops --- internal/shader/testdata/for3.expected.vs | 20 ++++++++++++++++++++ internal/shader/testdata/for3.go | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 internal/shader/testdata/for3.expected.vs create mode 100644 internal/shader/testdata/for3.go diff --git a/internal/shader/testdata/for3.expected.vs b/internal/shader/testdata/for3.expected.vs new file mode 100644 index 000000000..2e3b31231 --- /dev/null +++ b/internal/shader/testdata/for3.expected.vs @@ -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; +} diff --git a/internal/shader/testdata/for3.go b/internal/shader/testdata/for3.go new file mode 100644 index 000000000..da12a17b3 --- /dev/null +++ b/internal/shader/testdata/for3.go @@ -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 +}