yes
This commit is contained in:
@@ -0,0 +1,283 @@
|
||||
#!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.
|
||||
|
||||
DEVICE_EXTENSION VK_KHR_shader_terminate_invocation
|
||||
|
||||
# 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_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _int_64 _GLF_uniform_int_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1, 64]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# // Contents of injectionSwitch: [0.0, 1.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always false.
|
||||
# if(injectionSwitch.x > injectionSwitch.y)
|
||||
# {
|
||||
# return;
|
||||
# }
|
||||
#
|
||||
# int a = 0;
|
||||
#
|
||||
# do
|
||||
# {
|
||||
# // Iterates twice but has no effect.
|
||||
# for(int i = 1; i < findLSB(8); i++)
|
||||
# {
|
||||
# if(i < a)
|
||||
# {
|
||||
# continue;
|
||||
# }
|
||||
#
|
||||
# // Always false.
|
||||
# if(injectionSwitch.x > injectionSwitch.y)
|
||||
# {
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# // Always false.
|
||||
# if(gl_FragCoord.y < 0.0)
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# a++;
|
||||
# }
|
||||
# while(a < 64);
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == _int_64)
|
||||
# {
|
||||
# _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: 117
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %59 %89
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "buf1"
|
||||
OpMemberName %8 0 "injectionSwitch"
|
||||
OpName %10 ""
|
||||
OpName %59 "gl_FragCoord"
|
||||
OpName %78 "buf0"
|
||||
OpMemberName %78 0 "_GLF_uniform_int_values"
|
||||
OpName %80 ""
|
||||
OpName %89 "_GLF_color"
|
||||
OpMemberDecorate %8 0 Offset 0
|
||||
OpDecorate %8 Block
|
||||
OpDecorate %10 DescriptorSet 0
|
||||
OpDecorate %10 Binding 1
|
||||
OpDecorate %41 RelaxedPrecision
|
||||
OpDecorate %59 BuiltIn FragCoord
|
||||
OpDecorate %77 ArrayStride 16
|
||||
OpMemberDecorate %78 0 Offset 0
|
||||
OpDecorate %78 Block
|
||||
OpDecorate %80 DescriptorSet 0
|
||||
OpDecorate %80 Binding 0
|
||||
OpDecorate %89 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypeStruct %7
|
||||
%9 = OpTypePointer Uniform %8
|
||||
%10 = OpVariable %9 Uniform
|
||||
%11 = OpTypeInt 32 1
|
||||
%12 = OpConstant %11 0
|
||||
%13 = OpTypeInt 32 0
|
||||
%14 = OpConstant %13 0
|
||||
%15 = OpTypePointer Uniform %6
|
||||
%18 = OpConstant %13 1
|
||||
%21 = OpTypeBool
|
||||
%33 = OpConstant %11 1
|
||||
%40 = OpConstant %11 8
|
||||
%57 = OpTypeVector %6 4
|
||||
%58 = OpTypePointer Input %57
|
||||
%59 = OpVariable %58 Input
|
||||
%60 = OpTypePointer Input %6
|
||||
%63 = OpConstant %6 0
|
||||
%73 = OpConstant %11 64
|
||||
%76 = OpConstant %13 3
|
||||
%77 = OpTypeArray %11 %76
|
||||
%78 = OpTypeStruct %77
|
||||
%79 = OpTypePointer Uniform %78
|
||||
%80 = OpVariable %79 Uniform
|
||||
%81 = OpConstant %11 2
|
||||
%82 = OpTypePointer Uniform %11
|
||||
%88 = OpTypePointer Output %57
|
||||
%89 = OpVariable %88 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
OpSelectionMerge %108 None
|
||||
OpSwitch %14 %109
|
||||
%109 = OpLabel
|
||||
%16 = OpAccessChain %15 %10 %12 %14
|
||||
%17 = OpLoad %6 %16
|
||||
%19 = OpAccessChain %15 %10 %12 %18
|
||||
%20 = OpLoad %6 %19
|
||||
%22 = OpFOrdGreaterThan %21 %17 %20
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %22 %23 %24
|
||||
%23 = OpLabel
|
||||
OpBranch %108
|
||||
%24 = OpLabel
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
%116 = OpPhi %11 %12 %24 %71 %31
|
||||
OpLoopMerge %30 %31 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%114 = OpPhi %11 %33 %28 %69 %37
|
||||
%41 = OpExtInst %11 %1 FindILsb %40
|
||||
%42 = OpSLessThan %21 %114 %41
|
||||
OpLoopMerge %36 %37 None
|
||||
OpBranchConditional %42 %35 %36
|
||||
%35 = OpLabel
|
||||
%45 = OpSLessThan %21 %114 %116
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %45 %46 %47
|
||||
%46 = OpLabel
|
||||
OpBranch %37
|
||||
%47 = OpLabel
|
||||
OpSelectionMerge %55 None
|
||||
OpBranchConditional %22 %54 %56
|
||||
%54 = OpLabel
|
||||
OpBranch %55
|
||||
%56 = OpLabel
|
||||
%61 = OpAccessChain %60 %59 %18
|
||||
%62 = OpLoad %6 %61
|
||||
%64 = OpFOrdLessThan %21 %62 %63
|
||||
OpSelectionMerge %66 None
|
||||
OpBranchConditional %64 %65 %66
|
||||
%65 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%66 = OpLabel
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%69 = OpIAdd %11 %114 %33
|
||||
OpBranch %34
|
||||
%36 = OpLabel
|
||||
%71 = OpIAdd %11 %116 %33
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%74 = OpSLessThan %21 %71 %73
|
||||
OpBranchConditional %74 %28 %30
|
||||
%30 = OpLabel
|
||||
%83 = OpAccessChain %82 %80 %12 %81
|
||||
%84 = OpLoad %11 %83
|
||||
%85 = OpIEqual %21 %71 %84
|
||||
OpSelectionMerge %87 None
|
||||
OpBranchConditional %85 %86 %103
|
||||
%86 = OpLabel
|
||||
%90 = OpAccessChain %82 %80 %12 %33
|
||||
%91 = OpLoad %11 %90
|
||||
%92 = OpConvertSToF %6 %91
|
||||
%93 = OpAccessChain %82 %80 %12 %12
|
||||
%94 = OpLoad %11 %93
|
||||
%95 = OpConvertSToF %6 %94
|
||||
%102 = OpCompositeConstruct %57 %92 %95 %95 %92
|
||||
OpStore %89 %102
|
||||
OpBranch %87
|
||||
%103 = OpLabel
|
||||
%104 = OpAccessChain %82 %80 %12 %12
|
||||
%105 = OpLoad %11 %104
|
||||
%106 = OpConvertSToF %6 %105
|
||||
%107 = OpCompositeConstruct %57 %106 %106 %106 %106
|
||||
OpStore %89 %107
|
||||
OpBranch %87
|
||||
%87 = OpLabel
|
||||
OpBranch %108
|
||||
%108 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
|
||||
0.0 1.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1 64
|
||||
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 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