1e5c31af7Sopenharmony_ci#!amber
2e5c31af7Sopenharmony_ci# Copyright 2019 The Amber Authors.
3e5c31af7Sopenharmony_ci#
4e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
5e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
6e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
7e5c31af7Sopenharmony_ci#
8e5c31af7Sopenharmony_ci#     https://www.apache.org/licenses/LICENSE-2.0
9e5c31af7Sopenharmony_ci#
10e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
11e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
12e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
14e5c31af7Sopenharmony_ci# limitations under the License.
15e5c31af7Sopenharmony_ci
16e5c31af7Sopenharmony_ciSHADER vertex vert_shader PASSTHROUGH
17e5c31af7Sopenharmony_ciSHADER fragment frag_shader GLSL
18e5c31af7Sopenharmony_ci#version 430
19e5c31af7Sopenharmony_ci
20e5c31af7Sopenharmony_cilayout(location = 0) out vec4 color_out;
21e5c31af7Sopenharmony_cilayout(std140, binding = 0) readonly buffer Data {
22e5c31af7Sopenharmony_ci  float a;
23e5c31af7Sopenharmony_ci  float b;
24e5c31af7Sopenharmony_ci} data;
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_civoid main() {
27e5c31af7Sopenharmony_ci  color_out = vec4(data.a/255, data.b/255, data.a/255, data.b/255);
28e5c31af7Sopenharmony_ci}
29e5c31af7Sopenharmony_ciEND
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ciSTRUCT my_data
32e5c31af7Sopenharmony_ci  float a
33e5c31af7Sopenharmony_ci  float b
34e5c31af7Sopenharmony_ciEND
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciBUFFER data DATA_TYPE my_data STD140 DATA
37e5c31af7Sopenharmony_ci  1  # a
38e5c31af7Sopenharmony_ci220  # b
39e5c31af7Sopenharmony_ciEND
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ciBUFFER framebuffer FORMAT B8G8R8A8_UNORM
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_ciPIPELINE graphics my_pipeline
44e5c31af7Sopenharmony_ci  ATTACH vert_shader
45e5c31af7Sopenharmony_ci  ATTACH frag_shader
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_ci  BIND BUFFER framebuffer AS color LOCATION 0
48e5c31af7Sopenharmony_ci  BIND BUFFER data AS storage DESCRIPTOR_SET 0 BINDING 0
49e5c31af7Sopenharmony_ciEND
50e5c31af7Sopenharmony_ci
51e5c31af7Sopenharmony_ciRUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
52e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 1 220 1 220
53