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 vertex vert_shader PASSTHROUGH
17SHADER fragment frag_shader GLSL
18#version 430
19layout(location = 0) out vec4 color_out;
20layout(std140, binding = 0) readonly buffer Data {
21  float d[];
22} data;
23
24void main() {
25  color_out = vec4(data.d[0]/255, data.d[1]/255, data.d[2]/255, data.d[3]/255);
26}
27END
28
29BUFFER framebuffer FORMAT B8G8R8A8_UNORM
30
31BUFFER data DATA_TYPE float[] STD140 DATA 1.0 64.0 128.0 220.0 END
32
33PIPELINE graphics my_pipeline
34  ATTACH vert_shader
35  ATTACH frag_shader
36
37  BIND BUFFER framebuffer AS color LOCATION 0
38  BIND BUFFER data AS storage DESCRIPTOR_SET 0 BINDING 0
39END
40
41RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
42EXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 1 64 128 220
43