Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-const-folding-clamp-max.amber
1 #!amber
2
3 # Copyright 2019 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 GraphicsFuzz.
19
20 # Short description: A fragment shader that covers a specific const folding rule path.
21
22 # The test passes because 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 310 es
28 # precision highp float;
29 #
30 # layout(location = 0) out vec4 _GLF_color;
31 #
32 # void main()
33 # {
34 #     // If condition is always false.
35 #     if (
36 #         clamp(
37 #             vec4(3000.0, 1.0, 8.0, 4.0),
38 #             vec4(2.0, 3.0, determinant(mat2(2.0, 0.0, 0.0, 2.0)), 5.0), // min = (2, 3, 4, 5)
39 #             vec4(6.0)                                                   // max = (6, 6, 6, 6)
40 #             ) != vec4(6, 3, 6, 5)
41 #        )
42 #         _GLF_color = vec4(0);
43 #     else
44 #         _GLF_color = vec4(1, 0, 0, 1);
45 # }
46 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
47 ; SPIR-V
48 ; Version: 1.0
49 ; Generator: Khronos Glslang Reference Front End; 8
50 ; Bound: 39
51 ; Schema: 0
52                OpCapability Shader
53           %1 = OpExtInstImport "GLSL.std.450"
54                OpMemoryModel Logical GLSL450
55                OpEntryPoint Fragment %4 "main" %35
56                OpExecutionMode %4 OriginUpperLeft
57                OpSource ESSL 310
58                OpName %4 "main"
59                OpName %35 "_GLF_color"
60                OpDecorate %35 Location 0
61           %2 = OpTypeVoid
62           %3 = OpTypeFunction %2
63           %6 = OpTypeFloat 32
64           %7 = OpTypeVector %6 4
65           %8 = OpConstant %6 3000
66           %9 = OpConstant %6 1
67          %10 = OpConstant %6 8
68          %11 = OpConstant %6 4
69          %12 = OpConstantComposite %7 %8 %9 %10 %11
70          %13 = OpConstant %6 2
71          %14 = OpConstant %6 3
72          %15 = OpTypeVector %6 2
73          %16 = OpTypeMatrix %15 2
74          %17 = OpConstant %6 0
75          %18 = OpConstantComposite %15 %13 %17
76          %19 = OpConstantComposite %15 %17 %13
77          %20 = OpConstantComposite %16 %18 %19
78          %22 = OpConstant %6 5
79          %24 = OpConstant %6 6
80          %25 = OpConstantComposite %7 %24 %24 %24 %24
81          %27 = OpConstantComposite %7 %24 %14 %24 %22
82          %28 = OpTypeBool
83          %29 = OpTypeVector %28 4
84          %34 = OpTypePointer Output %7
85          %35 = OpVariable %34 Output
86          %36 = OpConstantComposite %7 %17 %17 %17 %17
87          %38 = OpConstantComposite %7 %9 %17 %17 %9
88           %4 = OpFunction %2 None %3
89           %5 = OpLabel
90          %21 = OpExtInst %6 %1 Determinant %20
91          %23 = OpCompositeConstruct %7 %13 %14 %21 %22
92          %26 = OpExtInst %7 %1 FClamp %12 %23 %25
93          %30 = OpFOrdNotEqual %29 %26 %27
94          %31 = OpAny %28 %30
95                OpSelectionMerge %33 None
96                OpBranchConditional %31 %32 %37
97          %32 = OpLabel
98                OpStore %35 %36
99                OpBranch %33
100          %37 = OpLabel
101                OpStore %35 %38
102                OpBranch %33
103          %33 = OpLabel
104                OpReturn
105                OpFunctionEnd
106 END
107
108
109 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
110
111 PIPELINE graphics variant_pipeline
112   ATTACH variant_vertex_shader
113   ATTACH variant_fragment_shader
114   FRAMEBUFFER_SIZE 256 256
115   BIND BUFFER variant_framebuffer AS color LOCATION 0
116 END
117 CLEAR_COLOR variant_pipeline 0 0 0 255
118
119 CLEAR variant_pipeline
120 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
121
122 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255