aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJaebaek Seo <duke.acacia@gmail.com>2019-01-15 15:45:04 -0500
committerGitHub <noreply@github.com>2019-01-15 15:45:04 -0500
commit75a67f949933fe1e4b8091462800bc3baf7f7ba2 (patch)
tree8d35d1a5e6f08306ef992d46118b75fd131bf3f7 /tests
parent4336157fe1e4293f4b7b5e5d201571c7b71eff08 (diff)
downloadamber-75a67f949933fe1e4b8091462800bc3baf7f7ba2.tar.gz
Add test case for accumulated ubo definition (#225)
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/compute_accumulated_ubo_definition.amber59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/cases/compute_accumulated_ubo_definition.amber b/tests/cases/compute_accumulated_ubo_definition.amber
new file mode 100644
index 0000000..09acd39
--- /dev/null
+++ b/tests/cases/compute_accumulated_ubo_definition.amber
@@ -0,0 +1,59 @@
+# 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.
+
+[compute shader]
+#version 430
+
+layout(set = 0, binding = 0) uniform block0 {
+ float data_set0_binding0[3];
+};
+
+layout(set = 1, binding = 2) uniform block1 {
+ float data_set1_binding2[3];
+};
+
+layout(set = 2, binding = 1) buffer block2 {
+ float data_set2_binding1[3];
+};
+
+layout(set = 2, binding = 3) buffer block3 {
+ float data_set2_binding3[3];
+};
+
+void main() {
+ const uint index = gl_WorkGroupID.x;
+ data_set2_binding1[index] = 10.0f * data_set0_binding0[index] +
+ data_set1_binding2[index];
+ data_set2_binding3[index] += data_set1_binding2[index];
+}
+
+[test]
+
+# SPIRV generated by glslang uses std140 layout as a default for UBO
+uniform ubo 0:0 float 0 1.0
+uniform ubo 0:0 float 16 2.0
+uniform ubo 0:0 float 32 3.0
+
+# SPIRV generated by glslang uses std140 layout as a default for UBO
+uniform ubo 1:2 float 0 4.0
+uniform ubo 1:2 float 16 5.0
+uniform ubo 1:2 float 32 6.0
+
+ssbo 2:1 subdata vec3 0 21.0 22.0 23.0
+ssbo 2:3 subdata vec3 0 0.7 0.8 0.9
+
+compute 3 1 1
+
+probe ssbo vec3 2:1 0 ~= 14.0 25.0 36.0
+probe ssbo vec3 2:3 0 ~= 4.7 5.8 6.9