• 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 (binding=0) buffer B {
32    float d;
33};
34
35layout(location = 0) out highp vec4 frag_out;
36void main()
37{
38    d = gl_FragCoord.z;
39    frag_out = vec4(0, 1, 0, 1);
40}
41END
42
43BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
44BUFFER depth0 FORMAT D32_SFLOAT
45
46BUFFER fs_depth DATA_TYPE float DATA
470.0
48END
49
50PIPELINE graphics pipeline
51  DEPTH
52    TEST on
53    WRITE on
54    CLAMP on
55  END
56
57  VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
58
59  ATTACH vert_shader
60  ATTACH frag_shader
61  BIND BUFFER framebuffer0 AS color LOCATION 0
62  BIND BUFFER depth0 AS depth_stencil
63  FRAMEBUFFER_SIZE 60 60
64
65  BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
66END
67
68CLEAR_COLOR pipeline 0 0 0 0
69CLEAR_DEPTH pipeline 1.0
70CLEAR pipeline
71RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
72
73EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
74EXPECT depth0 IDX 0 EQ 0.9
75EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7
76