yes
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# A test for a coverage-gap found by the GraphicsFuzz project.
|
||||
|
||||
# Short description: A fragment shader that covers specific LLVM code paths
|
||||
|
||||
# The test passes because the shader always writes red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '-O'
|
||||
# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 320 es
|
||||
#
|
||||
# #define _int_8 _GLF_uniform_int_values[0]
|
||||
# #define _int_2 _GLF_uniform_int_values[1]
|
||||
# #define _int_0 _GLF_uniform_int_values[2]
|
||||
# #define _int_1 _GLF_uniform_int_values[3]
|
||||
# #define _int_3 _GLF_uniform_int_values[4]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_2_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [8, 2, 0, 1, 3]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[5];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [0.0, 2.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of injectionSwitch: [0.0, 1.0]
|
||||
# layout(set = 0, binding = 2) uniform buf2
|
||||
# {
|
||||
# highp vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# // Returns true if v.y >= 2.0.
|
||||
# bool func0(vec4 v)
|
||||
# {
|
||||
# // Always false.
|
||||
# while(injectionSwitch.x < _float_0_0)
|
||||
# {
|
||||
# return false;
|
||||
# }
|
||||
#
|
||||
# if(v.y < _float_2_0)
|
||||
# {
|
||||
# return false;
|
||||
# }
|
||||
#
|
||||
# return true;
|
||||
# }
|
||||
#
|
||||
# // Returns 2.
|
||||
# int func1()
|
||||
# {
|
||||
# int a = _int_0;
|
||||
#
|
||||
# // Iterates seven times.
|
||||
# for(int i = _int_1; i < _int_8; i++)
|
||||
# {
|
||||
# if(func0(vec4[8](vec4(_int_1), vec4(_int_1), vec4(_int_3), vec4(_int_1), vec4(_int_1), vec4(_int_1), vec4(_int_1), vec4(_int_1))[i]))
|
||||
# {
|
||||
# a = i;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# return a;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always true.
|
||||
# if(func1() == _int_2)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(_int_0);
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 275
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %139
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %24 "buf2"
|
||||
OpMemberName %24 0 "injectionSwitch"
|
||||
OpName %26 ""
|
||||
OpName %35 "buf1"
|
||||
OpMemberName %35 0 "_GLF_uniform_float_values"
|
||||
OpName %37 ""
|
||||
OpName %61 "buf0"
|
||||
OpMemberName %61 0 "_GLF_uniform_int_values"
|
||||
OpName %63 ""
|
||||
OpName %139 "_GLF_color"
|
||||
OpMemberDecorate %24 0 Offset 0
|
||||
OpDecorate %24 Block
|
||||
OpDecorate %26 DescriptorSet 0
|
||||
OpDecorate %26 Binding 2
|
||||
OpDecorate %34 ArrayStride 16
|
||||
OpMemberDecorate %35 0 Offset 0
|
||||
OpDecorate %35 Block
|
||||
OpDecorate %37 DescriptorSet 0
|
||||
OpDecorate %37 Binding 1
|
||||
OpDecorate %60 ArrayStride 16
|
||||
OpMemberDecorate %61 0 Offset 0
|
||||
OpDecorate %61 Block
|
||||
OpDecorate %63 DescriptorSet 0
|
||||
OpDecorate %63 Binding 0
|
||||
OpDecorate %139 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%9 = OpTypeBool
|
||||
%14 = OpTypeInt 32 1
|
||||
%23 = OpTypeVector %6 2
|
||||
%24 = OpTypeStruct %23
|
||||
%25 = OpTypePointer Uniform %24
|
||||
%26 = OpVariable %25 Uniform
|
||||
%27 = OpConstant %14 0
|
||||
%28 = OpTypeInt 32 0
|
||||
%29 = OpConstant %28 0
|
||||
%30 = OpTypePointer Uniform %6
|
||||
%33 = OpConstant %28 2
|
||||
%34 = OpTypeArray %6 %33
|
||||
%35 = OpTypeStruct %34
|
||||
%36 = OpTypePointer Uniform %35
|
||||
%37 = OpVariable %36 Uniform
|
||||
%41 = OpConstantFalse %9
|
||||
%47 = OpConstant %14 1
|
||||
%54 = OpConstantTrue %9
|
||||
%59 = OpConstant %28 5
|
||||
%60 = OpTypeArray %14 %59
|
||||
%61 = OpTypeStruct %60
|
||||
%62 = OpTypePointer Uniform %61
|
||||
%63 = OpVariable %62 Uniform
|
||||
%64 = OpConstant %14 2
|
||||
%65 = OpTypePointer Uniform %14
|
||||
%69 = OpConstant %14 3
|
||||
%89 = OpConstant %14 4
|
||||
%114 = OpConstant %28 8
|
||||
%115 = OpTypeArray %7 %114
|
||||
%119 = OpTypePointer Function %115
|
||||
%138 = OpTypePointer Output %7
|
||||
%139 = OpVariable %138 Output
|
||||
%263 = OpUndef %9
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%169 = OpVariable %119 Function
|
||||
%172 = OpAccessChain %65 %63 %27 %64
|
||||
%173 = OpLoad %14 %172
|
||||
%174 = OpAccessChain %65 %63 %27 %69
|
||||
%175 = OpLoad %14 %174
|
||||
OpBranch %176
|
||||
%176 = OpLabel
|
||||
%262 = OpPhi %9 %263 %5 %259 %223
|
||||
%256 = OpPhi %14 %173 %5 %274 %223
|
||||
%255 = OpPhi %14 %175 %5 %225 %223
|
||||
%179 = OpAccessChain %65 %63 %27 %27
|
||||
%180 = OpLoad %14 %179
|
||||
%181 = OpSLessThan %9 %255 %180
|
||||
OpLoopMerge %226 %223 None
|
||||
OpBranchConditional %181 %182 %226
|
||||
%182 = OpLabel
|
||||
%185 = OpConvertSToF %6 %175
|
||||
%186 = OpCompositeConstruct %7 %185 %185 %185 %185
|
||||
%191 = OpAccessChain %65 %63 %27 %89
|
||||
%192 = OpLoad %14 %191
|
||||
%193 = OpConvertSToF %6 %192
|
||||
%194 = OpCompositeConstruct %7 %193 %193 %193 %193
|
||||
%215 = OpCompositeConstruct %115 %186 %186 %194 %186 %186 %186 %186 %186
|
||||
OpStore %169 %215
|
||||
%217 = OpAccessChain %8 %169 %255
|
||||
%218 = OpLoad %7 %217
|
||||
OpSelectionMerge %252 None
|
||||
OpSwitch %29 %232
|
||||
%232 = OpLabel
|
||||
OpBranch %233
|
||||
%233 = OpLabel
|
||||
%235 = OpAccessChain %30 %26 %27 %29
|
||||
%236 = OpLoad %6 %235
|
||||
%237 = OpAccessChain %30 %37 %27 %27
|
||||
%238 = OpLoad %6 %237
|
||||
%239 = OpFOrdLessThan %9 %236 %238
|
||||
OpLoopMerge %242 %241 None
|
||||
OpBranchConditional %239 %240 %242
|
||||
%240 = OpLabel
|
||||
OpBranch %242
|
||||
%241 = OpLabel
|
||||
OpBranch %233
|
||||
%242 = OpLabel
|
||||
%260 = OpPhi %9 %262 %233 %41 %240
|
||||
%257 = OpPhi %9 %41 %233 %54 %240
|
||||
OpSelectionMerge %244 None
|
||||
OpBranchConditional %257 %252 %244
|
||||
%244 = OpLabel
|
||||
%246 = OpCompositeExtract %6 %218 1
|
||||
%247 = OpAccessChain %30 %37 %27 %47
|
||||
%248 = OpLoad %6 %247
|
||||
%249 = OpFOrdLessThan %9 %246 %248
|
||||
OpSelectionMerge %251 None
|
||||
OpBranchConditional %249 %250 %251
|
||||
%250 = OpLabel
|
||||
OpBranch %252
|
||||
%251 = OpLabel
|
||||
OpBranch %252
|
||||
%252 = OpLabel
|
||||
%259 = OpPhi %9 %260 %242 %41 %250 %54 %251
|
||||
%274 = OpSelect %14 %259 %255 %256
|
||||
OpBranch %223
|
||||
%223 = OpLabel
|
||||
%225 = OpIAdd %14 %255 %47
|
||||
OpBranch %176
|
||||
%226 = OpLabel
|
||||
%133 = OpAccessChain %65 %63 %27 %47
|
||||
%134 = OpLoad %14 %133
|
||||
%135 = OpIEqual %9 %256 %134
|
||||
OpSelectionMerge %137 None
|
||||
OpBranchConditional %135 %136 %153
|
||||
%153 = OpLabel
|
||||
%156 = OpConvertSToF %6 %173
|
||||
%157 = OpCompositeConstruct %7 %156 %156 %156 %156
|
||||
OpStore %139 %157
|
||||
OpBranch %137
|
||||
%136 = OpLabel
|
||||
%142 = OpConvertSToF %6 %175
|
||||
%145 = OpConvertSToF %6 %173
|
||||
%152 = OpCompositeConstruct %7 %142 %145 %145 %142
|
||||
OpStore %139 %152
|
||||
OpBranch %137
|
||||
%137 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
|
||||
0.0 1.0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0 2.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
8 2 0 1 3
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 32 32
|
||||
BIND BUFFER variant_framebuffer AS color LOCATION 0
|
||||
BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0
|
||||
END
|
||||
CLEAR_COLOR variant_pipeline 0 0 0 255
|
||||
|
||||
CLEAR variant_pipeline
|
||||
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255
|
||||
Reference in New Issue
Block a user