diff options
author | asuonpaa <34128694+asuonpaa@users.noreply.github.com> | 2020-04-20 16:10:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 09:10:07 -0400 |
commit | 1d6f89f45ed4b3aec8dcdbd92a5db01a1ce66850 (patch) | |
tree | eb7b23b60a491cfaff7830afb399f7f94ab98af7 /tests | |
parent | cd0fd68f24bbb1b73eaaf13da6cdc8ec003b9b2f (diff) | |
download | amber-1d6f89f45ed4b3aec8dcdbd92a5db01a1ce66850.tar.gz |
Added buffer data loading from a text file (#839)
Also moved delegate from options to Amber object to be able to access it from a parser.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/buffer_load_text.amber | 55 | ||||
-rw-r--r-- | tests/cases/vec4data.txt | 1 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/cases/buffer_load_text.amber b/tests/cases/buffer_load_text.amber new file mode 100644 index 0000000..569224d --- /dev/null +++ b/tests/cases/buffer_load_text.amber @@ -0,0 +1,55 @@ +#!amber +# +# Copyright 2020 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 compute_shader GLSL +#version 430 + +layout(set = 0, binding = 0) buffer block0 { + float in_data[12]; +}; + +layout(set = 0, binding = 1) buffer block1 { + float out_data[12]; +}; + +void main() { + for (int i = 0; i < 12; i++) + out_data[i] = in_data[i] * 2.0; +} +END + +BUFFER buf0 DATA_TYPE vec4<float> SIZE 3 FILE TEXT vec4data.txt +BUFFER buf1 DATA_TYPE vec4<float> SIZE 3 FILL 0.0 + +BUFFER ref0 DATA_TYPE vec4<float> DATA +1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 +END + +BUFFER ref1 DATA_TYPE vec4<float> DATA +2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 18.0 20.0 22.0 24.0 +END + +PIPELINE compute pipeline + ATTACH compute_shader + + BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER buf1 AS storage DESCRIPTOR_SET 0 BINDING 1 +END + +RUN pipeline 1 1 1 + +EXPECT buf0 EQ_BUFFER ref0 +EXPECT buf1 EQ_BUFFER ref1 diff --git a/tests/cases/vec4data.txt b/tests/cases/vec4data.txt new file mode 100644 index 0000000..ceb620d --- /dev/null +++ b/tests/cases/vec4data.txt @@ -0,0 +1 @@ +1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 |