1#!amber
2#
3# Copyright 2021 The Amber Authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     https://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17SHADER vertex vert_shader GLSL
18#version 430
19
20layout(location = 0) in vec4 position;
21
22void main() {
23  gl_Position = vec4(position.xy, 0.5, 1.0);
24}
25END
26
27SHADER fragment frag_shader GLSL
28#version 430
29
30layout(location = 0) out vec4 final_color;
31
32void main() {
33  final_color = vec4(0, 1, 0, 1);
34}
35END
36
37BUFFER framebuffer FORMAT B8G8R8A8_UNORM
38BUFFER depth FORMAT D32_SFLOAT
39
40PIPELINE graphics pipeline1
41  ATTACH vert_shader
42  ATTACH frag_shader
43
44  DEPTH
45    TEST on
46    WRITE on
47  END
48
49  FRAMEBUFFER_SIZE 256 256
50  VIEWPORT 0.0 0.0 SIZE 256.0 256.0 MIN_DEPTH 0.3 MAX_DEPTH 0.9
51
52  BIND BUFFER framebuffer AS color LOCATION 0
53  BIND BUFFER depth AS depth_stencil
54END
55
56CLEAR_DEPTH pipeline1 1.0
57CLEAR_COLOR pipeline1 255 255 255 255
58CLEAR pipeline1
59RUN pipeline1 DRAW_RECT POS 0 0 SIZE 256 256
60
61EXPECT depth IDX 0 TOLERANCE 1.0e-6 EQ 0.6
62