3 # Copyright 2021 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 the GraphicsFuzz project.
20 # Short description: A fragment shader that covers specific LLVM code paths
22 # The test passes because the shader always writes red.
24 SHADER vertex variant_vertex_shader PASSTHROUGH
26 # variant_fragment_shader is derived from the following GLSL:
29 # precision highp int;
30 # precision highp float;
32 # layout(location = 0) out vec4 _GLF_color;
40 # if(0x3f800000 == floatBitsToInt(1.0))
42 # _GLF_color = vec4(1, 0, 0, 1);
46 # _GLF_color = vec4(0);
50 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
53 ; Generator: Khronos Glslang Reference Front End; 10
57 %1 = OpExtInstImport "GLSL.std.450"
58 OpMemoryModel Logical GLSL450
59 OpEntryPoint Fragment %4 "main" %20
60 OpExecutionMode %4 OriginUpperLeft
63 OpName %20 "_GLF_color"
64 OpDecorate %20 Location 0
66 %3 = OpTypeFunction %2
68 %7 = OpConstantTrue %6
70 %11 = OpConstant %10 1065353216
72 %13 = OpConstant %12 1
73 %18 = OpTypeVector %12 4
74 %19 = OpTypePointer Output %18
75 %20 = OpVariable %19 Output
76 %21 = OpConstant %12 0
77 %22 = OpConstantComposite %18 %13 %21 %21 %13
78 %24 = OpConstantComposite %18 %21 %21 %21 %21
79 %4 = OpFunction %2 None %3
81 OpSelectionMerge %9 None
82 OpBranchConditional %7 %8 %9
86 %14 = OpBitcast %10 %13
87 %15 = OpIEqual %6 %11 %14
88 OpSelectionMerge %17 None
89 OpBranchConditional %15 %16 %23
102 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
104 PIPELINE graphics variant_pipeline
105 ATTACH variant_vertex_shader
106 ATTACH variant_fragment_shader
107 FRAMEBUFFER_SIZE 256 256
108 BIND BUFFER variant_framebuffer AS color LOCATION 0
110 CLEAR_COLOR variant_pipeline 0 0 0 255
112 CLEAR variant_pipeline
113 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
115 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255