1#!amber
2# Copyright 2021 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;
20void main()
21{
22  color_out = vec4(1.0, 0.0, 0.0, 0.5);
23}
24END
25
26BUFFER framebuffer FORMAT B8G8R8A8_UNORM
27
28PIPELINE graphics pipeline
29  ATTACH vert_shader
30  ATTACH frag_shader
31  BIND BUFFER framebuffer AS color LOCATION 0
32
33  BLEND
34    SRC_COLOR_FACTOR src_alpha
35    DST_COLOR_FACTOR one_minus_src_alpha
36    COLOR_OP add
37    SRC_ALPHA_FACTOR one
38    DST_ALPHA_FACTOR one
39    ALPHA_OP max
40  END
41END
42
43CLEAR_COLOR pipeline 0 255 0 255
44CLEAR pipeline
45RUN pipeline DRAW_RECT POS 0 0 SIZE 250 250
46EXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 128 128 0 255 TOLERANCE 5%
47