Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-simplify-div-by-uint-one.amber
1 #!amber
2
3 # Copyright 2020 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 instruction simplification code path
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 310 es
28 # precision highp float;
29 # precision highp int;
30 #
31 # layout(location = 0) out vec4 _GLF_color;
32 #
33 # layout(set = 0, binding = 0) uniform buf0
34 # {
35 #     uint two;
36 # };
37 #
38 # void main()
39 # {
40 #     uint a = two / 1u;
41 #
42 #     if (a == 2u)
43 #         _GLF_color = vec4(1, 0, 0, 1);
44 #     else
45 #         _GLF_color = vec4(0);
46 #
47 # }
48 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
49 ; SPIR-V
50 ; Version: 1.0
51 ; Generator: Khronos Glslang Reference Front End; 8
52 ; Bound: 34
53 ; Schema: 0
54                OpCapability Shader
55           %1 = OpExtInstImport "GLSL.std.450"
56                OpMemoryModel Logical GLSL450
57                OpEntryPoint Fragment %4 "main" %28
58                OpExecutionMode %4 OriginUpperLeft
59                OpSource ESSL 310
60                OpName %4 "main"
61                OpName %8 "a"
62                OpName %9 "buf0"
63                OpMemberName %9 0 "two"
64                OpName %11 ""
65                OpName %28 "_GLF_color"
66                OpMemberDecorate %9 0 Offset 0
67                OpDecorate %9 Block
68                OpDecorate %11 DescriptorSet 0
69                OpDecorate %11 Binding 0
70                OpDecorate %28 Location 0
71           %2 = OpTypeVoid
72           %3 = OpTypeFunction %2
73           %6 = OpTypeInt 32 0
74           %7 = OpTypePointer Function %6
75           %9 = OpTypeStruct %6
76          %10 = OpTypePointer Uniform %9
77          %11 = OpVariable %10 Uniform
78          %12 = OpTypeInt 32 1
79          %13 = OpConstant %12 0
80          %14 = OpTypePointer Uniform %6
81          %17 = OpConstant %6 1
82          %20 = OpConstant %6 2
83          %21 = OpTypeBool
84          %25 = OpTypeFloat 32
85          %26 = OpTypeVector %25 4
86          %27 = OpTypePointer Output %26
87          %28 = OpVariable %27 Output
88          %29 = OpConstant %25 1
89          %30 = OpConstant %25 0
90          %31 = OpConstantComposite %26 %29 %30 %30 %29
91          %33 = OpConstantComposite %26 %30 %30 %30 %30
92           %4 = OpFunction %2 None %3
93           %5 = OpLabel
94           %8 = OpVariable %7 Function
95          %15 = OpAccessChain %14 %11 %13
96          %16 = OpLoad %6 %15
97          %18 = OpUDiv %6 %16 %17
98                OpStore %8 %18
99          %19 = OpLoad %6 %8
100          %22 = OpIEqual %21 %19 %20
101                OpSelectionMerge %24 None
102                OpBranchConditional %22 %23 %32
103          %23 = OpLabel
104                OpStore %28 %31
105                OpBranch %24
106          %32 = OpLabel
107                OpStore %28 %33
108                OpBranch %24
109          %24 = OpLabel
110                OpReturn
111                OpFunctionEnd
112 END
113
114 # uniforms for variant
115
116 # two
117 BUFFER variant_two DATA_TYPE uint32 DATA
118  2
119 END
120
121 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
122
123 PIPELINE graphics variant_pipeline
124   ATTACH variant_vertex_shader
125   ATTACH variant_fragment_shader
126   FRAMEBUFFER_SIZE 256 256
127   BIND BUFFER variant_framebuffer AS color LOCATION 0
128   BIND BUFFER variant_two AS uniform DESCRIPTOR_SET 0 BINDING 0
129 END
130 CLEAR_COLOR variant_pipeline 0 0 0 255
131
132 CLEAR variant_pipeline
133 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
134
135 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255