yes
This commit is contained in:
@@ -0,0 +1,261 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2020 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 NIR 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_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_10 _GLF_uniform_int_values[1]
|
||||
# #define _int_1 _GLF_uniform_int_values[2]
|
||||
# #define _int_6 _GLF_uniform_int_values[3]
|
||||
# #define _int_20 _GLF_uniform_int_values[4]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 10, 1, 6, 20]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[5];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = _int_0;
|
||||
# int b = _int_1;
|
||||
# int c = 1;
|
||||
#
|
||||
# while (b < _int_20 && a < 10)
|
||||
# {
|
||||
# if (c > 5)
|
||||
# break;
|
||||
#
|
||||
# a++;
|
||||
# c++;
|
||||
# b++;
|
||||
# }
|
||||
#
|
||||
# for(; a < _int_10; a++)
|
||||
# {
|
||||
# }
|
||||
#
|
||||
# if(a == _int_10 && b == _int_6 && c == _int_6)
|
||||
# {
|
||||
# _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: 106
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %87
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %12 "buf0"
|
||||
OpMemberName %12 0 "_GLF_uniform_int_values"
|
||||
OpName %14 ""
|
||||
OpName %19 "b"
|
||||
OpName %23 "c"
|
||||
OpName %87 "_GLF_color"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %87 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 5
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpTypePointer Uniform %6
|
||||
%20 = OpConstant %6 2
|
||||
%24 = OpConstant %6 1
|
||||
%31 = OpConstant %6 4
|
||||
%34 = OpTypeBool
|
||||
%37 = OpConstant %6 10
|
||||
%41 = OpConstant %6 5
|
||||
%70 = OpConstant %6 3
|
||||
%84 = OpTypeFloat 32
|
||||
%85 = OpTypeVector %84 4
|
||||
%86 = OpTypePointer Output %85
|
||||
%87 = OpVariable %86 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%19 = OpVariable %7 Function
|
||||
%23 = OpVariable %7 Function
|
||||
%17 = OpAccessChain %16 %14 %15 %15
|
||||
%18 = OpLoad %6 %17
|
||||
OpStore %8 %18
|
||||
%21 = OpAccessChain %16 %14 %15 %20
|
||||
%22 = OpLoad %6 %21
|
||||
OpStore %19 %22
|
||||
OpStore %23 %24
|
||||
OpBranch %25
|
||||
%25 = OpLabel
|
||||
OpLoopMerge %27 %28 None
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
%30 = OpLoad %6 %19
|
||||
%32 = OpAccessChain %16 %14 %15 %31
|
||||
%33 = OpLoad %6 %32
|
||||
%35 = OpSLessThan %34 %30 %33
|
||||
%36 = OpLoad %6 %8
|
||||
%38 = OpSLessThan %34 %36 %37
|
||||
%39 = OpLogicalAnd %34 %35 %38
|
||||
OpBranchConditional %39 %26 %27
|
||||
%26 = OpLabel
|
||||
%40 = OpLoad %6 %23
|
||||
%42 = OpSGreaterThan %34 %40 %41
|
||||
OpSelectionMerge %44 None
|
||||
OpBranchConditional %42 %43 %44
|
||||
%43 = OpLabel
|
||||
OpBranch %27
|
||||
%44 = OpLabel
|
||||
%46 = OpLoad %6 %8
|
||||
%47 = OpIAdd %6 %46 %24
|
||||
OpStore %8 %47
|
||||
%48 = OpLoad %6 %23
|
||||
%49 = OpIAdd %6 %48 %24
|
||||
OpStore %23 %49
|
||||
%50 = OpLoad %6 %19
|
||||
%51 = OpIAdd %6 %50 %24
|
||||
OpStore %19 %51
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
OpBranch %25
|
||||
%27 = OpLabel
|
||||
OpBranch %52
|
||||
%52 = OpLabel
|
||||
OpLoopMerge %54 %55 None
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
%57 = OpLoad %6 %8
|
||||
%58 = OpAccessChain %16 %14 %15 %24
|
||||
%59 = OpLoad %6 %58
|
||||
%60 = OpSLessThan %34 %57 %59
|
||||
OpBranchConditional %60 %53 %54
|
||||
%53 = OpLabel
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
%61 = OpLoad %6 %8
|
||||
%62 = OpIAdd %6 %61 %24
|
||||
OpStore %8 %62
|
||||
OpBranch %52
|
||||
%54 = OpLabel
|
||||
%63 = OpLoad %6 %8
|
||||
%64 = OpAccessChain %16 %14 %15 %24
|
||||
%65 = OpLoad %6 %64
|
||||
%66 = OpIEqual %34 %63 %65
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %66 %67 %68
|
||||
%67 = OpLabel
|
||||
%69 = OpLoad %6 %19
|
||||
%71 = OpAccessChain %16 %14 %15 %70
|
||||
%72 = OpLoad %6 %71
|
||||
%73 = OpIEqual %34 %69 %72
|
||||
OpBranch %68
|
||||
%68 = OpLabel
|
||||
%74 = OpPhi %34 %66 %54 %73 %67
|
||||
OpSelectionMerge %76 None
|
||||
OpBranchConditional %74 %75 %76
|
||||
%75 = OpLabel
|
||||
%77 = OpLoad %6 %23
|
||||
%78 = OpAccessChain %16 %14 %15 %70
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpIEqual %34 %77 %79
|
||||
OpBranch %76
|
||||
%76 = OpLabel
|
||||
%81 = OpPhi %34 %74 %68 %80 %75
|
||||
OpSelectionMerge %83 None
|
||||
OpBranchConditional %81 %82 %101
|
||||
%82 = OpLabel
|
||||
%88 = OpAccessChain %16 %14 %15 %20
|
||||
%89 = OpLoad %6 %88
|
||||
%90 = OpConvertSToF %84 %89
|
||||
%91 = OpAccessChain %16 %14 %15 %15
|
||||
%92 = OpLoad %6 %91
|
||||
%93 = OpConvertSToF %84 %92
|
||||
%94 = OpAccessChain %16 %14 %15 %15
|
||||
%95 = OpLoad %6 %94
|
||||
%96 = OpConvertSToF %84 %95
|
||||
%97 = OpAccessChain %16 %14 %15 %20
|
||||
%98 = OpLoad %6 %97
|
||||
%99 = OpConvertSToF %84 %98
|
||||
%100 = OpCompositeConstruct %85 %90 %93 %96 %99
|
||||
OpStore %87 %100
|
||||
OpBranch %83
|
||||
%101 = OpLabel
|
||||
%102 = OpAccessChain %16 %14 %15 %15
|
||||
%103 = OpLoad %6 %102
|
||||
%104 = OpConvertSToF %84 %103
|
||||
%105 = OpCompositeConstruct %85 %104 %104 %104 %104
|
||||
OpStore %87 %105
|
||||
OpBranch %83
|
||||
%83 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 10 1 6 20
|
||||
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_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