3 # Copyright 2020 Google LLC
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # A test for a coverage-gap found by GraphicsFuzz.
20 # Short description: A fragment shader that covers a specific block frequency info code path.
22 # The test passes because shader always writes red.
24 SHADER vertex variant_vertex_shader PASSTHROUGH
26 # variant_fragment_shader is derived from the following GLSL:
28 # precision highp float;
29 # precision highp int;
31 # layout(location = 0) out vec4 _GLF_color;
35 # vec4 c = vec4(0, 0, 0, 1);
42 # // Executed only once with a = 0.
45 # for(int i1 = 0; i1 < 1; i1++)
46 # for(int i2 = 0; i2 < 1; i2++)
47 # for(int i3 = 0; i3 < 1; i3++)
48 # for(int i4 = 0; i4 < 1; i4++)
49 # for(int i5 = 0; i5 < 1; i5++)
50 # for(int i6 = 0; i6 < 1; i6++)
51 # for(int i7 = 0; i7 < 1; i7++)
52 # for(int i8 = 0; i8 < 17; i8++)
55 # while(gl_FragCoord.x < -1.0);
56 # } while(gl_FragCoord.y < -1.0);
59 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
62 ; Generator: Khronos Glslang Reference Front End; 8
66 %1 = OpExtInstImport "GLSL.std.450"
67 OpMemoryModel Logical GLSL450
68 OpEntryPoint Fragment %4 "main" %114 %127
69 OpExecutionMode %4 OriginUpperLeft
82 OpName %114 "gl_FragCoord"
83 OpName %127 "_GLF_color"
84 OpDecorate %114 BuiltIn FragCoord
85 OpDecorate %127 Location 0
87 %3 = OpTypeFunction %2
89 %7 = OpTypeVector %6 4
90 %8 = OpTypePointer Function %7
93 %12 = OpConstantComposite %7 %10 %10 %10 %11
95 %14 = OpTypePointer Function %13
96 %16 = OpConstant %13 0
97 %26 = OpTypePointer Function %6
98 %35 = OpConstant %13 1
100 %93 = OpConstant %13 17
101 %113 = OpTypePointer Input %7
102 %114 = OpVariable %113 Input
103 %115 = OpTypeInt 32 0
104 %116 = OpConstant %115 0
105 %117 = OpTypePointer Input %6
106 %120 = OpConstant %6 -1
107 %122 = OpConstant %115 1
108 %126 = OpTypePointer Output %7
109 %127 = OpVariable %126 Output
110 %4 = OpFunction %2 None %3
112 %9 = OpVariable %8 Function
113 %15 = OpVariable %14 Function
114 %28 = OpVariable %14 Function
115 %38 = OpVariable %14 Function
116 %46 = OpVariable %14 Function
117 %54 = OpVariable %14 Function
118 %62 = OpVariable %14 Function
119 %70 = OpVariable %14 Function
120 %78 = OpVariable %14 Function
121 %86 = OpVariable %14 Function
126 OpLoopMerge %19 %20 None
131 OpLoopMerge %23 %24 None
135 %27 = OpAccessChain %26 %9 %25
140 OpLoopMerge %31 %32 None
144 %37 = OpSLessThan %36 %34 %35
145 OpBranchConditional %37 %30 %31
150 OpLoopMerge %41 %42 None
154 %45 = OpSLessThan %36 %44 %35
155 OpBranchConditional %45 %40 %41
160 OpLoopMerge %49 %50 None
164 %53 = OpSLessThan %36 %52 %35
165 OpBranchConditional %53 %48 %49
170 OpLoopMerge %57 %58 None
174 %61 = OpSLessThan %36 %60 %35
175 OpBranchConditional %61 %56 %57
180 OpLoopMerge %65 %66 None
184 %69 = OpSLessThan %36 %68 %35
185 OpBranchConditional %69 %64 %65
190 OpLoopMerge %73 %74 None
194 %77 = OpSLessThan %36 %76 %35
195 OpBranchConditional %77 %72 %73
200 OpLoopMerge %81 %82 None
204 %85 = OpSLessThan %36 %84 %35
205 OpBranchConditional %85 %80 %81
210 OpLoopMerge %89 %90 None
214 %94 = OpSLessThan %36 %92 %93
215 OpBranchConditional %94 %88 %89
218 %96 = OpIAdd %13 %95 %35
223 %98 = OpIAdd %13 %97 %35
230 %100 = OpIAdd %13 %99 %35
236 %101 = OpLoad %13 %70
237 %102 = OpIAdd %13 %101 %35
243 %103 = OpLoad %13 %62
244 %104 = OpIAdd %13 %103 %35
250 %105 = OpLoad %13 %54
251 %106 = OpIAdd %13 %105 %35
257 %107 = OpLoad %13 %46
258 %108 = OpIAdd %13 %107 %35
264 %109 = OpLoad %13 %38
265 %110 = OpIAdd %13 %109 %35
271 %111 = OpLoad %13 %28
272 %112 = OpIAdd %13 %111 %35
278 %118 = OpAccessChain %117 %114 %116
279 %119 = OpLoad %6 %118
280 %121 = OpFOrdLessThan %36 %119 %120
281 OpBranchConditional %121 %21 %23
285 %123 = OpAccessChain %117 %114 %122
286 %124 = OpLoad %6 %123
287 %125 = OpFOrdLessThan %36 %124 %120
288 OpBranchConditional %125 %17 %19
297 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
299 PIPELINE graphics variant_pipeline
300 ATTACH variant_vertex_shader
301 ATTACH variant_fragment_shader
302 FRAMEBUFFER_SIZE 16 16
303 BIND BUFFER variant_framebuffer AS color LOCATION 0
305 CLEAR_COLOR variant_pipeline 0 0 0 255
307 CLEAR variant_pipeline
308 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16
310 EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255