1e5c31af7Sopenharmony_ci#!amber
2e5c31af7Sopenharmony_ci#
3e5c31af7Sopenharmony_ci# Copyright 2021 The Amber Authors.
4e5c31af7Sopenharmony_ci#
5e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
6e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
7e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
8e5c31af7Sopenharmony_ci#
9e5c31af7Sopenharmony_ci#     https://www.apache.org/licenses/LICENSE-2.0
10e5c31af7Sopenharmony_ci#
11e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
12e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
13e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
15e5c31af7Sopenharmony_ci# limitations under the License.
16e5c31af7Sopenharmony_ci
17e5c31af7Sopenharmony_ciSHADER vertex vert_shader GLSL
18e5c31af7Sopenharmony_ci#version 430
19e5c31af7Sopenharmony_ci
20e5c31af7Sopenharmony_cilayout(location = 0) in vec4 position;
21e5c31af7Sopenharmony_ci
22e5c31af7Sopenharmony_civoid main() {
23e5c31af7Sopenharmony_ci  gl_Position = vec4(position.xy, 0.5, 1.0);
24e5c31af7Sopenharmony_ci}
25e5c31af7Sopenharmony_ciEND
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ciSHADER fragment frag_shader GLSL
28e5c31af7Sopenharmony_ci#version 430
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_cilayout(location = 0) out vec4 final_color;
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_civoid main() {
33e5c31af7Sopenharmony_ci  final_color = vec4(0, 1, 0, 1);
34e5c31af7Sopenharmony_ci}
35e5c31af7Sopenharmony_ciEND
36e5c31af7Sopenharmony_ci
37e5c31af7Sopenharmony_ciBUFFER framebuffer FORMAT B8G8R8A8_UNORM
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_ciPIPELINE graphics pipeline1
40e5c31af7Sopenharmony_ci  ATTACH vert_shader
41e5c31af7Sopenharmony_ci  ATTACH frag_shader
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_ci  FRAMEBUFFER_SIZE 256 256
44e5c31af7Sopenharmony_ci  VIEWPORT 10.0 10.0 SIZE 100.0 100.0
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ci  BIND BUFFER framebuffer AS color LOCATION 0
47e5c31af7Sopenharmony_ciEND
48e5c31af7Sopenharmony_ci
49e5c31af7Sopenharmony_ciCLEAR_COLOR pipeline1 255 255 255 255
50e5c31af7Sopenharmony_ciCLEAR pipeline1
51e5c31af7Sopenharmony_ciRUN pipeline1 DRAW_RECT POS 0 0 SIZE 256 256
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_ci# Check within the viewport
54e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 10 10 SIZE 100 100 EQ_RGBA   0 255   0 255
55e5c31af7Sopenharmony_ci# Check the borders were untouched
56e5c31af7Sopenharmony_ciEXPECT framebuffer IDX   0   0 SIZE  10 256 EQ_RGBA 255 255 255 255
57e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 110   0 SIZE 146 256 EQ_RGBA 255 255 255 255
58e5c31af7Sopenharmony_ciEXPECT framebuffer IDX  10   0 SIZE 100  10 EQ_RGBA 255 255 255 255
59e5c31af7Sopenharmony_ciEXPECT framebuffer IDX  10 110 SIZE 100 146 EQ_RGBA 255 255 255 255
60