• 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;
21
22void main ()
23{
24    vec4 color = texelFetch(texelsIn, int(gl_GlobalInvocationID));
25    imageStore(texelsOut, int(gl_GlobalInvocationID), color);
26}
27END
28
29BUFFER texel_buffer_in DATA_TYPE R8G8B8A8_UNORM DATA
30255   0   0 255
31  0 255   0 255
32  0   0 255 255
33  0 255 255 255
34END
35
36BUFFER texel_buffer_out DATA_TYPE R32G32B32A32_SFLOAT SIZE 4 FILL 0
37
38BUFFER ref DATA_TYPE R32G32B32A32_SFLOAT DATA
391.0 0.0 0.0 1.0
400.0 1.0 0.0 1.0
410.0 0.0 1.0 1.0
420.0 1.0 1.0 1.0
43END
44
45PIPELINE compute pipeline
46  ATTACH compute_shader
47  BIND BUFFER texel_buffer_in AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0
48  BIND BUFFER texel_buffer_out AS storage_texel_buffer DESCRIPTOR_SET 0 BINDING 1
49END
50
51RUN pipeline 1 1 1
52
53EXPECT texel_buffer_out EQ_BUFFER ref
54