• 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
16DEVICE_FEATURE depthClamp
17DEVICE_FEATURE fragmentStoresAndAtomics
18
19SHADER vertex vert_shader GLSL
20#version 430
21layout(location = 0) in vec2 position_in;
22
23void main()
24{
25    gl_Position = vec4(position_in, 2, 1);
26}
27END
28
29SHADER fragment frag_shader GLSL
30#version 430
31layout(early_fragment_tests) in;
32
33layout (binding=0) buffer B {
34    float d;
35};
36
37layout(location = 0) out highp vec4 frag_out;
38void main()
39{
40    d = gl_FragCoord.z;
41    frag_out = vec4(0, 1, 0, 1);
42}
43END
44
45BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
46BUFFER depth0 FORMAT D32_SFLOAT
47
48BUFFER fs_depth DATA_TYPE float DATA
490.0
50END
51
52PIPELINE graphics pipeline
53  DEPTH
54    TEST on
55    WRITE on
56    CLAMP on
57  END
58
59  VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
60
61  ATTACH vert_shader
62  ATTACH frag_shader
63  BIND BUFFER framebuffer0 AS color LOCATION 0
64  BIND BUFFER depth0 AS depth_stencil
65  FRAMEBUFFER_SIZE 60 60
66
67  BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
68END
69
70CLEAR_COLOR pipeline 0 0 0 0
71CLEAR_DEPTH pipeline 1.0
72CLEAR pipeline
73RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
74
75EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
76EXPECT depth0 IDX 0 EQ 0.9
77EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7
78