• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15DEVICE_EXTENSION VK_EXT_depth_clamp_zero_one
16
17SHADER vertex vert_shader GLSL
18#version 430
19layout(location = 0) in vec2 position_in;
20
21void main()
22{
23    gl_Position = vec4(position_in, 0, 1);
24}
25END
26
27SHADER fragment frag_shader GLSL
28#version 430
29layout(location = 0) out highp vec4 frag_out;
30void main()
31{
32    gl_FragDepth = 2.0;
33    frag_out = vec4(0, 1, 0, 1);
34}
35END
36
37BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
38BUFFER depth0 FORMAT D32_SFLOAT
39
40BUFFER fs_depth DATA_TYPE float DATA
410.0
42END
43
44PIPELINE graphics pipeline
45  DEPTH
46    TEST on
47    COMPARE_OP equal
48    WRITE on
49  END
50
51  VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
52
53  ATTACH vert_shader
54  ATTACH frag_shader
55  BIND BUFFER framebuffer0 AS color LOCATION 0
56  BIND BUFFER depth0 AS depth_stencil
57  FRAMEBUFFER_SIZE 60 60
58END
59
60CLEAR_COLOR pipeline 0 0 0 0
61CLEAR_DEPTH pipeline 1.0
62CLEAR pipeline
63RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
64
65EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
66EXPECT depth0 IDX 0 EQ 1.0
67