yes
This commit is contained in:
+331
@@ -0,0 +1,331 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 320 es
|
||||
#
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_2 _GLF_uniform_int_values[2]
|
||||
# #define _int_3 _GLF_uniform_int_values[3]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_3_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 2, 3]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 3.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
#
|
||||
# const int _GLF_global_loop_bound = 10;
|
||||
#
|
||||
# int _GLF_global_loop_count = 0;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float arr[9] = float[9](_float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0, _float_1_0);
|
||||
#
|
||||
# // This loop increases arr[2] by two. Other elements are left untouched.
|
||||
# while(_GLF_global_loop_count < _GLF_global_loop_bound)
|
||||
# {
|
||||
# _GLF_global_loop_count++;
|
||||
#
|
||||
# while(_GLF_global_loop_count < _GLF_global_loop_bound)
|
||||
# {
|
||||
# _GLF_global_loop_count++;
|
||||
#
|
||||
# // This gets executed twice.
|
||||
# arr[_int_2] += _float_1_0;
|
||||
#
|
||||
# int a = _int_1;
|
||||
# // Loops four times without the global loop counter restriction.
|
||||
# while(_int_2 > 0 && _GLF_global_loop_count < _GLF_global_loop_bound)
|
||||
# {
|
||||
# _GLF_global_loop_count++;
|
||||
#
|
||||
# if(a > _int_3)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
#
|
||||
# a++;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(arr[_int_2] == _float_3_0)
|
||||
# {
|
||||
# _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: 135
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %116
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "_GLF_global_loop_count"
|
||||
OpName %15 "arr"
|
||||
OpName %18 "buf1"
|
||||
OpMemberName %18 0 "_GLF_uniform_float_values"
|
||||
OpName %20 ""
|
||||
OpName %64 "buf0"
|
||||
OpMemberName %64 0 "_GLF_uniform_int_values"
|
||||
OpName %66 ""
|
||||
OpName %79 "a"
|
||||
OpName %116 "_GLF_color"
|
||||
OpDecorate %17 ArrayStride 16
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 1
|
||||
OpDecorate %63 ArrayStride 16
|
||||
OpMemberDecorate %64 0 Offset 0
|
||||
OpDecorate %64 Block
|
||||
OpDecorate %66 DescriptorSet 0
|
||||
OpDecorate %66 Binding 0
|
||||
OpDecorate %116 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Private %6
|
||||
%8 = OpVariable %7 Private
|
||||
%9 = OpConstant %6 0
|
||||
%10 = OpTypeFloat 32
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 9
|
||||
%13 = OpTypeArray %10 %12
|
||||
%14 = OpTypePointer Function %13
|
||||
%16 = OpConstant %11 3
|
||||
%17 = OpTypeArray %10 %16
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpTypePointer Uniform %10
|
||||
%47 = OpConstant %6 10
|
||||
%48 = OpTypeBool
|
||||
%51 = OpConstant %6 1
|
||||
%62 = OpConstant %11 4
|
||||
%63 = OpTypeArray %6 %62
|
||||
%64 = OpTypeStruct %63
|
||||
%65 = OpTypePointer Uniform %64
|
||||
%66 = OpVariable %65 Uniform
|
||||
%67 = OpConstant %6 2
|
||||
%68 = OpTypePointer Uniform %6
|
||||
%73 = OpTypePointer Function %10
|
||||
%78 = OpTypePointer Function %6
|
||||
%96 = OpConstant %6 3
|
||||
%114 = OpTypeVector %10 4
|
||||
%115 = OpTypePointer Output %114
|
||||
%116 = OpVariable %115 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%15 = OpVariable %14 Function
|
||||
%79 = OpVariable %78 Function
|
||||
OpStore %8 %9
|
||||
%22 = OpAccessChain %21 %20 %9 %9
|
||||
%23 = OpLoad %10 %22
|
||||
%24 = OpAccessChain %21 %20 %9 %9
|
||||
%25 = OpLoad %10 %24
|
||||
%26 = OpAccessChain %21 %20 %9 %9
|
||||
%27 = OpLoad %10 %26
|
||||
%28 = OpAccessChain %21 %20 %9 %9
|
||||
%29 = OpLoad %10 %28
|
||||
%30 = OpAccessChain %21 %20 %9 %9
|
||||
%31 = OpLoad %10 %30
|
||||
%32 = OpAccessChain %21 %20 %9 %9
|
||||
%33 = OpLoad %10 %32
|
||||
%34 = OpAccessChain %21 %20 %9 %9
|
||||
%35 = OpLoad %10 %34
|
||||
%36 = OpAccessChain %21 %20 %9 %9
|
||||
%37 = OpLoad %10 %36
|
||||
%38 = OpAccessChain %21 %20 %9 %9
|
||||
%39 = OpLoad %10 %38
|
||||
%40 = OpCompositeConstruct %13 %23 %25 %27 %29 %31 %33 %35 %37 %39
|
||||
OpStore %15 %40
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
OpLoopMerge %43 %44 None
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
%46 = OpLoad %6 %8
|
||||
%49 = OpSLessThan %48 %46 %47
|
||||
OpBranchConditional %49 %42 %43
|
||||
%42 = OpLabel
|
||||
%50 = OpLoad %6 %8
|
||||
%52 = OpIAdd %6 %50 %51
|
||||
OpStore %8 %52
|
||||
OpBranch %53
|
||||
%53 = OpLabel
|
||||
OpLoopMerge %55 %56 None
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
%58 = OpLoad %6 %8
|
||||
%59 = OpSLessThan %48 %58 %47
|
||||
OpBranchConditional %59 %54 %55
|
||||
%54 = OpLabel
|
||||
%60 = OpLoad %6 %8
|
||||
%61 = OpIAdd %6 %60 %51
|
||||
OpStore %8 %61
|
||||
%69 = OpAccessChain %68 %66 %9 %67
|
||||
%70 = OpLoad %6 %69
|
||||
%71 = OpAccessChain %21 %20 %9 %9
|
||||
%72 = OpLoad %10 %71
|
||||
%74 = OpAccessChain %73 %15 %70
|
||||
%75 = OpLoad %10 %74
|
||||
%76 = OpFAdd %10 %75 %72
|
||||
%77 = OpAccessChain %73 %15 %70
|
||||
OpStore %77 %76
|
||||
%80 = OpAccessChain %68 %66 %9 %9
|
||||
%81 = OpLoad %6 %80
|
||||
OpStore %79 %81
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
OpLoopMerge %84 %85 None
|
||||
OpBranch %86
|
||||
%86 = OpLabel
|
||||
%87 = OpAccessChain %68 %66 %9 %67
|
||||
%88 = OpLoad %6 %87
|
||||
%89 = OpSGreaterThan %48 %88 %9
|
||||
%90 = OpLoad %6 %8
|
||||
%91 = OpSLessThan %48 %90 %47
|
||||
%92 = OpLogicalAnd %48 %89 %91
|
||||
OpBranchConditional %92 %83 %84
|
||||
%83 = OpLabel
|
||||
%93 = OpLoad %6 %8
|
||||
%94 = OpIAdd %6 %93 %51
|
||||
OpStore %8 %94
|
||||
%95 = OpLoad %6 %79
|
||||
%97 = OpAccessChain %68 %66 %9 %96
|
||||
%98 = OpLoad %6 %97
|
||||
%99 = OpSGreaterThan %48 %95 %98
|
||||
OpSelectionMerge %101 None
|
||||
OpBranchConditional %99 %100 %101
|
||||
%100 = OpLabel
|
||||
OpBranch %84
|
||||
%101 = OpLabel
|
||||
%103 = OpLoad %6 %79
|
||||
%104 = OpIAdd %6 %103 %51
|
||||
OpStore %79 %104
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
OpBranch %82
|
||||
%84 = OpLabel
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
OpBranch %53
|
||||
%55 = OpLabel
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpBranch %41
|
||||
%43 = OpLabel
|
||||
%105 = OpAccessChain %68 %66 %9 %67
|
||||
%106 = OpLoad %6 %105
|
||||
%107 = OpAccessChain %73 %15 %106
|
||||
%108 = OpLoad %10 %107
|
||||
%109 = OpAccessChain %21 %20 %9 %67
|
||||
%110 = OpLoad %10 %109
|
||||
%111 = OpFOrdEqual %48 %108 %110
|
||||
OpSelectionMerge %113 None
|
||||
OpBranchConditional %111 %112 %130
|
||||
%112 = OpLabel
|
||||
%117 = OpAccessChain %68 %66 %9 %9
|
||||
%118 = OpLoad %6 %117
|
||||
%119 = OpConvertSToF %10 %118
|
||||
%120 = OpAccessChain %68 %66 %9 %51
|
||||
%121 = OpLoad %6 %120
|
||||
%122 = OpConvertSToF %10 %121
|
||||
%123 = OpAccessChain %68 %66 %9 %51
|
||||
%124 = OpLoad %6 %123
|
||||
%125 = OpConvertSToF %10 %124
|
||||
%126 = OpAccessChain %68 %66 %9 %9
|
||||
%127 = OpLoad %6 %126
|
||||
%128 = OpConvertSToF %10 %127
|
||||
%129 = OpCompositeConstruct %114 %119 %122 %125 %128
|
||||
OpStore %116 %129
|
||||
OpBranch %113
|
||||
%130 = OpLabel
|
||||
%131 = OpAccessChain %68 %66 %9 %51
|
||||
%132 = OpLoad %6 %131
|
||||
%133 = OpConvertSToF %10 %132
|
||||
%134 = OpCompositeConstruct %114 %133 %133 %133 %133
|
||||
OpStore %116 %134
|
||||
OpBranch %113
|
||||
%113 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 0.0 3.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 2 3
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 256 256
|
||||
BIND BUFFER variant_framebuffer AS color LOCATION 0
|
||||
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 256 256
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
|
||||
Reference in New Issue
Block a user