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
16SHADER vertex vert_shader PASSTHROUGH
17SHADER fragment frag_shader GLSL
18#version 430
19
20struct s {
21  float d;
22  float e;
23};
24
25layout(location = 0) out vec4 color_out;
26layout(std140, binding = 0) readonly buffer Data {
27  float a;
28  float b;
29  s c;
30} data;
31
32void main() {
33  color_out = vec4(data.a/255, data.b/255, data.c.d/255, data.c.e/255);
34}
35END
36
37STRUCT s
38  float d
39  float e
40END
41
42STRUCT my_data
43  float a
44  float b
45  s c
46END
47
48
49BUFFER data DATA_TYPE my_data STD140 DATA
50  1  # a
51 64  # b
52128  # c.d
53220  # c.e
54END
55
56BUFFER framebuffer FORMAT B8G8R8A8_UNORM
57
58PIPELINE graphics my_pipeline
59  ATTACH vert_shader
60  ATTACH frag_shader
61
62  BIND BUFFER framebuffer AS color LOCATION 0
63  BIND BUFFER data AS storage DESCRIPTOR_SET 0 BINDING 0
64END
65
66RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
67EXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 1 64 128 220
68