aboutsummaryrefslogtreecommitdiff
path: root/android_sample/assets
diff options
context:
space:
mode:
authorJaebaek Seo <duke.acacia@gmail.com>2019-01-10 17:43:21 -0500
committerGitHub <noreply@github.com>2019-01-10 17:43:21 -0500
commitd6a750e0fe966516e9b799bba55fb295e124a81b (patch)
tree1ff91cd882500a1444da04e20f6d1a34ac6503e9 /android_sample/assets
parent610296cc045b094509a6bd2f420ebdef1f98edf9 (diff)
downloadamber-d6a750e0fe966516e9b799bba55fb295e124a81b.tar.gz
Add a sample Android app (#183)
Fixes #179
Diffstat (limited to 'android_sample/assets')
-rw-r--r--android_sample/assets/amber/compute_ssbo.amber54
-rw-r--r--android_sample/assets/amber/compute_ssbo.amber.vk_shader_0.spvbin0 -> 1996 bytes
2 files changed, 54 insertions, 0 deletions
diff --git a/android_sample/assets/amber/compute_ssbo.amber b/android_sample/assets/amber/compute_ssbo.amber
new file mode 100644
index 0000000..5aa5942
--- /dev/null
+++ b/android_sample/assets/amber/compute_ssbo.amber
@@ -0,0 +1,54 @@
+# 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) buffer block0 {
+ float data_set0_binding0[3];
+};
+
+layout(set = 1, binding = 2) buffer 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_set0_binding0[index] = data_set0_binding0[index] + 1.0f;
+ data_set1_binding2[index] = data_set2_binding1[index] -
+ data_set1_binding2[index];
+ data_set2_binding1[index] = 10.0f * data_set2_binding3[index] +
+ data_set2_binding1[index];
+ data_set2_binding3[index] = 30.0f * data_set2_binding3[index];
+}
+
+[test]
+ssbo 0:0 subdata vec3 0 1.0 2.0 3.0
+ssbo 1:2 subdata vec3 0 4.0 5.0 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 0:0 0 ~= 2.0 3.0 4.0
+probe ssbo vec3 1:2 0 ~= 17.0 17.0 17.0
+probe ssbo vec3 2:1 0 ~= 28.0 30.0 32.0
+probe ssbo vec3 2:3 0 ~= 21.0 24.0 27.0
diff --git a/android_sample/assets/amber/compute_ssbo.amber.vk_shader_0.spv b/android_sample/assets/amber/compute_ssbo.amber.vk_shader_0.spv
new file mode 100644
index 0000000..535357f
--- /dev/null
+++ b/android_sample/assets/amber/compute_ssbo.amber.vk_shader_0.spv
Binary files differ