Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-cosh-clamped-to-one.amber
1 #!amber
2
3 # Copyright 2021 Google LLC
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 #     http://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
17
18 # A test for a coverage-gap found by the GraphicsFuzz project.
19
20 # Short description: A fragment shader that covers specific NIR code paths
21
22 # The test passes because the shader always writes red.
23
24 SHADER vertex variant_vertex_shader PASSTHROUGH
25
26 # variant_fragment_shader is derived from the following GLSL:
27 # #version 320 es
28 #
29 # #define _int_0 _GLF_uniform_int_values[0]
30 # #define _float_1_0 _GLF_uniform_float_values[0]
31 #
32 # precision highp float;
33 # precision highp int;
34 #
35 # // Contents of _GLF_uniform_float_values: 1.0
36 # layout(set = 0, binding = 0) uniform buf0
37 # {
38 #     float _GLF_uniform_float_values[1];
39 # };
40 # // Contents of _GLF_uniform_int_values: 0
41 # layout(set = 0, binding = 1) uniform buf1
42 # {
43 #     int _GLF_uniform_int_values[1];
44 # };
45 # layout(location = 0) out vec4 _GLF_color;
46 #
47 # void main()
48 # {
49 #     vec4 v = clamp(cosh(vec4(1.0)), _float_1_0, 1.0);
50 #     _GLF_color = vec4(v.x, _int_0, _int_0, v.z);
51 # }
52 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
53 ; SPIR-V
54 ; Version: 1.0
55 ; Generator: Khronos Glslang Reference Front End; 10
56 ; Bound: 48
57 ; Schema: 0
58                OpCapability Shader
59           %1 = OpExtInstImport "GLSL.std.450"
60                OpMemoryModel Logical GLSL450
61                OpEntryPoint Fragment %4 "main" %28
62                OpExecutionMode %4 OriginUpperLeft
63                OpSource ESSL 320
64                OpName %4 "main"
65                OpName %9 "v"
66                OpName %16 "buf0"
67                OpMemberName %16 0 "_GLF_uniform_float_values"
68                OpName %18 ""
69                OpName %28 "_GLF_color"
70                OpName %34 "buf1"
71                OpMemberName %34 0 "_GLF_uniform_int_values"
72                OpName %36 ""
73                OpDecorate %15 ArrayStride 16
74                OpMemberDecorate %16 0 Offset 0
75                OpDecorate %16 Block
76                OpDecorate %18 DescriptorSet 0
77                OpDecorate %18 Binding 0
78                OpDecorate %28 Location 0
79                OpDecorate %33 ArrayStride 16
80                OpMemberDecorate %34 0 Offset 0
81                OpDecorate %34 Block
82                OpDecorate %36 DescriptorSet 0
83                OpDecorate %36 Binding 1
84           %2 = OpTypeVoid
85           %3 = OpTypeFunction %2
86           %6 = OpTypeFloat 32
87           %7 = OpTypeVector %6 4
88           %8 = OpTypePointer Function %7
89          %10 = OpConstant %6 1
90          %11 = OpConstantComposite %7 %10 %10 %10 %10
91          %13 = OpTypeInt 32 0
92          %14 = OpConstant %13 1
93          %15 = OpTypeArray %6 %14
94          %16 = OpTypeStruct %15
95          %17 = OpTypePointer Uniform %16
96          %18 = OpVariable %17 Uniform
97          %19 = OpTypeInt 32 1
98          %20 = OpConstant %19 0
99          %21 = OpTypePointer Uniform %6
100          %27 = OpTypePointer Output %7
101          %28 = OpVariable %27 Output
102          %29 = OpConstant %13 0
103          %30 = OpTypePointer Function %6
104          %33 = OpTypeArray %19 %14
105          %34 = OpTypeStruct %33
106          %35 = OpTypePointer Uniform %34
107          %36 = OpVariable %35 Uniform
108          %37 = OpTypePointer Uniform %19
109          %44 = OpConstant %13 2
110           %4 = OpFunction %2 None %3
111           %5 = OpLabel
112           %9 = OpVariable %8 Function
113          %12 = OpExtInst %7 %1 Cosh %11
114          %22 = OpAccessChain %21 %18 %20 %20
115          %23 = OpLoad %6 %22
116          %24 = OpCompositeConstruct %7 %23 %23 %23 %23
117          %25 = OpCompositeConstruct %7 %10 %10 %10 %10
118          %26 = OpExtInst %7 %1 FClamp %12 %24 %25
119                OpStore %9 %26
120          %31 = OpAccessChain %30 %9 %29
121          %32 = OpLoad %6 %31
122          %38 = OpAccessChain %37 %36 %20 %20
123          %39 = OpLoad %19 %38
124          %40 = OpConvertSToF %6 %39
125          %41 = OpAccessChain %37 %36 %20 %20
126          %42 = OpLoad %19 %41
127          %43 = OpConvertSToF %6 %42
128          %45 = OpAccessChain %30 %9 %44
129          %46 = OpLoad %6 %45
130          %47 = OpCompositeConstruct %7 %32 %40 %43 %46
131                OpStore %28 %47
132                OpReturn
133                OpFunctionEnd
134 END
135
136 # uniforms for variant
137
138 # _GLF_uniform_int_values
139 BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
140  0
141 END
142 # _GLF_uniform_float_values
143 BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
144  1.0
145 END
146
147 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
148
149 PIPELINE graphics variant_pipeline
150   ATTACH variant_vertex_shader
151   ATTACH variant_fragment_shader
152   FRAMEBUFFER_SIZE 256 256
153   BIND BUFFER variant_framebuffer AS color LOCATION 0
154   BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
155   BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0
156 END
157 CLEAR_COLOR variant_pipeline 0 0 0 255
158
159 CLEAR variant_pipeline
160 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
161
162 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255