• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2# Copyright 2019 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
16DEVICE_FEATURE fragmentStoresAndAtomics
17
18SHADER vertex vert_shader PASSTHROUGH
19SHADER fragment frag_shader GLSL
20#version 430
21
22struct SubData {
23  int c;
24  float d;
25};
26
27layout(location = 0) out vec4 color_out;
28layout(std140, binding = 0) readonly buffer InData {
29  float a;
30  int b;
31  SubData e;
32} in_data;
33
34layout(std140, binding = 1) writeonly buffer OutData {
35  float a;
36  int b;
37  SubData e;
38} out_data;
39
40void main() {
41  color_out = vec4(1, 1, 1, 1);
42  out_data.a = in_data.a;
43  out_data.b = in_data.b;
44  out_data.e.c = in_data.e.c;
45  out_data.e.d = in_data.e.d;
46}
47END
48
49STRUCT sub_data
50  int32 c
51  float d
52END
53
54STRUCT my_data
55  float a
56  int32 b
57  sub_data e
58END
59
60BUFFER in_data DATA_TYPE my_data STD140 DATA
611.1  # a
62220  # b
631024 # e.c
642.4  # e.d
65END
66
67BUFFER out_data DATA_TYPE my_data STD140 SIZE 1 FILL 0
68
69BUFFER framebuffer FORMAT B8G8R8A8_UNORM
70
71PIPELINE graphics my_pipeline
72  ATTACH vert_shader
73  ATTACH frag_shader
74
75  BIND BUFFER framebuffer AS color LOCATION 0
76  BIND BUFFER in_data AS storage DESCRIPTOR_SET 0 BINDING 0
77  BIND BUFFER out_data AS storage DESCRIPTOR_SET 0 BINDING 1
78END
79
80RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
81EXPECT out_data EQ_BUFFER in_data
82EXPECT out_data IDX 0 EQ 1.1 220 1024 2.4
83