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