aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2019-04-05 10:01:39 -0400
committerDavid Neto <dneto@google.com>2019-04-05 10:01:39 -0400
commit1f834b84fd93ffad4a70b9eb3bc91c9aa431df57 (patch)
tree2961ab77fa23938c42a1f3d8dd46389c57d17f92 /tests
parent1806fc6d287eb0ff838360c5a379fc722cf4e414 (diff)
downloadamber-1f834b84fd93ffad4a70b9eb3bc91c9aa431df57.tar.gz
[amberscript] Add REPEAT command (#443)
[amberscript] Add REPEAT command This CL adds the REPEAT directive to AmberScript. This allows running a given set of commands `n` times. Fixes #425.
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/repeat.amber36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/cases/repeat.amber b/tests/cases/repeat.amber
new file mode 100644
index 0000000..a3a804b
--- /dev/null
+++ b/tests/cases/repeat.amber
@@ -0,0 +1,36 @@
+#!amber
+# Copyright 2019 The Amber Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER compute shader GLSL
+#version 430
+layout(set = 0, binding = 0) buffer block1 {
+ int val;
+};
+
+void main() {
+ val = val + 1;
+}
+END
+BUFFER buf DATA_TYPE int32 DATA 0 END
+
+PIPELINE compute my_pipeline
+ ATTACH shader
+ BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
+END
+
+REPEAT 4
+ RUN my_pipeline 1 1 1
+END
+EXPECT buf IDX 0 EQ 4