• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2# Copyright 2020 The Amber Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16SHADER compute compute_shader GLSL
17#version 430
18layout(local_size_x=4,local_size_y=1) in;
19uniform layout(set=0, binding=0) samplerBuffer texelsIn;
20uniform layout(set=0, binding=1, rgba32f) imageBuffer texelsOut[2];
21
22void main ()
23{
24    vec4 color = texelFetch(texelsIn, int(gl_GlobalInvocationID));
25    imageStore(texelsOut[0], int(gl_GlobalInvocationID), color);
26    imageStore(texelsOut[1], int(gl_GlobalInvocationID), color * 2.0);
27}
28END
29
30BUFFER texel_buffer_in DATA_TYPE R8G8B8A8_UNORM DATA
31255   0   0 255
32  0 255   0 255
33  0   0 255 255
34  0 255 255 255
35END
36
37BUFFER texel_buffer_out0 DATA_TYPE R32G32B32A32_SFLOAT SIZE 4 FILL 0
38BUFFER texel_buffer_out1 DATA_TYPE R32G32B32A32_SFLOAT SIZE 4 FILL 0
39
40BUFFER ref0 DATA_TYPE R32G32B32A32_SFLOAT DATA
411.0 0.0 0.0 1.0
420.0 1.0 0.0 1.0
430.0 0.0 1.0 1.0
440.0 1.0 1.0 1.0
45END
46
47BUFFER ref1 DATA_TYPE R32G32B32A32_SFLOAT DATA
482.0 0.0 0.0 2.0
490.0 2.0 0.0 2.0
500.0 0.0 2.0 2.0
510.0 2.0 2.0 2.0
52END
53
54PIPELINE compute pipeline
55  ATTACH compute_shader
56  BIND BUFFER texel_buffer_in AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0
57  BIND BUFFER_ARRAY texel_buffer_out0 texel_buffer_out1 AS storage_texel_buffer DESCRIPTOR_SET 0 BINDING 1
58END
59
60RUN pipeline 1 1 1
61
62EXPECT texel_buffer_out0 EQ_BUFFER ref0
63EXPECT texel_buffer_out1 EQ_BUFFER ref1
64