yes
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A shader that accesses a new vector within an if condition
|
||||
|
||||
# The test passes because the shader always writes the color red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int x = 0;
|
||||
#
|
||||
# if (vec4(1.0)[clamp(x, 0, 3)] >= 1.0)
|
||||
# {
|
||||
# }
|
||||
#
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %23
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "x"
|
||||
OpName %23 "_GLF_color"
|
||||
OpDecorate %8 RelaxedPrecision
|
||||
OpDecorate %14 RelaxedPrecision
|
||||
OpDecorate %16 RelaxedPrecision
|
||||
OpDecorate %23 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 0
|
||||
%10 = OpTypeFloat 32
|
||||
%11 = OpTypeVector %10 4
|
||||
%12 = OpConstant %10 1
|
||||
%13 = OpConstantComposite %11 %12 %12 %12 %12
|
||||
%15 = OpConstant %6 3
|
||||
%18 = OpTypeBool
|
||||
%22 = OpTypePointer Output %11
|
||||
%23 = OpVariable %22 Output
|
||||
%24 = OpConstant %10 0
|
||||
%25 = OpConstantComposite %11 %12 %24 %24 %12
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%14 = OpLoad %6 %8
|
||||
%16 = OpExtInst %6 %1 SClamp %14 %9 %15
|
||||
%17 = OpVectorExtractDynamic %10 %13 %16
|
||||
%19 = OpFOrdGreaterThanEqual %18 %17 %12
|
||||
OpSelectionMerge %21 None
|
||||
OpBranchConditional %19 %20 %21
|
||||
%20 = OpLabel
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpStore %23 %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,384 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with an always discarding main function
|
||||
|
||||
# The test passes because: the framebuffer is cleared to black,
|
||||
# the fragment shader always discards,
|
||||
# and we check that the framebuffer is still black.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--private-to-local'
|
||||
# '--reduce-load-size'
|
||||
# '--eliminate-dead-code-aggressive'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--private-to-local'
|
||||
# '--combine-access-chains'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--scalar-replacement=100'
|
||||
# '--if-conversion'
|
||||
# '--combine-access-chains'
|
||||
# '--vector-dce'
|
||||
# '--vector-dce'
|
||||
# '--combine-access-chains'
|
||||
# '--reduce-load-size'
|
||||
# '--redundancy-elimination'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--vector-dce'
|
||||
# '--vector-dce'
|
||||
# spirv-opt commit hash: e82a428605f6ce0a07337b36f8ba3935c9f165ac
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# struct tmp_struct
|
||||
# {
|
||||
# int nmb[1];
|
||||
# };
|
||||
#
|
||||
# int binarySearch(tmp_struct obj)
|
||||
# {
|
||||
# int one = 1;
|
||||
#
|
||||
# while (one > 10)
|
||||
# {
|
||||
# int zero = one - 1;
|
||||
#
|
||||
# if (obj.nmb[zero] == 1)
|
||||
# return 1;
|
||||
#
|
||||
# one = zero;
|
||||
# }
|
||||
#
|
||||
# return -1;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# tmp_struct obj;
|
||||
# float tmp_float = injectionSwitch.y;
|
||||
# vec3 color = vec3(tmp_float);
|
||||
#
|
||||
# if (binarySearch(obj) == -1) // Always true
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
# color.yz += vec2(1.0);
|
||||
# if (injectionSwitch.x > 1.0)
|
||||
# {
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
# _GLF_color = vec4(color, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 159
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %69
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "tmp_struct"
|
||||
OpMemberName %10 0 "nmb"
|
||||
OpName %14 "binarySearch(struct-tmp_struct-i1[1]1;"
|
||||
OpName %13 "obj"
|
||||
OpName %17 "one"
|
||||
OpName %28 "zero"
|
||||
OpName %45 "tmp_float"
|
||||
OpName %47 "buf0"
|
||||
OpMemberName %47 0 "injectionSwitch"
|
||||
OpName %49 ""
|
||||
OpName %55 "color"
|
||||
OpName %69 "_GLF_color"
|
||||
OpMemberDecorate %10 0 RelaxedPrecision
|
||||
OpDecorate %14 RelaxedPrecision
|
||||
OpDecorate %17 RelaxedPrecision
|
||||
OpDecorate %28 RelaxedPrecision
|
||||
OpDecorate %30 RelaxedPrecision
|
||||
OpDecorate %34 RelaxedPrecision
|
||||
OpMemberDecorate %47 0 Offset 0
|
||||
OpDecorate %47 Block
|
||||
OpDecorate %49 DescriptorSet 0
|
||||
OpDecorate %49 Binding 0
|
||||
OpDecorate %69 Location 0
|
||||
OpDecorate %92 RelaxedPrecision
|
||||
OpDecorate %102 RelaxedPrecision
|
||||
OpDecorate %111 RelaxedPrecision
|
||||
OpDecorate %112 RelaxedPrecision
|
||||
OpDecorate %113 RelaxedPrecision
|
||||
OpDecorate %114 RelaxedPrecision
|
||||
OpDecorate %122 RelaxedPrecision
|
||||
OpDecorate %120 RelaxedPrecision
|
||||
OpDecorate %128 RelaxedPrecision
|
||||
OpDecorate %137 RelaxedPrecision
|
||||
OpDecorate %144 RelaxedPrecision
|
||||
OpDecorate %143 RelaxedPrecision
|
||||
OpDecorate %154 RelaxedPrecision
|
||||
OpDecorate %153 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 1
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypeStruct %9
|
||||
%11 = OpTypePointer Function %10
|
||||
%12 = OpTypeFunction %6 %11
|
||||
%16 = OpTypePointer Function %6
|
||||
%18 = OpConstant %6 1
|
||||
%25 = OpConstant %6 10
|
||||
%26 = OpTypeBool
|
||||
%31 = OpConstant %6 0
|
||||
%40 = OpConstant %6 -1
|
||||
%43 = OpTypeFloat 32
|
||||
%44 = OpTypePointer Function %43
|
||||
%46 = OpTypeVector %43 2
|
||||
%47 = OpTypeStruct %46
|
||||
%48 = OpTypePointer Uniform %47
|
||||
%49 = OpVariable %48 Uniform
|
||||
%50 = OpTypePointer Uniform %43
|
||||
%53 = OpTypeVector %43 3
|
||||
%54 = OpTypePointer Function %53
|
||||
%67 = OpTypeVector %43 4
|
||||
%68 = OpTypePointer Output %67
|
||||
%69 = OpVariable %68 Output
|
||||
%70 = OpConstant %43 0
|
||||
%71 = OpConstantComposite %67 %70 %70 %70 %70
|
||||
%72 = OpConstant %43 1
|
||||
%73 = OpConstantComposite %46 %72 %72
|
||||
%79 = OpConstant %7 0
|
||||
%91 = OpUndef %10
|
||||
%97 = OpConstantFalse %26
|
||||
%98 = OpTypePointer Function %26
|
||||
%100 = OpConstantTrue %26
|
||||
%135 = OpConstantNull %9
|
||||
%136 = OpTypePointer Function %9
|
||||
%148 = OpUndef %6
|
||||
%149 = OpUndef %26
|
||||
%157 = OpUndef %6
|
||||
%158 = OpUndef %26
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%137 = OpVariable %136 Function
|
||||
%110 = OpVariable %98 Function %97
|
||||
%111 = OpVariable %16 Function
|
||||
%112 = OpVariable %16 Function
|
||||
%113 = OpVariable %16 Function
|
||||
%114 = OpVariable %16 Function
|
||||
%99 = OpVariable %98 Function %97
|
||||
%45 = OpVariable %44 Function
|
||||
%55 = OpVariable %54 Function
|
||||
OpBranch %94
|
||||
%94 = OpLabel
|
||||
OpLoopMerge %93 %96 None
|
||||
OpBranch %95
|
||||
%95 = OpLabel
|
||||
%51 = OpAccessChain %50 %49 %31 %8
|
||||
%52 = OpLoad %43 %51
|
||||
OpStore %45 %52
|
||||
%57 = OpCompositeConstruct %53 %52 %52 %52
|
||||
OpStore %55 %57
|
||||
%138 = OpCompositeExtract %9 %91 0
|
||||
OpStore %137 %138
|
||||
OpStore %110 %97
|
||||
OpBranch %115
|
||||
%115 = OpLabel
|
||||
%142 = OpPhi %26 %97 %95 %149 %117
|
||||
OpLoopMerge %116 %117 None
|
||||
OpBranch %118
|
||||
%118 = OpLabel
|
||||
OpStore %112 %18
|
||||
OpBranch %119
|
||||
%119 = OpLabel
|
||||
%122 = OpPhi %6 %18 %118 %120 %121
|
||||
OpLoopMerge %123 %121 None
|
||||
OpBranch %124
|
||||
%124 = OpLabel
|
||||
%125 = OpSGreaterThan %26 %122 %25
|
||||
OpBranchConditional %125 %126 %123
|
||||
%126 = OpLabel
|
||||
%120 = OpISub %6 %122 %18
|
||||
OpStore %113 %120
|
||||
%139 = OpAccessChain %16 %137 %120
|
||||
%128 = OpLoad %6 %139
|
||||
%129 = OpIEqual %26 %128 %18
|
||||
OpSelectionMerge %130 None
|
||||
OpBranchConditional %129 %131 %130
|
||||
%131 = OpLabel
|
||||
OpStore %110 %100
|
||||
OpStore %111 %18
|
||||
OpBranch %123
|
||||
%130 = OpLabel
|
||||
OpStore %112 %120
|
||||
OpBranch %121
|
||||
%121 = OpLabel
|
||||
OpBranch %119
|
||||
%123 = OpLabel
|
||||
%144 = OpPhi %6 %148 %124 %18 %131
|
||||
%140 = OpPhi %26 %142 %124 %100 %131
|
||||
OpSelectionMerge %133 None
|
||||
OpBranchConditional %140 %116 %133
|
||||
%133 = OpLabel
|
||||
OpStore %110 %100
|
||||
OpStore %111 %40
|
||||
OpBranch %116
|
||||
%117 = OpLabel
|
||||
OpBranch %115
|
||||
%116 = OpLabel
|
||||
%143 = OpPhi %6 %144 %123 %40 %133
|
||||
OpStore %114 %143
|
||||
%62 = OpIEqual %26 %143 %40
|
||||
OpSelectionMerge %64 None
|
||||
OpBranchConditional %62 %63 %66
|
||||
%63 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%66 = OpLabel
|
||||
OpStore %69 %71
|
||||
%75 = OpVectorShuffle %46 %57 %57 1 2
|
||||
%76 = OpFAdd %46 %75 %73
|
||||
%78 = OpVectorShuffle %53 %57 %76 0 3 4
|
||||
OpStore %55 %78
|
||||
%80 = OpAccessChain %50 %49 %31 %79
|
||||
%81 = OpLoad %43 %80
|
||||
%82 = OpFOrdGreaterThan %26 %81 %72
|
||||
OpSelectionMerge %84 None
|
||||
OpBranchConditional %82 %83 %84
|
||||
%83 = OpLabel
|
||||
OpStore %99 %100
|
||||
OpBranch %93
|
||||
%84 = OpLabel
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
%87 = OpCompositeExtract %43 %78 0
|
||||
%88 = OpCompositeExtract %43 %78 1
|
||||
%89 = OpCompositeExtract %43 %78 2
|
||||
%90 = OpCompositeConstruct %67 %87 %88 %89 %72
|
||||
OpStore %69 %90
|
||||
OpStore %99 %100
|
||||
OpBranch %93
|
||||
%96 = OpLabel
|
||||
OpBranch %94
|
||||
%93 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%14 = OpFunction %6 None %12
|
||||
%13 = OpFunctionParameter %11
|
||||
%15 = OpLabel
|
||||
%107 = OpVariable %98 Function %97
|
||||
%102 = OpVariable %16 Function
|
||||
%17 = OpVariable %16 Function
|
||||
%28 = OpVariable %16 Function
|
||||
OpBranch %104
|
||||
%104 = OpLabel
|
||||
%152 = OpPhi %26 %97 %15 %158 %106
|
||||
OpLoopMerge %101 %106 None
|
||||
OpBranch %105
|
||||
%105 = OpLabel
|
||||
OpStore %17 %18
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
%92 = OpPhi %6 %18 %105 %30 %22
|
||||
OpLoopMerge %21 %22 None
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
%27 = OpSGreaterThan %26 %92 %25
|
||||
OpBranchConditional %27 %20 %21
|
||||
%20 = OpLabel
|
||||
%30 = OpISub %6 %92 %18
|
||||
OpStore %28 %30
|
||||
%33 = OpAccessChain %16 %13 %31 %30
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpIEqual %26 %34 %18
|
||||
OpSelectionMerge %37 None
|
||||
OpBranchConditional %35 %36 %37
|
||||
%36 = OpLabel
|
||||
OpStore %107 %100
|
||||
OpStore %102 %18
|
||||
OpBranch %21
|
||||
%37 = OpLabel
|
||||
OpStore %17 %30
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
OpBranch %19
|
||||
%21 = OpLabel
|
||||
%154 = OpPhi %6 %157 %23 %18 %36
|
||||
%150 = OpPhi %26 %152 %23 %100 %36
|
||||
OpSelectionMerge %108 None
|
||||
OpBranchConditional %150 %101 %108
|
||||
%108 = OpLabel
|
||||
OpStore %107 %100
|
||||
OpStore %102 %40
|
||||
OpBranch %101
|
||||
%106 = OpLabel
|
||||
OpBranch %104
|
||||
%101 = OpLabel
|
||||
%153 = OpPhi %6 %154 %21 %40 %108
|
||||
OpReturnValue %153
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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 0 0 0 255
|
||||
@@ -0,0 +1,206 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with an always false if.
|
||||
|
||||
# The test passes because the shader always writes color red.
|
||||
# Function brick() writes red in the beginning and returns in the end.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--scalar-replacement=100'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# '--eliminate-dead-code-aggressive'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--convert-local-access-chains'
|
||||
# '--scalar-replacement=100'
|
||||
# '--reduce-load-size'
|
||||
# '--scalar-replacement=100'
|
||||
# '--redundancy-elimination'
|
||||
# '--convert-local-access-chains'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--vector-dce'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--private-to-local'
|
||||
# '--copy-propagate-arrays'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--redundancy-elimination'
|
||||
# '--vector-dce'
|
||||
# '--scalar-replacement=100'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--scalar-replacement=100'
|
||||
# '--redundancy-elimination'
|
||||
# '--redundancy-elimination'
|
||||
# '--copy-propagate-arrays'
|
||||
# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# vec2 brick(vec2 uv)
|
||||
# {
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red
|
||||
#
|
||||
# int a;
|
||||
# do
|
||||
# {
|
||||
# if (injectionSwitch.y < 0.0) // Always false
|
||||
# {
|
||||
# return vec2(1.0);
|
||||
# }
|
||||
# uv.y -= 1.0;
|
||||
# } while (false);
|
||||
#
|
||||
# uv.y -= 1.0;
|
||||
# return vec2(1.0);
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# brick(vec2(1.0));
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 54
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %15
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "brick(vf2;"
|
||||
OpName %10 "uv"
|
||||
OpName %15 "_GLF_color"
|
||||
OpName %23 "buf0"
|
||||
OpMemberName %23 0 "injectionSwitch"
|
||||
OpName %25 ""
|
||||
OpName %51 "param"
|
||||
OpDecorate %15 Location 0
|
||||
OpMemberDecorate %23 0 Offset 0
|
||||
OpDecorate %23 Block
|
||||
OpDecorate %25 DescriptorSet 0
|
||||
OpDecorate %25 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%9 = OpTypeFunction %7 %8
|
||||
%13 = OpTypeVector %6 4
|
||||
%14 = OpTypePointer Output %13
|
||||
%15 = OpVariable %14 Output
|
||||
%16 = OpConstant %6 1
|
||||
%17 = OpConstant %6 0
|
||||
%18 = OpConstantComposite %13 %16 %17 %17 %16
|
||||
%23 = OpTypeStruct %7
|
||||
%24 = OpTypePointer Uniform %23
|
||||
%25 = OpVariable %24 Uniform
|
||||
%26 = OpTypeInt 32 1
|
||||
%27 = OpConstant %26 0
|
||||
%28 = OpTypeInt 32 0
|
||||
%29 = OpConstant %28 1
|
||||
%30 = OpTypePointer Uniform %6
|
||||
%33 = OpTypeBool
|
||||
%37 = OpConstantComposite %7 %16 %16
|
||||
%39 = OpTypePointer Function %6
|
||||
%44 = OpConstantFalse %33
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%51 = OpVariable %8 Function
|
||||
OpStore %51 %37
|
||||
%52 = OpFunctionCall %7 %11 %51
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %7 None %9
|
||||
%10 = OpFunctionParameter %8
|
||||
%12 = OpLabel
|
||||
OpStore %15 %18
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %21 %36 None
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%31 = OpAccessChain %30 %25 %27 %29
|
||||
%32 = OpLoad %6 %31
|
||||
%34 = OpFOrdLessThan %33 %32 %17
|
||||
OpSelectionMerge %53 None
|
||||
OpBranchConditional %34 %35 %36
|
||||
%35 = OpLabel
|
||||
OpReturnValue %37
|
||||
%53 = OpLabel
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%40 = OpAccessChain %39 %10 %29
|
||||
%41 = OpLoad %6 %40
|
||||
%42 = OpFSub %6 %41 %16
|
||||
OpStore %40 %42
|
||||
OpBranchConditional %44 %19 %21
|
||||
%21 = OpLabel
|
||||
%46 = OpLoad %6 %40
|
||||
%47 = OpFSub %6 %46 %16
|
||||
OpStore %40 %47
|
||||
OpReturnValue %37
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,154 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with discard keyword and a return
|
||||
|
||||
# The test passes because main always writes the color red; the discard statement is unreachable.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# vec3 drawShape()
|
||||
# {
|
||||
# discard;
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# vec3 computePoint()
|
||||
# {
|
||||
# drawShape();
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# if (injectionSwitch.x > injectionSwitch.y) // always false
|
||||
# {
|
||||
# drawShape();
|
||||
# computePoint();
|
||||
# }
|
||||
#
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %43
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "drawShape("
|
||||
OpName %11 "computePoint("
|
||||
OpName %22 "buf0"
|
||||
OpMemberName %22 0 "injectionSwitch"
|
||||
OpName %24 ""
|
||||
OpName %43 "_GLF_color"
|
||||
OpMemberDecorate %22 0 Offset 0
|
||||
OpDecorate %22 Block
|
||||
OpDecorate %24 DescriptorSet 0
|
||||
OpDecorate %24 Binding 0
|
||||
OpDecorate %43 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 3
|
||||
%8 = OpTypeFunction %7
|
||||
%14 = OpConstant %6 1
|
||||
%15 = OpConstantComposite %7 %14 %14 %14
|
||||
%21 = OpTypeVector %6 2
|
||||
%22 = OpTypeStruct %21
|
||||
%23 = OpTypePointer Uniform %22
|
||||
%24 = OpVariable %23 Uniform
|
||||
%25 = OpTypeInt 32 1
|
||||
%26 = OpConstant %25 0
|
||||
%27 = OpTypeInt 32 0
|
||||
%28 = OpConstant %27 0
|
||||
%29 = OpTypePointer Uniform %6
|
||||
%32 = OpConstant %27 1
|
||||
%35 = OpTypeBool
|
||||
%41 = OpTypeVector %6 4
|
||||
%42 = OpTypePointer Output %41
|
||||
%43 = OpVariable %42 Output
|
||||
%44 = OpConstant %6 0
|
||||
%45 = OpConstantComposite %41 %14 %44 %44 %14
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%30 = OpAccessChain %29 %24 %26 %28
|
||||
%31 = OpLoad %6 %30
|
||||
%33 = OpAccessChain %29 %24 %26 %32
|
||||
%34 = OpLoad %6 %33
|
||||
%36 = OpFOrdGreaterThan %35 %31 %34
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %36 %37 %38
|
||||
%37 = OpLabel
|
||||
%39 = OpFunctionCall %7 %9
|
||||
%40 = OpFunctionCall %7 %11
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpStore %43 %45
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%9 = OpFunction %7 None %8
|
||||
%10 = OpLabel
|
||||
OpTerminateInvocation
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %7 None %8
|
||||
%12 = OpLabel
|
||||
%18 = OpFunctionCall %7 %9
|
||||
OpReturnValue %15
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,436 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with an arr value set to itself squared
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# struct QuicksortObject {
|
||||
# int numbers[10];
|
||||
# } ;
|
||||
#
|
||||
# QuicksortObject obj;
|
||||
#
|
||||
# void swap(int i, int j)
|
||||
# {
|
||||
# int temp = obj.numbers[i];
|
||||
# obj.numbers[i] = obj.numbers[j];
|
||||
# obj.numbers[j] = temp;
|
||||
# }
|
||||
# int performPartition(int l, int h)
|
||||
# {
|
||||
# int pivot = obj.numbers[h];
|
||||
# int i = (l - 1);
|
||||
# for(
|
||||
# int j = l;
|
||||
# j <= h - 1;
|
||||
# j ++
|
||||
# )
|
||||
# {
|
||||
# if(obj.numbers[j] <= pivot)
|
||||
# {
|
||||
# i ++;
|
||||
# swap(i, j);
|
||||
# }
|
||||
# }
|
||||
# swap(i + 1, h);
|
||||
# return (i + 1);
|
||||
# }
|
||||
# void quicksort()
|
||||
# {
|
||||
# int l = 0, h = 9;
|
||||
# int stack[10];
|
||||
# int top = - 1;
|
||||
# stack[++ top] = l;
|
||||
# stack[++ top] = h;
|
||||
# while(top >= 0)
|
||||
# {
|
||||
# h = stack[top --];
|
||||
# l = stack[top --];
|
||||
# int p = performPartition(l, h);
|
||||
# if(p - 1 > l)
|
||||
# {
|
||||
# stack[++ top] = l;
|
||||
# stack[++ top] = p - 1;
|
||||
# }
|
||||
# if(p + 1 < h)
|
||||
# {
|
||||
# stack[++ top] = p + 1;
|
||||
# stack[++ top] = h;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# for(
|
||||
# int i = 0;
|
||||
# i < 10;
|
||||
# i ++
|
||||
# )
|
||||
# {
|
||||
# obj.numbers[i] = (10 - i);
|
||||
# obj.numbers[i] = obj.numbers[i] * obj.numbers[i];
|
||||
# }
|
||||
# quicksort();
|
||||
#
|
||||
# if (obj.numbers[0] < obj.numbers[4])
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# else
|
||||
# _GLF_color = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
#
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 198
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %188
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "swap(i1;i1;"
|
||||
OpName %9 "i"
|
||||
OpName %10 "j"
|
||||
OpName %16 "performPartition(i1;i1;"
|
||||
OpName %14 "l"
|
||||
OpName %15 "h"
|
||||
OpName %18 "quicksort("
|
||||
OpName %20 "temp"
|
||||
OpName %24 "QuicksortObject"
|
||||
OpMemberName %24 0 "numbers"
|
||||
OpName %26 "obj"
|
||||
OpName %40 "pivot"
|
||||
OpName %44 "i"
|
||||
OpName %48 "j"
|
||||
OpName %69 "param"
|
||||
OpName %71 "param"
|
||||
OpName %78 "param"
|
||||
OpName %79 "param"
|
||||
OpName %86 "l"
|
||||
OpName %87 "h"
|
||||
OpName %89 "top"
|
||||
OpName %92 "stack"
|
||||
OpName %116 "p"
|
||||
OpName %117 "param"
|
||||
OpName %119 "param"
|
||||
OpName %152 "i"
|
||||
OpName %188 "_GLF_color"
|
||||
OpDecorate %188 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%8 = OpTypeFunction %2 %7 %7
|
||||
%13 = OpTypeFunction %6 %7 %7
|
||||
%21 = OpTypeInt 32 0
|
||||
%22 = OpConstant %21 10
|
||||
%23 = OpTypeArray %6 %22
|
||||
%24 = OpTypeStruct %23
|
||||
%25 = OpTypePointer Private %24
|
||||
%26 = OpVariable %25 Private
|
||||
%27 = OpConstant %6 0
|
||||
%29 = OpTypePointer Private %6
|
||||
%46 = OpConstant %6 1
|
||||
%58 = OpTypeBool
|
||||
%88 = OpConstant %6 9
|
||||
%90 = OpConstant %6 -1
|
||||
%91 = OpTypePointer Function %23
|
||||
%159 = OpConstant %6 10
|
||||
%179 = OpConstant %6 4
|
||||
%185 = OpTypeFloat 32
|
||||
%186 = OpTypeVector %185 4
|
||||
%187 = OpTypePointer Output %186
|
||||
%188 = OpVariable %187 Output
|
||||
%189 = OpConstant %185 1
|
||||
%190 = OpConstant %185 0
|
||||
%191 = OpConstantComposite %186 %189 %190 %190 %189
|
||||
%193 = OpConstantComposite %186 %190 %189 %190 %189
|
||||
%194 = OpTypeVector %185 2
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%152 = OpVariable %7 Function
|
||||
OpStore %152 %27
|
||||
OpBranch %153
|
||||
%153 = OpLabel
|
||||
OpLoopMerge %155 %156 None
|
||||
OpBranch %157
|
||||
%157 = OpLabel
|
||||
%158 = OpLoad %6 %152
|
||||
%160 = OpSLessThan %58 %158 %159
|
||||
OpBranchConditional %160 %154 %155
|
||||
%154 = OpLabel
|
||||
%161 = OpLoad %6 %152
|
||||
%162 = OpLoad %6 %152
|
||||
%163 = OpISub %6 %159 %162
|
||||
%164 = OpAccessChain %29 %26 %27 %161
|
||||
OpStore %164 %163
|
||||
%165 = OpLoad %6 %152
|
||||
%166 = OpLoad %6 %152
|
||||
%167 = OpAccessChain %29 %26 %27 %166
|
||||
%168 = OpLoad %6 %167
|
||||
%169 = OpLoad %6 %152
|
||||
%170 = OpAccessChain %29 %26 %27 %169
|
||||
%171 = OpLoad %6 %170
|
||||
%172 = OpIMul %6 %168 %171
|
||||
%173 = OpAccessChain %29 %26 %27 %165
|
||||
OpStore %173 %172
|
||||
OpBranch %156
|
||||
%156 = OpLabel
|
||||
%174 = OpLoad %6 %152
|
||||
%175 = OpIAdd %6 %174 %46
|
||||
OpStore %152 %175
|
||||
OpBranch %153
|
||||
%155 = OpLabel
|
||||
%176 = OpFunctionCall %2 %18
|
||||
%177 = OpAccessChain %29 %26 %27 %27
|
||||
%178 = OpLoad %6 %177
|
||||
%180 = OpAccessChain %29 %26 %27 %179
|
||||
%181 = OpLoad %6 %180
|
||||
%182 = OpSLessThan %58 %178 %181
|
||||
OpSelectionMerge %184 None
|
||||
OpBranchConditional %182 %183 %192
|
||||
%183 = OpLabel
|
||||
OpStore %188 %191
|
||||
OpBranch %184
|
||||
%192 = OpLabel
|
||||
OpStore %188 %193
|
||||
OpBranch %184
|
||||
%184 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %2 None %8
|
||||
%9 = OpFunctionParameter %7
|
||||
%10 = OpFunctionParameter %7
|
||||
%12 = OpLabel
|
||||
%20 = OpVariable %7 Function
|
||||
%28 = OpLoad %6 %9
|
||||
%30 = OpAccessChain %29 %26 %27 %28
|
||||
%31 = OpLoad %6 %30
|
||||
OpStore %20 %31
|
||||
%32 = OpLoad %6 %9
|
||||
%33 = OpLoad %6 %10
|
||||
%34 = OpAccessChain %29 %26 %27 %33
|
||||
%35 = OpLoad %6 %34
|
||||
%36 = OpAccessChain %29 %26 %27 %32
|
||||
OpStore %36 %35
|
||||
%37 = OpLoad %6 %10
|
||||
%38 = OpLoad %6 %20
|
||||
%39 = OpAccessChain %29 %26 %27 %37
|
||||
OpStore %39 %38
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%16 = OpFunction %6 None %13
|
||||
%14 = OpFunctionParameter %7
|
||||
%15 = OpFunctionParameter %7
|
||||
%17 = OpLabel
|
||||
%40 = OpVariable %7 Function
|
||||
%44 = OpVariable %7 Function
|
||||
%48 = OpVariable %7 Function
|
||||
%69 = OpVariable %7 Function
|
||||
%71 = OpVariable %7 Function
|
||||
%78 = OpVariable %7 Function
|
||||
%79 = OpVariable %7 Function
|
||||
%41 = OpLoad %6 %15
|
||||
%42 = OpAccessChain %29 %26 %27 %41
|
||||
%43 = OpLoad %6 %42
|
||||
OpStore %40 %43
|
||||
%45 = OpLoad %6 %14
|
||||
%47 = OpISub %6 %45 %46
|
||||
OpStore %44 %47
|
||||
%49 = OpLoad %6 %14
|
||||
OpStore %48 %49
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
OpLoopMerge %52 %53 None
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%55 = OpLoad %6 %48
|
||||
%56 = OpLoad %6 %15
|
||||
%57 = OpISub %6 %56 %46
|
||||
%59 = OpSLessThanEqual %58 %55 %57
|
||||
OpBranchConditional %59 %51 %52
|
||||
%51 = OpLabel
|
||||
%60 = OpLoad %6 %48
|
||||
%61 = OpAccessChain %29 %26 %27 %60
|
||||
%62 = OpLoad %6 %61
|
||||
%63 = OpLoad %6 %40
|
||||
%64 = OpSLessThanEqual %58 %62 %63
|
||||
OpSelectionMerge %66 None
|
||||
OpBranchConditional %64 %65 %66
|
||||
%65 = OpLabel
|
||||
%67 = OpLoad %6 %44
|
||||
%68 = OpIAdd %6 %67 %46
|
||||
OpStore %44 %68
|
||||
%70 = OpLoad %6 %44
|
||||
OpStore %69 %70
|
||||
%72 = OpLoad %6 %48
|
||||
OpStore %71 %72
|
||||
%73 = OpFunctionCall %2 %11 %69 %71
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
OpBranch %53
|
||||
%53 = OpLabel
|
||||
%74 = OpLoad %6 %48
|
||||
%75 = OpIAdd %6 %74 %46
|
||||
OpStore %48 %75
|
||||
OpBranch %50
|
||||
%52 = OpLabel
|
||||
%76 = OpLoad %6 %44
|
||||
%77 = OpIAdd %6 %76 %46
|
||||
OpStore %78 %77
|
||||
%80 = OpLoad %6 %15
|
||||
OpStore %79 %80
|
||||
%81 = OpFunctionCall %2 %11 %78 %79
|
||||
%82 = OpLoad %6 %44
|
||||
%83 = OpIAdd %6 %82 %46
|
||||
OpReturnValue %83
|
||||
OpFunctionEnd
|
||||
%18 = OpFunction %2 None %3
|
||||
%19 = OpLabel
|
||||
%86 = OpVariable %7 Function
|
||||
%87 = OpVariable %7 Function
|
||||
%89 = OpVariable %7 Function
|
||||
%92 = OpVariable %91 Function
|
||||
%116 = OpVariable %7 Function
|
||||
%117 = OpVariable %7 Function
|
||||
%119 = OpVariable %7 Function
|
||||
OpStore %86 %27
|
||||
OpStore %87 %88
|
||||
OpStore %89 %90
|
||||
%93 = OpLoad %6 %89
|
||||
%94 = OpIAdd %6 %93 %46
|
||||
OpStore %89 %94
|
||||
%95 = OpLoad %6 %86
|
||||
%96 = OpAccessChain %7 %92 %94
|
||||
OpStore %96 %95
|
||||
%97 = OpLoad %6 %89
|
||||
%98 = OpIAdd %6 %97 %46
|
||||
OpStore %89 %98
|
||||
%99 = OpLoad %6 %87
|
||||
%100 = OpAccessChain %7 %92 %98
|
||||
OpStore %100 %99
|
||||
OpBranch %101
|
||||
%101 = OpLabel
|
||||
OpLoopMerge %103 %104 None
|
||||
OpBranch %105
|
||||
%105 = OpLabel
|
||||
%106 = OpLoad %6 %89
|
||||
%107 = OpSGreaterThanEqual %58 %106 %27
|
||||
OpBranchConditional %107 %102 %103
|
||||
%102 = OpLabel
|
||||
%108 = OpLoad %6 %89
|
||||
%109 = OpISub %6 %108 %46
|
||||
OpStore %89 %109
|
||||
%110 = OpAccessChain %7 %92 %108
|
||||
%111 = OpLoad %6 %110
|
||||
OpStore %87 %111
|
||||
%112 = OpLoad %6 %89
|
||||
%113 = OpISub %6 %112 %46
|
||||
OpStore %89 %113
|
||||
%114 = OpAccessChain %7 %92 %112
|
||||
%115 = OpLoad %6 %114
|
||||
OpStore %86 %115
|
||||
%118 = OpLoad %6 %86
|
||||
OpStore %117 %118
|
||||
%120 = OpLoad %6 %87
|
||||
OpStore %119 %120
|
||||
%121 = OpFunctionCall %6 %16 %117 %119
|
||||
OpStore %116 %121
|
||||
%122 = OpLoad %6 %116
|
||||
%123 = OpISub %6 %122 %46
|
||||
%124 = OpLoad %6 %86
|
||||
%125 = OpSGreaterThan %58 %123 %124
|
||||
OpSelectionMerge %127 None
|
||||
OpBranchConditional %125 %126 %127
|
||||
%126 = OpLabel
|
||||
%128 = OpLoad %6 %89
|
||||
%129 = OpIAdd %6 %128 %46
|
||||
OpStore %89 %129
|
||||
%130 = OpLoad %6 %86
|
||||
%131 = OpAccessChain %7 %92 %129
|
||||
OpStore %131 %130
|
||||
%132 = OpLoad %6 %89
|
||||
%133 = OpIAdd %6 %132 %46
|
||||
OpStore %89 %133
|
||||
%134 = OpLoad %6 %116
|
||||
%135 = OpISub %6 %134 %46
|
||||
%136 = OpAccessChain %7 %92 %133
|
||||
OpStore %136 %135
|
||||
OpBranch %127
|
||||
%127 = OpLabel
|
||||
%137 = OpLoad %6 %116
|
||||
%138 = OpIAdd %6 %137 %46
|
||||
%139 = OpLoad %6 %87
|
||||
%140 = OpSLessThan %58 %138 %139
|
||||
OpSelectionMerge %142 None
|
||||
OpBranchConditional %140 %141 %142
|
||||
%141 = OpLabel
|
||||
%143 = OpLoad %6 %89
|
||||
%144 = OpIAdd %6 %143 %46
|
||||
OpStore %89 %144
|
||||
%145 = OpLoad %6 %116
|
||||
%146 = OpIAdd %6 %145 %46
|
||||
%147 = OpAccessChain %7 %92 %144
|
||||
OpStore %147 %146
|
||||
%148 = OpLoad %6 %89
|
||||
%149 = OpIAdd %6 %148 %46
|
||||
OpStore %89 %149
|
||||
%150 = OpLoad %6 %87
|
||||
%151 = OpAccessChain %7 %92 %149
|
||||
OpStore %151 %150
|
||||
OpBranch %142
|
||||
%142 = OpLabel
|
||||
OpBranch %104
|
||||
%104 = OpLabel
|
||||
OpBranch %101
|
||||
%103 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
BIND BUFFER variant_framebuffer AS color LOCATION 0
|
||||
END
|
||||
CLEAR_COLOR variant_pipeline 0 0 0 255
|
||||
|
||||
CLEAR variant_pipeline
|
||||
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,298 @@
|
||||
#!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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with array index multiplied
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# // Function always returns 5.0.
|
||||
# float func()
|
||||
# {
|
||||
# if (gl_FragCoord.x < 1.0)
|
||||
# return 5.0;
|
||||
#
|
||||
# // Always false.
|
||||
# if (injectionSwitch.x > injectionSwitch.y)
|
||||
# return 1.0;
|
||||
#
|
||||
# int x = int(injectionSwitch.x);
|
||||
#
|
||||
# x += int(clamp(injectionSwitch.x, 0.0, 1.0)) * 3;
|
||||
#
|
||||
# return 5.0 + float(x);
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec2 data[17];
|
||||
#
|
||||
# for (int i = 0; i < 4 + int(injectionSwitch.x); i++)
|
||||
# {
|
||||
# // Always true.
|
||||
# if (gl_FragCoord.x >= 0.0)
|
||||
# {
|
||||
# for (int j = 0; j < 4; j++)
|
||||
# {
|
||||
# data[4 * j + i].x = func();
|
||||
#
|
||||
# // Always true.
|
||||
# if (data[0].x == 5.0 || data[15].x == 5.0)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
#
|
||||
# // Always false.
|
||||
# if (injectionSwitch.x > injectionSwitch.y)
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 128
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %12 %111
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "func("
|
||||
OpName %12 "gl_FragCoord"
|
||||
OpName %26 "buf0"
|
||||
OpMemberName %26 0 "injectionSwitch"
|
||||
OpName %28 ""
|
||||
OpName %42 "x"
|
||||
OpName %60 "i"
|
||||
OpName %78 "j"
|
||||
OpName %89 "data"
|
||||
OpName %111 "_GLF_color"
|
||||
OpDecorate %12 BuiltIn FragCoord
|
||||
OpMemberDecorate %26 0 Offset 0
|
||||
OpDecorate %26 Block
|
||||
OpDecorate %28 DescriptorSet 0
|
||||
OpDecorate %28 Binding 0
|
||||
OpDecorate %111 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeFunction %6
|
||||
%10 = OpTypeVector %6 4
|
||||
%11 = OpTypePointer Input %10
|
||||
%12 = OpVariable %11 Input
|
||||
%13 = OpTypeInt 32 0
|
||||
%14 = OpConstant %13 0
|
||||
%15 = OpTypePointer Input %6
|
||||
%18 = OpConstant %6 1
|
||||
%19 = OpTypeBool
|
||||
%23 = OpConstant %6 5
|
||||
%25 = OpTypeVector %6 2
|
||||
%26 = OpTypeStruct %25
|
||||
%27 = OpTypePointer Uniform %26
|
||||
%28 = OpVariable %27 Uniform
|
||||
%29 = OpTypeInt 32 1
|
||||
%30 = OpConstant %29 0
|
||||
%31 = OpTypePointer Uniform %6
|
||||
%34 = OpConstant %13 1
|
||||
%41 = OpTypePointer Function %29
|
||||
%48 = OpConstant %6 0
|
||||
%51 = OpConstant %29 3
|
||||
%67 = OpConstant %29 4
|
||||
%86 = OpConstant %13 17
|
||||
%87 = OpTypeArray %25 %86
|
||||
%88 = OpTypePointer Function %87
|
||||
%95 = OpTypePointer Function %6
|
||||
%103 = OpConstant %29 15
|
||||
%110 = OpTypePointer Output %10
|
||||
%111 = OpVariable %110 Output
|
||||
%112 = OpConstantComposite %10 %18 %48 %48 %18
|
||||
%114 = OpConstantComposite %10 %48 %48 %48 %48
|
||||
%124 = OpConstant %29 1
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%60 = OpVariable %41 Function
|
||||
%78 = OpVariable %41 Function
|
||||
%89 = OpVariable %88 Function
|
||||
OpStore %60 %30
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
OpLoopMerge %63 %64 None
|
||||
OpBranch %65
|
||||
%65 = OpLabel
|
||||
%66 = OpLoad %29 %60
|
||||
%68 = OpAccessChain %31 %28 %30 %14
|
||||
%69 = OpLoad %6 %68
|
||||
%70 = OpConvertFToS %29 %69
|
||||
%71 = OpIAdd %29 %67 %70
|
||||
%72 = OpSLessThan %19 %66 %71
|
||||
OpBranchConditional %72 %62 %63
|
||||
%62 = OpLabel
|
||||
%73 = OpAccessChain %15 %12 %14
|
||||
%74 = OpLoad %6 %73
|
||||
%75 = OpFOrdGreaterThanEqual %19 %74 %48
|
||||
OpSelectionMerge %77 None
|
||||
OpBranchConditional %75 %76 %77
|
||||
%76 = OpLabel
|
||||
OpStore %78 %30
|
||||
OpBranch %79
|
||||
%79 = OpLabel
|
||||
OpLoopMerge %81 %82 None
|
||||
OpBranch %83
|
||||
%83 = OpLabel
|
||||
%84 = OpLoad %29 %78
|
||||
%85 = OpSLessThan %19 %84 %67
|
||||
OpBranchConditional %85 %80 %81
|
||||
%80 = OpLabel
|
||||
%90 = OpLoad %29 %78
|
||||
%91 = OpIMul %29 %67 %90
|
||||
%92 = OpLoad %29 %60
|
||||
%93 = OpIAdd %29 %91 %92
|
||||
%94 = OpFunctionCall %6 %8
|
||||
%96 = OpAccessChain %95 %89 %93 %14
|
||||
OpStore %96 %94
|
||||
%97 = OpAccessChain %95 %89 %30 %14
|
||||
%98 = OpLoad %6 %97
|
||||
%99 = OpFOrdEqual %19 %98 %23
|
||||
%100 = OpLogicalNot %19 %99
|
||||
OpSelectionMerge %102 None
|
||||
OpBranchConditional %100 %101 %102
|
||||
%101 = OpLabel
|
||||
%104 = OpAccessChain %95 %89 %103 %14
|
||||
%105 = OpLoad %6 %104
|
||||
%106 = OpFOrdEqual %19 %105 %23
|
||||
OpBranch %102
|
||||
%102 = OpLabel
|
||||
%107 = OpPhi %19 %99 %80 %106 %101
|
||||
OpSelectionMerge %109 None
|
||||
OpBranchConditional %107 %108 %113
|
||||
%108 = OpLabel
|
||||
OpStore %111 %112
|
||||
OpBranch %109
|
||||
%113 = OpLabel
|
||||
OpStore %111 %114
|
||||
OpBranch %109
|
||||
%109 = OpLabel
|
||||
%115 = OpAccessChain %31 %28 %30 %14
|
||||
%116 = OpLoad %6 %115
|
||||
%117 = OpAccessChain %31 %28 %30 %34
|
||||
%118 = OpLoad %6 %117
|
||||
%119 = OpFOrdGreaterThan %19 %116 %118
|
||||
OpSelectionMerge %121 None
|
||||
OpBranchConditional %119 %120 %121
|
||||
%120 = OpLabel
|
||||
OpReturn
|
||||
%121 = OpLabel
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
%123 = OpLoad %29 %78
|
||||
%125 = OpIAdd %29 %123 %124
|
||||
OpStore %78 %125
|
||||
OpBranch %79
|
||||
%81 = OpLabel
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
%126 = OpLoad %29 %60
|
||||
%127 = OpIAdd %29 %126 %124
|
||||
OpStore %60 %127
|
||||
OpBranch %61
|
||||
%63 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%8 = OpFunction %6 None %7
|
||||
%9 = OpLabel
|
||||
%42 = OpVariable %41 Function
|
||||
%16 = OpAccessChain %15 %12 %14
|
||||
%17 = OpLoad %6 %16
|
||||
%20 = OpFOrdLessThan %19 %17 %18
|
||||
OpSelectionMerge %22 None
|
||||
OpBranchConditional %20 %21 %22
|
||||
%21 = OpLabel
|
||||
OpReturnValue %23
|
||||
%22 = OpLabel
|
||||
%32 = OpAccessChain %31 %28 %30 %14
|
||||
%33 = OpLoad %6 %32
|
||||
%35 = OpAccessChain %31 %28 %30 %34
|
||||
%36 = OpLoad %6 %35
|
||||
%37 = OpFOrdGreaterThan %19 %33 %36
|
||||
OpSelectionMerge %39 None
|
||||
OpBranchConditional %37 %38 %39
|
||||
%38 = OpLabel
|
||||
OpReturnValue %18
|
||||
%39 = OpLabel
|
||||
%43 = OpAccessChain %31 %28 %30 %14
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpConvertFToS %29 %44
|
||||
OpStore %42 %45
|
||||
%46 = OpAccessChain %31 %28 %30 %14
|
||||
%47 = OpLoad %6 %46
|
||||
%49 = OpExtInst %6 %1 FClamp %47 %48 %18
|
||||
%50 = OpConvertFToS %29 %49
|
||||
%52 = OpIMul %29 %50 %51
|
||||
%53 = OpLoad %29 %42
|
||||
%54 = OpIAdd %29 %53 %52
|
||||
OpStore %42 %54
|
||||
%55 = OpLoad %29 %42
|
||||
%56 = OpConvertSToF %6 %55
|
||||
%57 = OpFAdd %6 %23 %56
|
||||
OpReturnValue %57
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,301 @@
|
||||
#!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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that assigns array values to other array
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# int data[9], temp[7];
|
||||
#
|
||||
# // Returns 1.0.
|
||||
# float func(int a)
|
||||
# {
|
||||
# int b = 0;
|
||||
#
|
||||
# data[0] = 5;
|
||||
# data[2] = 0;
|
||||
# data[4] = 0;
|
||||
# data[6] = 0;
|
||||
# data[8] = 0;
|
||||
#
|
||||
# // Always true.
|
||||
# if (gl_FragCoord.x >= 0.0)
|
||||
# {
|
||||
# while (b <= a)
|
||||
# {
|
||||
# if (b <= 5) {
|
||||
# // When b == 0, a value of data[0] is given to
|
||||
# // temp[0], making it's value 5.
|
||||
# temp[b] = data[b];
|
||||
# b += 2;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# for (int i = 0; i < 3; i++)
|
||||
# // On first iteration data[0] value is set to
|
||||
# // temp[0] + 1, which will be: 5 + 1 == 6.
|
||||
# data[i] = temp[0] + 1;
|
||||
#
|
||||
# // Always true.
|
||||
# if (temp[0] == 5 && data[0] == 6)
|
||||
# return 1.0;
|
||||
# else
|
||||
# return 0.0;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# for (int i = 0; i < 6; i++)
|
||||
# {
|
||||
# func(i);
|
||||
#
|
||||
# // Always true.
|
||||
# if(func(i) == 1.0)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 123
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %33 %117
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "func(i1;"
|
||||
OpName %10 "a"
|
||||
OpName %13 "b"
|
||||
OpName %19 "data"
|
||||
OpName %33 "gl_FragCoord"
|
||||
OpName %58 "temp"
|
||||
OpName %66 "i"
|
||||
OpName %99 "i"
|
||||
OpName %107 "param"
|
||||
OpName %110 "param"
|
||||
OpName %117 "_GLF_color"
|
||||
OpDecorate %33 BuiltIn FragCoord
|
||||
OpDecorate %117 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%8 = OpTypeFloat 32
|
||||
%9 = OpTypeFunction %8 %7
|
||||
%14 = OpConstant %6 0
|
||||
%15 = OpTypeInt 32 0
|
||||
%16 = OpConstant %15 9
|
||||
%17 = OpTypeArray %6 %16
|
||||
%18 = OpTypePointer Private %17
|
||||
%19 = OpVariable %18 Private
|
||||
%20 = OpConstant %6 5
|
||||
%21 = OpTypePointer Private %6
|
||||
%23 = OpConstant %6 2
|
||||
%25 = OpConstant %6 4
|
||||
%27 = OpConstant %6 6
|
||||
%29 = OpConstant %6 8
|
||||
%31 = OpTypeVector %8 4
|
||||
%32 = OpTypePointer Input %31
|
||||
%33 = OpVariable %32 Input
|
||||
%34 = OpConstant %15 0
|
||||
%35 = OpTypePointer Input %8
|
||||
%38 = OpConstant %8 0
|
||||
%39 = OpTypeBool
|
||||
%55 = OpConstant %15 7
|
||||
%56 = OpTypeArray %6 %55
|
||||
%57 = OpTypePointer Private %56
|
||||
%58 = OpVariable %57 Private
|
||||
%73 = OpConstant %6 3
|
||||
%78 = OpConstant %6 1
|
||||
%94 = OpConstant %8 1
|
||||
%116 = OpTypePointer Output %31
|
||||
%117 = OpVariable %116 Output
|
||||
%118 = OpConstantComposite %31 %94 %38 %38 %94
|
||||
%120 = OpConstantComposite %31 %38 %38 %38 %38
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%99 = OpVariable %7 Function
|
||||
%107 = OpVariable %7 Function
|
||||
%110 = OpVariable %7 Function
|
||||
OpStore %99 %14
|
||||
OpBranch %100
|
||||
%100 = OpLabel
|
||||
OpLoopMerge %102 %103 None
|
||||
OpBranch %104
|
||||
%104 = OpLabel
|
||||
%105 = OpLoad %6 %99
|
||||
%106 = OpSLessThan %39 %105 %27
|
||||
OpBranchConditional %106 %101 %102
|
||||
%101 = OpLabel
|
||||
%108 = OpLoad %6 %99
|
||||
OpStore %107 %108
|
||||
%109 = OpFunctionCall %8 %11 %107
|
||||
%111 = OpLoad %6 %99
|
||||
OpStore %110 %111
|
||||
%112 = OpFunctionCall %8 %11 %110
|
||||
%113 = OpFOrdEqual %39 %112 %94
|
||||
OpSelectionMerge %115 None
|
||||
OpBranchConditional %113 %114 %119
|
||||
%114 = OpLabel
|
||||
OpStore %117 %118
|
||||
OpBranch %115
|
||||
%119 = OpLabel
|
||||
OpStore %117 %120
|
||||
OpBranch %115
|
||||
%115 = OpLabel
|
||||
OpBranch %103
|
||||
%103 = OpLabel
|
||||
%121 = OpLoad %6 %99
|
||||
%122 = OpIAdd %6 %121 %78
|
||||
OpStore %99 %122
|
||||
OpBranch %100
|
||||
%102 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %8 None %9
|
||||
%10 = OpFunctionParameter %7
|
||||
%12 = OpLabel
|
||||
%13 = OpVariable %7 Function
|
||||
%66 = OpVariable %7 Function
|
||||
OpStore %13 %14
|
||||
%22 = OpAccessChain %21 %19 %14
|
||||
OpStore %22 %20
|
||||
%24 = OpAccessChain %21 %19 %23
|
||||
OpStore %24 %14
|
||||
%26 = OpAccessChain %21 %19 %25
|
||||
OpStore %26 %14
|
||||
%28 = OpAccessChain %21 %19 %27
|
||||
OpStore %28 %14
|
||||
%30 = OpAccessChain %21 %19 %29
|
||||
OpStore %30 %14
|
||||
%36 = OpAccessChain %35 %33 %34
|
||||
%37 = OpLoad %8 %36
|
||||
%40 = OpFOrdGreaterThanEqual %39 %37 %38
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %40 %41 %42
|
||||
%41 = OpLabel
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
OpLoopMerge %45 %46 None
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%48 = OpLoad %6 %13
|
||||
%49 = OpLoad %6 %10
|
||||
%50 = OpSLessThanEqual %39 %48 %49
|
||||
OpBranchConditional %50 %44 %45
|
||||
%44 = OpLabel
|
||||
%51 = OpLoad %6 %13
|
||||
%52 = OpSLessThanEqual %39 %51 %20
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %52 %53 %54
|
||||
%53 = OpLabel
|
||||
%59 = OpLoad %6 %13
|
||||
%60 = OpLoad %6 %13
|
||||
%61 = OpAccessChain %21 %19 %60
|
||||
%62 = OpLoad %6 %61
|
||||
%63 = OpAccessChain %21 %58 %59
|
||||
OpStore %63 %62
|
||||
%64 = OpLoad %6 %13
|
||||
%65 = OpIAdd %6 %64 %23
|
||||
OpStore %13 %65
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
OpBranch %43
|
||||
%45 = OpLabel
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
OpStore %66 %14
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
OpLoopMerge %69 %70 None
|
||||
OpBranch %71
|
||||
%71 = OpLabel
|
||||
%72 = OpLoad %6 %66
|
||||
%74 = OpSLessThan %39 %72 %73
|
||||
OpBranchConditional %74 %68 %69
|
||||
%68 = OpLabel
|
||||
%75 = OpLoad %6 %66
|
||||
%76 = OpAccessChain %21 %58 %14
|
||||
%77 = OpLoad %6 %76
|
||||
%79 = OpIAdd %6 %77 %78
|
||||
%80 = OpAccessChain %21 %19 %75
|
||||
OpStore %80 %79
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
%81 = OpLoad %6 %66
|
||||
%82 = OpIAdd %6 %81 %78
|
||||
OpStore %66 %82
|
||||
OpBranch %67
|
||||
%69 = OpLabel
|
||||
%83 = OpAccessChain %21 %58 %14
|
||||
%84 = OpLoad %6 %83
|
||||
%85 = OpIEqual %39 %84 %20
|
||||
OpSelectionMerge %87 None
|
||||
OpBranchConditional %85 %86 %87
|
||||
%86 = OpLabel
|
||||
%88 = OpAccessChain %21 %19 %14
|
||||
%89 = OpLoad %6 %88
|
||||
%90 = OpIEqual %39 %89 %27
|
||||
OpBranch %87
|
||||
%87 = OpLabel
|
||||
%91 = OpPhi %39 %85 %69 %90 %86
|
||||
OpSelectionMerge %93 None
|
||||
OpBranchConditional %91 %92 %96
|
||||
%92 = OpLabel
|
||||
OpReturnValue %94
|
||||
%96 = OpLabel
|
||||
OpReturnValue %38
|
||||
%93 = OpLabel
|
||||
OpUnreachable
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,248 @@
|
||||
#!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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that assigns array values to other array
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void func(int x)
|
||||
# {
|
||||
# int data[9], temp[2];
|
||||
# int a = 0;
|
||||
# data[0] = 5;
|
||||
#
|
||||
# // For the values of x used in this test, the following loop
|
||||
# // runs at least twice, making temp[0] = 5 and temp[1] = 5.
|
||||
# while (a <= x)
|
||||
# {
|
||||
# // Always true.
|
||||
# if (a <= 10) {
|
||||
# // When a == 0 this sets temp[0] to data[0] == 5;
|
||||
# // otherwise it sets temp[1] to data[0] == 5.
|
||||
# temp[min(a, 1)] = data[min(a, 0)];
|
||||
# a++;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // This loop sets data[0] and data[1] to 5 and 6.
|
||||
# for (int i = 0; i < 2; i++)
|
||||
# data[i] = temp[0] + i;
|
||||
#
|
||||
# if (data[0] == 5 && data[1] == 6)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# for (int i = 1; i < 6; i++)
|
||||
# func(i);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 100
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %81
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "func(i1;"
|
||||
OpName %9 "x"
|
||||
OpName %12 "a"
|
||||
OpName %18 "data"
|
||||
OpName %38 "temp"
|
||||
OpName %49 "i"
|
||||
OpName %81 "_GLF_color"
|
||||
OpName %87 "i"
|
||||
OpName %95 "param"
|
||||
OpDecorate %81 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%8 = OpTypeFunction %2 %7
|
||||
%13 = OpConstant %6 0
|
||||
%14 = OpTypeInt 32 0
|
||||
%15 = OpConstant %14 9
|
||||
%16 = OpTypeArray %6 %15
|
||||
%17 = OpTypePointer Function %16
|
||||
%19 = OpConstant %6 5
|
||||
%28 = OpTypeBool
|
||||
%31 = OpConstant %6 10
|
||||
%35 = OpConstant %14 2
|
||||
%36 = OpTypeArray %6 %35
|
||||
%37 = OpTypePointer Function %36
|
||||
%40 = OpConstant %6 1
|
||||
%56 = OpConstant %6 2
|
||||
%73 = OpConstant %6 6
|
||||
%78 = OpTypeFloat 32
|
||||
%79 = OpTypeVector %78 4
|
||||
%80 = OpTypePointer Output %79
|
||||
%81 = OpVariable %80 Output
|
||||
%82 = OpConstant %78 1
|
||||
%83 = OpConstant %78 0
|
||||
%84 = OpConstantComposite %79 %82 %83 %83 %82
|
||||
%86 = OpConstantComposite %79 %83 %83 %83 %83
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%87 = OpVariable %7 Function
|
||||
%95 = OpVariable %7 Function
|
||||
OpStore %87 %40
|
||||
OpBranch %88
|
||||
%88 = OpLabel
|
||||
OpLoopMerge %90 %91 None
|
||||
OpBranch %92
|
||||
%92 = OpLabel
|
||||
%93 = OpLoad %6 %87
|
||||
%94 = OpSLessThan %28 %93 %73
|
||||
OpBranchConditional %94 %89 %90
|
||||
%89 = OpLabel
|
||||
%96 = OpLoad %6 %87
|
||||
OpStore %95 %96
|
||||
%97 = OpFunctionCall %2 %10 %95
|
||||
OpBranch %91
|
||||
%91 = OpLabel
|
||||
%98 = OpLoad %6 %87
|
||||
%99 = OpIAdd %6 %98 %40
|
||||
OpStore %87 %99
|
||||
OpBranch %88
|
||||
%90 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%10 = OpFunction %2 None %8
|
||||
%9 = OpFunctionParameter %7
|
||||
%11 = OpLabel
|
||||
%12 = OpVariable %7 Function
|
||||
%18 = OpVariable %17 Function
|
||||
%38 = OpVariable %37 Function
|
||||
%49 = OpVariable %7 Function
|
||||
OpStore %12 %13
|
||||
%20 = OpAccessChain %7 %18 %13
|
||||
OpStore %20 %19
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpLoopMerge %23 %24 None
|
||||
OpBranch %25
|
||||
%25 = OpLabel
|
||||
%26 = OpLoad %6 %12
|
||||
%27 = OpLoad %6 %9
|
||||
%29 = OpSLessThanEqual %28 %26 %27
|
||||
OpBranchConditional %29 %22 %23
|
||||
%22 = OpLabel
|
||||
%30 = OpLoad %6 %12
|
||||
%32 = OpSLessThanEqual %28 %30 %31
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %34
|
||||
%33 = OpLabel
|
||||
%39 = OpLoad %6 %12
|
||||
%41 = OpExtInst %6 %1 SMin %39 %40
|
||||
%42 = OpLoad %6 %12
|
||||
%43 = OpExtInst %6 %1 SMin %42 %13
|
||||
%44 = OpAccessChain %7 %18 %43
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpAccessChain %7 %38 %41
|
||||
OpStore %46 %45
|
||||
%47 = OpLoad %6 %12
|
||||
%48 = OpIAdd %6 %47 %40
|
||||
OpStore %12 %48
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
OpBranch %21
|
||||
%23 = OpLabel
|
||||
OpStore %49 %13
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
OpLoopMerge %52 %53 None
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%55 = OpLoad %6 %49
|
||||
%57 = OpSLessThan %28 %55 %56
|
||||
OpBranchConditional %57 %51 %52
|
||||
%51 = OpLabel
|
||||
%58 = OpLoad %6 %49
|
||||
%59 = OpAccessChain %7 %38 %13
|
||||
%60 = OpLoad %6 %59
|
||||
%61 = OpLoad %6 %49
|
||||
%62 = OpIAdd %6 %60 %61
|
||||
%63 = OpAccessChain %7 %18 %58
|
||||
OpStore %63 %62
|
||||
OpBranch %53
|
||||
%53 = OpLabel
|
||||
%64 = OpLoad %6 %49
|
||||
%65 = OpIAdd %6 %64 %40
|
||||
OpStore %49 %65
|
||||
OpBranch %50
|
||||
%52 = OpLabel
|
||||
%66 = OpAccessChain %7 %18 %13
|
||||
%67 = OpLoad %6 %66
|
||||
%68 = OpIEqual %28 %67 %19
|
||||
OpSelectionMerge %70 None
|
||||
OpBranchConditional %68 %69 %70
|
||||
%69 = OpLabel
|
||||
%71 = OpAccessChain %7 %18 %40
|
||||
%72 = OpLoad %6 %71
|
||||
%74 = OpIEqual %28 %72 %73
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
%75 = OpPhi %28 %68 %52 %74 %69
|
||||
OpSelectionMerge %77 None
|
||||
OpBranchConditional %75 %76 %85
|
||||
%76 = OpLabel
|
||||
OpStore %81 %84
|
||||
OpBranch %77
|
||||
%85 = OpLabel
|
||||
OpStore %81 %86
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,199 @@
|
||||
# Copyright 2018 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A compute shader with a barrier in a loop with a break
|
||||
|
||||
# Derived from the following GLSL.
|
||||
|
||||
# Compute shader GLSL:
|
||||
# #version 310 es
|
||||
#
|
||||
# layout(set = 0, binding = 1) uniform buf1 {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# layout(std430, binding = 0) buffer doesNotMatter {
|
||||
# int global_seed;
|
||||
# int data[];
|
||||
# };
|
||||
# layout(local_size_x = 16, local_size_y = 1) in;
|
||||
# void main()
|
||||
# {
|
||||
# int lid = int(gl_LocalInvocationID.x);
|
||||
# int val = global_seed;
|
||||
# for(
|
||||
# int i = 0;
|
||||
# i < 2;
|
||||
# i ++
|
||||
# )
|
||||
# {
|
||||
# if(lid > 0)
|
||||
# {
|
||||
# val += data[lid - 1];
|
||||
# if(injectionSwitch.x > 100.0)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
# barrier();
|
||||
# }
|
||||
# if (lid == 0) {
|
||||
# data[0] = 42;
|
||||
# }
|
||||
# }
|
||||
|
||||
[compute shader spirv]
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 74
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %4 "main" %12
|
||||
OpExecutionMode %4 LocalSize 16 1 1
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "lid"
|
||||
OpName %12 "gl_LocalInvocationID"
|
||||
OpName %18 "val"
|
||||
OpName %20 "doesNotMatter"
|
||||
OpMemberName %20 0 "global_seed"
|
||||
OpMemberName %20 1 "data"
|
||||
OpName %22 ""
|
||||
OpName %27 "i"
|
||||
OpName %50 "buf1"
|
||||
OpMemberName %50 0 "injectionSwitch"
|
||||
OpName %52 ""
|
||||
OpDecorate %12 BuiltIn LocalInvocationId
|
||||
OpDecorate %19 ArrayStride 4
|
||||
OpMemberDecorate %20 0 Offset 0
|
||||
OpMemberDecorate %20 1 Offset 4
|
||||
OpDecorate %20 BufferBlock
|
||||
OpDecorate %22 DescriptorSet 0
|
||||
OpDecorate %22 Binding 0
|
||||
OpMemberDecorate %50 0 Offset 0
|
||||
OpDecorate %50 Block
|
||||
OpDecorate %52 DescriptorSet 0
|
||||
OpDecorate %52 Binding 1
|
||||
OpDecorate %73 BuiltIn WorkgroupSize
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpTypeVector %9 3
|
||||
%11 = OpTypePointer Input %10
|
||||
%12 = OpVariable %11 Input
|
||||
%13 = OpConstant %9 0
|
||||
%14 = OpTypePointer Input %9
|
||||
%19 = OpTypeRuntimeArray %6
|
||||
%20 = OpTypeStruct %6 %19
|
||||
%21 = OpTypePointer Uniform %20
|
||||
%22 = OpVariable %21 Uniform
|
||||
%23 = OpConstant %6 0
|
||||
%24 = OpTypePointer Uniform %6
|
||||
%34 = OpConstant %6 2
|
||||
%35 = OpTypeBool
|
||||
%41 = OpConstant %6 1
|
||||
%48 = OpTypeFloat 32
|
||||
%49 = OpTypeVector %48 2
|
||||
%50 = OpTypeStruct %49
|
||||
%51 = OpTypePointer Uniform %50
|
||||
%52 = OpVariable %51 Uniform
|
||||
%53 = OpTypePointer Uniform %48
|
||||
%56 = OpConstant %48 100
|
||||
%61 = OpConstant %9 2
|
||||
%62 = OpConstant %9 264
|
||||
%69 = OpConstant %6 42
|
||||
%71 = OpConstant %9 16
|
||||
%72 = OpConstant %9 1
|
||||
%73 = OpConstantComposite %10 %71 %72 %72
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%18 = OpVariable %7 Function
|
||||
%27 = OpVariable %7 Function
|
||||
%15 = OpAccessChain %14 %12 %13
|
||||
%16 = OpLoad %9 %15
|
||||
%17 = OpBitcast %6 %16
|
||||
OpStore %8 %17
|
||||
%25 = OpAccessChain %24 %22 %23
|
||||
%26 = OpLoad %6 %25
|
||||
OpStore %18 %26
|
||||
OpStore %27 %23
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
OpLoopMerge %30 %31 None
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%33 = OpLoad %6 %27
|
||||
%36 = OpSLessThan %35 %33 %34
|
||||
OpBranchConditional %36 %29 %30
|
||||
%29 = OpLabel
|
||||
%37 = OpLoad %6 %8
|
||||
%38 = OpSGreaterThan %35 %37 %23
|
||||
OpSelectionMerge %40 None
|
||||
OpBranchConditional %38 %39 %40
|
||||
%39 = OpLabel
|
||||
%42 = OpLoad %6 %8
|
||||
%43 = OpISub %6 %42 %41
|
||||
%44 = OpAccessChain %24 %22 %41 %43
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpLoad %6 %18
|
||||
%47 = OpIAdd %6 %46 %45
|
||||
OpStore %18 %47
|
||||
%54 = OpAccessChain %53 %52 %23 %13
|
||||
%55 = OpLoad %48 %54
|
||||
%57 = OpFOrdGreaterThan %35 %55 %56
|
||||
OpSelectionMerge %59 None
|
||||
OpBranchConditional %57 %58 %59
|
||||
%58 = OpLabel
|
||||
OpBranch %30
|
||||
%59 = OpLabel
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
OpControlBarrier %61 %61 %62
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%63 = OpLoad %6 %27
|
||||
%64 = OpIAdd %6 %63 %41
|
||||
OpStore %27 %64
|
||||
OpBranch %28
|
||||
%30 = OpLabel
|
||||
%65 = OpLoad %6 %8
|
||||
%66 = OpIEqual %35 %65 %23
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %66 %67 %68
|
||||
%67 = OpLabel
|
||||
%70 = OpAccessChain %24 %22 %41 %23
|
||||
OpStore %70 %69
|
||||
OpBranch %68
|
||||
%68 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
|
||||
[test]
|
||||
## Uniforms
|
||||
# injectionSwitch
|
||||
uniform ubo 0:1 vec2 0 0.0 1.0
|
||||
## SSBO
|
||||
ssbo 0 subdata int 0 12345
|
||||
ssbo 0 subdata int 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
|
||||
compute 1 1 1
|
||||
probe ssbo int 0 4 == 42
|
||||
@@ -0,0 +1,175 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with nested if
|
||||
|
||||
# The test passes because main always writes color red.
|
||||
# Running code after writing red does not matter.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--copy-propagate-arrays'
|
||||
# '--if-conversion'
|
||||
# '--convert-local-access-chains'
|
||||
# '--convert-local-access-chains'
|
||||
# '--vector-dce'
|
||||
# '--reduce-load-size'
|
||||
# '--reduce-load-size'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--redundancy-elimination'
|
||||
# '--private-to-local'
|
||||
# '--eliminate-dead-code-aggressive'
|
||||
# '--ccp'
|
||||
# '--simplify-instructions'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--eliminate-dead-inserts'
|
||||
# '--eliminate-dead-branches'
|
||||
# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red
|
||||
#
|
||||
# do
|
||||
# {
|
||||
# if (injectionSwitch.y < 0.0) // Always false
|
||||
# {
|
||||
# bool GLF_live12c5 = false;
|
||||
# if (GLF_live12c5)
|
||||
# {
|
||||
# }
|
||||
# continue;
|
||||
# }
|
||||
# break;
|
||||
# } while (false);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 39
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "_GLF_color"
|
||||
OpName %18 "buf0"
|
||||
OpMemberName %18 0 "injectionSwitch"
|
||||
OpName %20 ""
|
||||
OpName %33 "GLF_live12c5"
|
||||
OpDecorate %9 Location 0
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Output %7
|
||||
%9 = OpVariable %8 Output
|
||||
%10 = OpConstant %6 1
|
||||
%11 = OpConstant %6 0
|
||||
%12 = OpConstantComposite %7 %10 %11 %11 %10
|
||||
%17 = OpTypeVector %6 2
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpTypeInt 32 1
|
||||
%22 = OpConstant %21 0
|
||||
%23 = OpTypeInt 32 0
|
||||
%24 = OpConstant %23 1
|
||||
%25 = OpTypePointer Uniform %6
|
||||
%28 = OpTypeBool
|
||||
%32 = OpTypePointer Function %28
|
||||
%34 = OpConstantFalse %28
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%33 = OpVariable %32 Function
|
||||
OpStore %9 %12
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
OpLoopMerge %15 %37 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%26 = OpAccessChain %25 %20 %22 %24
|
||||
%27 = OpLoad %6 %26
|
||||
%29 = OpFOrdLessThan %28 %27 %11
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %30 %31
|
||||
%30 = OpLabel
|
||||
OpStore %33 %34
|
||||
%35 = OpLoad %28 %33
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %35 %36 %37
|
||||
%36 = OpLabel
|
||||
OpBranch %37
|
||||
%38 = OpLabel
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpBranchConditional %34 %13 %15
|
||||
%31 = OpLabel
|
||||
OpBranch %15
|
||||
%15 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,165 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: Calls a function containing a discard
|
||||
|
||||
# The test passes because main always writes the color red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--ccp'
|
||||
# '--scalar-replacement=100'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--simplify-instructions'
|
||||
# '--redundancy-elimination'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--private-to-local'
|
||||
# '--if-conversion'
|
||||
# '--private-to-local'
|
||||
# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float one;
|
||||
# };
|
||||
#
|
||||
# void func()
|
||||
# {
|
||||
# if (1.0 > one) // Always false
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(0);
|
||||
# do
|
||||
# {
|
||||
# func();
|
||||
# } while (false);
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 35
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %25
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %6 "func("
|
||||
OpName %10 "buf0"
|
||||
OpMemberName %10 0 "one"
|
||||
OpName %12 ""
|
||||
OpName %25 "_GLF_color"
|
||||
OpMemberDecorate %10 0 Offset 0
|
||||
OpDecorate %10 Block
|
||||
OpDecorate %12 DescriptorSet 0
|
||||
OpDecorate %12 Binding 0
|
||||
OpDecorate %25 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%8 = OpTypeFloat 32
|
||||
%9 = OpConstant %8 1
|
||||
%10 = OpTypeStruct %8
|
||||
%11 = OpTypePointer Uniform %10
|
||||
%12 = OpVariable %11 Uniform
|
||||
%13 = OpTypeInt 32 1
|
||||
%14 = OpConstant %13 0
|
||||
%15 = OpTypePointer Uniform %8
|
||||
%18 = OpTypeBool
|
||||
%23 = OpTypeVector %8 4
|
||||
%24 = OpTypePointer Output %23
|
||||
%25 = OpVariable %24 Output
|
||||
%26 = OpConstant %8 0
|
||||
%27 = OpConstantComposite %23 %26 %26 %26 %26
|
||||
%33 = OpConstantFalse %18
|
||||
%34 = OpConstantComposite %23 %9 %26 %26 %9
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
OpStore %25 %27
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
%32 = OpFunctionCall %2 %6
|
||||
OpLoopMerge %30 %28 None
|
||||
OpBranchConditional %33 %28 %30
|
||||
%30 = OpLabel
|
||||
OpStore %25 %34
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%6 = OpFunction %2 None %3
|
||||
%7 = OpLabel
|
||||
%16 = OpAccessChain %15 %12 %14
|
||||
%17 = OpLoad %8 %16
|
||||
%19 = OpFOrdGreaterThan %18 %9 %17
|
||||
OpSelectionMerge %21 None
|
||||
OpBranchConditional %19 %20 %21
|
||||
%20 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%21 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE float DATA
|
||||
1.0
|
||||
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_one 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
|
||||
@@ -0,0 +1,196 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with a call, if, while, switch
|
||||
|
||||
# The test passes because the fragment shader does some control flow and then writes the color red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '-O'
|
||||
# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# int data[10];
|
||||
#
|
||||
# void merge(int from)
|
||||
# {
|
||||
# int i = 1;
|
||||
# if (1 < data[1])
|
||||
# {
|
||||
# i++;
|
||||
# }
|
||||
# while (i < 3)
|
||||
# {
|
||||
# i++;
|
||||
# switch (int(injectionSwitch.x))
|
||||
# {
|
||||
# case 19:
|
||||
# from++;
|
||||
# case 38:
|
||||
# case 23:
|
||||
# break;
|
||||
# case 78:
|
||||
# _GLF_color = vec4(1.0);
|
||||
# default:
|
||||
# 1;
|
||||
# }
|
||||
# }
|
||||
# data[from] = 1;
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# merge(1);
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 112
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %59
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %18 "data"
|
||||
OpName %40 "buf0"
|
||||
OpMemberName %40 0 "injectionSwitch"
|
||||
OpName %42 ""
|
||||
OpName %59 "_GLF_color"
|
||||
OpDecorate %18 RelaxedPrecision
|
||||
OpMemberDecorate %40 0 Offset 0
|
||||
OpDecorate %40 Block
|
||||
OpDecorate %42 DescriptorSet 0
|
||||
OpDecorate %42 Binding 0
|
||||
OpDecorate %59 Location 0
|
||||
OpDecorate %71 RelaxedPrecision
|
||||
OpDecorate %85 RelaxedPrecision
|
||||
OpDecorate %95 RelaxedPrecision
|
||||
OpDecorate %110 RelaxedPrecision
|
||||
OpDecorate %99 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%13 = OpConstant %6 1
|
||||
%14 = OpTypeInt 32 0
|
||||
%15 = OpConstant %14 10
|
||||
%16 = OpTypeArray %6 %15
|
||||
%22 = OpTypeBool
|
||||
%34 = OpConstant %6 3
|
||||
%38 = OpTypeFloat 32
|
||||
%39 = OpTypeVector %38 2
|
||||
%40 = OpTypeStruct %39
|
||||
%41 = OpTypePointer Uniform %40
|
||||
%42 = OpVariable %41 Uniform
|
||||
%43 = OpConstant %6 0
|
||||
%44 = OpConstant %14 0
|
||||
%45 = OpTypePointer Uniform %38
|
||||
%57 = OpTypeVector %38 4
|
||||
%58 = OpTypePointer Output %57
|
||||
%59 = OpVariable %58 Output
|
||||
%60 = OpConstant %38 1
|
||||
%61 = OpConstantComposite %57 %60 %60 %60 %60
|
||||
%67 = OpConstant %38 0
|
||||
%68 = OpConstantComposite %57 %60 %67 %67 %60
|
||||
%98 = OpTypePointer Function %16
|
||||
%109 = OpConstant %6 2
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%18 = OpVariable %98 Function
|
||||
%70 = OpAccessChain %7 %18 %13
|
||||
%71 = OpLoad %6 %70
|
||||
%72 = OpSLessThan %22 %13 %71
|
||||
%110 = OpSelect %6 %72 %109 %13
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
%101 = OpPhi %6 %13 %5 %106 %89
|
||||
%99 = OpPhi %6 %110 %5 %85 %89
|
||||
%82 = OpSLessThan %22 %99 %34
|
||||
OpLoopMerge %78 %89 None
|
||||
OpBranchConditional %82 %83 %78
|
||||
%83 = OpLabel
|
||||
%85 = OpIAdd %6 %99 %13
|
||||
%86 = OpAccessChain %45 %42 %43 %44
|
||||
%87 = OpLoad %38 %86
|
||||
%88 = OpConvertFToS %6 %87
|
||||
OpSelectionMerge %111 None
|
||||
OpSwitch %88 %90 19 %91 38 %92 23 %92 78 %93
|
||||
%90 = OpLabel
|
||||
OpBranch %89
|
||||
%91 = OpLabel
|
||||
%95 = OpIAdd %6 %101 %13
|
||||
OpBranch %92
|
||||
%92 = OpLabel
|
||||
%108 = OpPhi %6 %101 %83 %95 %91
|
||||
OpBranch %89
|
||||
%93 = OpLabel
|
||||
OpStore %59 %61
|
||||
OpBranch %90
|
||||
%111 = OpLabel
|
||||
OpBranch %89
|
||||
%89 = OpLabel
|
||||
%106 = OpPhi %6 %101 %90 %108 %92 %43 %111
|
||||
OpBranch %77
|
||||
%78 = OpLabel
|
||||
%97 = OpAccessChain %7 %18 %101
|
||||
OpStore %97 %13
|
||||
OpStore %59 %68
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,153 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with color set in for loop
|
||||
|
||||
# The test passes because main always writes the color red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--wrap-opkill'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--eliminate-dead-functions'
|
||||
# '--private-to-local'
|
||||
# '--scalar-replacement=0'
|
||||
# '--ssa-rewrite'
|
||||
# '--ccp'
|
||||
# spirv-opt commit hash: 18b3b94567a9251a6f8491a6d07c4422abadd22c
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if (injectionSwitch.x > 1.0) // Always false
|
||||
# {
|
||||
# for (mat4 tmp1; true;)
|
||||
# {
|
||||
# _GLF_color = vec4(0, 0, 0, 1);
|
||||
# }
|
||||
# }
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 35
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %31
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "buf0"
|
||||
OpMemberName %8 0 "injectionSwitch"
|
||||
OpName %10 ""
|
||||
OpName %31 "_GLF_color"
|
||||
OpMemberDecorate %8 0 Offset 0
|
||||
OpDecorate %8 Block
|
||||
OpDecorate %10 DescriptorSet 0
|
||||
OpDecorate %10 Binding 0
|
||||
OpDecorate %31 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 %6 1
|
||||
%19 = OpTypeBool
|
||||
%28 = OpConstantTrue %19
|
||||
%29 = OpTypeVector %6 4
|
||||
%30 = OpTypePointer Output %29
|
||||
%31 = OpVariable %30 Output
|
||||
%32 = OpConstant %6 0
|
||||
%33 = OpConstantComposite %29 %32 %32 %32 %18
|
||||
%34 = OpConstantComposite %29 %18 %32 %32 %18
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %15 %10 %12 %14
|
||||
%17 = OpLoad %6 %16
|
||||
%20 = OpFOrdGreaterThan %19 %17 %18
|
||||
OpSelectionMerge %22 None
|
||||
OpBranchConditional %20 %21 %22
|
||||
%21 = OpLabel
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
OpLoopMerge %25 %26 None
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
OpStore %31 %33
|
||||
OpBranch %26
|
||||
%26 = OpLabel
|
||||
OpBranch %23
|
||||
%25 = OpLabel
|
||||
OpUnreachable
|
||||
%22 = OpLabel
|
||||
OpStore %31 %34
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,195 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that writes to color in a loop
|
||||
|
||||
# Checks that the top-left pixel is red.
|
||||
# Passes because main ends by writing red to _GLF_color.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '-O'
|
||||
# spirv-opt commit hash: a2ef7be242bcacaa9127a3ce011602ec54b2c9ed
|
||||
|
||||
# Derived from the following GLSL.
|
||||
|
||||
# Fragment shader GLSL:
|
||||
# #version 310 es
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# struct S {
|
||||
# int f0;
|
||||
# mat4x3 f1;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void g()
|
||||
# {
|
||||
# S s = S(0, mat4x3(1.0));
|
||||
# for(
|
||||
# int l = 0;
|
||||
# l < (gl_FragCoord.x == 0.0 ? 1 : 2);
|
||||
# l ++
|
||||
# )
|
||||
# {
|
||||
# _GLF_color = vec4(1.0);
|
||||
# s.f0++;
|
||||
# }
|
||||
# if(s.f0 < 1000)
|
||||
# {
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# g();
|
||||
# for(
|
||||
# int i = 0;
|
||||
# i < (gl_FragCoord.x == 0.0 ? 1 : 2);
|
||||
# i++
|
||||
# )
|
||||
# {
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
# }
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 120
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %34 %47
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %12 "S"
|
||||
OpMemberName %12 0 "f0"
|
||||
OpMemberName %12 1 "f1"
|
||||
OpName %34 "gl_FragCoord"
|
||||
OpName %47 "_GLF_color"
|
||||
OpMemberDecorate %12 0 RelaxedPrecision
|
||||
OpDecorate %34 BuiltIn FragCoord
|
||||
OpDecorate %47 Location 0
|
||||
OpDecorate %76 RelaxedPrecision
|
||||
OpDecorate %104 RelaxedPrecision
|
||||
OpDecorate %105 RelaxedPrecision
|
||||
OpDecorate %107 RelaxedPrecision
|
||||
OpDecorate %109 RelaxedPrecision
|
||||
OpDecorate %117 RelaxedPrecision
|
||||
OpDecorate %119 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%8 = OpTypeInt 32 1
|
||||
%9 = OpTypeFloat 32
|
||||
%10 = OpTypeVector %9 3
|
||||
%11 = OpTypeMatrix %10 4
|
||||
%12 = OpTypeStruct %8 %11
|
||||
%15 = OpConstant %8 0
|
||||
%16 = OpConstant %9 1
|
||||
%17 = OpConstant %9 0
|
||||
%18 = OpConstantComposite %10 %16 %17 %17
|
||||
%19 = OpConstantComposite %10 %17 %16 %17
|
||||
%20 = OpConstantComposite %10 %17 %17 %16
|
||||
%21 = OpConstantComposite %10 %17 %17 %17
|
||||
%22 = OpConstantComposite %11 %18 %19 %20 %21
|
||||
%23 = OpConstantComposite %12 %15 %22
|
||||
%32 = OpTypeVector %9 4
|
||||
%33 = OpTypePointer Input %32
|
||||
%34 = OpVariable %33 Input
|
||||
%35 = OpTypeInt 32 0
|
||||
%36 = OpConstant %35 0
|
||||
%37 = OpTypePointer Input %9
|
||||
%40 = OpTypeBool
|
||||
%42 = OpConstant %8 1
|
||||
%43 = OpConstant %8 2
|
||||
%46 = OpTypePointer Output %32
|
||||
%47 = OpVariable %46 Output
|
||||
%48 = OpConstantComposite %32 %16 %16 %16 %16
|
||||
%56 = OpConstant %8 1000
|
||||
%74 = OpConstantComposite %32 %16 %17 %17 %16
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
OpBranch %88
|
||||
%88 = OpLabel
|
||||
OpLoopMerge %89 %90 None
|
||||
OpBranch %92
|
||||
%92 = OpLabel
|
||||
%118 = OpPhi %12 %23 %88 %115 %102
|
||||
%117 = OpPhi %8 %15 %88 %107 %102
|
||||
%97 = OpAccessChain %37 %34 %36
|
||||
%98 = OpLoad %9 %97
|
||||
%99 = OpFOrdEqual %40 %98 %17
|
||||
%100 = OpSelect %8 %99 %42 %43
|
||||
%101 = OpSLessThan %40 %117 %100
|
||||
OpLoopMerge %93 %102 None
|
||||
OpBranchConditional %101 %102 %93
|
||||
%102 = OpLabel
|
||||
OpStore %47 %48
|
||||
%104 = OpCompositeExtract %8 %118 0
|
||||
%105 = OpIAdd %8 %104 %42
|
||||
%115 = OpCompositeInsert %12 %105 %118 0
|
||||
%107 = OpIAdd %8 %117 %42
|
||||
OpBranch %92
|
||||
%93 = OpLabel
|
||||
%109 = OpCompositeExtract %8 %118 0
|
||||
%110 = OpSLessThan %40 %109 %56
|
||||
OpSelectionMerge %111 None
|
||||
OpBranchConditional %110 %112 %111
|
||||
%112 = OpLabel
|
||||
OpBranch %89
|
||||
%111 = OpLabel
|
||||
OpBranch %89
|
||||
%90 = OpLabel
|
||||
OpBranch %88
|
||||
%89 = OpLabel
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
%119 = OpPhi %8 %15 %89 %76 %64
|
||||
%73 = OpSLessThan %40 %119 %100
|
||||
OpLoopMerge %65 %64 None
|
||||
OpBranchConditional %73 %64 %65
|
||||
%64 = OpLabel
|
||||
OpStore %47 %74
|
||||
%76 = OpIAdd %8 %119 %42
|
||||
OpBranch %63
|
||||
%65 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,320 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with complex nested loops, breaks, etc.
|
||||
|
||||
# The test passes because the shader always outputs the color red.
|
||||
# pickColor(i) returns red (because i is always 1).
|
||||
# mand() returns red because it sets iteration to 1, breaks from the first loop,
|
||||
# does not enter the if, and returns pickColor(iteration).
|
||||
# main() writes red because it sets data[0] to mand() and then writes
|
||||
# vec4(data[0], 1.0) to the color output variable.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '-O'
|
||||
# spirv-opt commit hash: 06407250a169c6a03b3765e86619075af1a8c187
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# vec3 pickColor(int i)
|
||||
# {
|
||||
# return vec3(float(i), 0.0, 0.0); // i is always 1
|
||||
# }
|
||||
#
|
||||
# // Returns vec3(1.0, 0.0, 0.0)
|
||||
# vec3 mand()
|
||||
# {
|
||||
# float x = 0.0, y = 0.0;
|
||||
# int iteration = 1;
|
||||
# int k = 1;
|
||||
# int iterationCap = 17;
|
||||
# do
|
||||
# {
|
||||
# if (injectionSwitch.x < 10.0) // always true
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# if (injectionSwitch.x < 20.0)
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
# iteration++;
|
||||
# if (injectionSwitch.x < 30.0)
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# } while (k < iterationCap);
|
||||
#
|
||||
# if (injectionSwitch.x > 10.0) // always false
|
||||
# {
|
||||
# if (gl_FragCoord.x < 0.0)
|
||||
# {
|
||||
# do
|
||||
# {
|
||||
# _GLF_color = vec4(1.0);
|
||||
# } while (gl_FragCoord.y < 0.0);
|
||||
# }
|
||||
# do
|
||||
# {
|
||||
# _GLF_color = vec4(1.0);
|
||||
# } while (gl_FragCoord.x < 0.0);
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# return pickColor(iteration); // pickColor(1)
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# vec3 data[16];
|
||||
# for (
|
||||
# int i = 0;
|
||||
# i < int(injectionSwitch.y); // i < 1
|
||||
# i++)
|
||||
# {
|
||||
# for (
|
||||
# int j = 0;
|
||||
# j < 2;
|
||||
# j++)
|
||||
# {
|
||||
# data[int(injectionSwitch.x)] = mand(); // data[0] = vec3(1.0, 0.0, 0.0);
|
||||
# }
|
||||
# }
|
||||
# _GLF_color = vec4(data[0], 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 255
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %79 %91
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %36 "buf0"
|
||||
OpMemberName %36 0 "injectionSwitch"
|
||||
OpName %38 ""
|
||||
OpName %79 "gl_FragCoord"
|
||||
OpName %91 "_GLF_color"
|
||||
OpName %133 "data"
|
||||
OpMemberDecorate %36 0 Offset 0
|
||||
OpDecorate %36 Block
|
||||
OpDecorate %38 DescriptorSet 0
|
||||
OpDecorate %38 Binding 0
|
||||
OpDecorate %79 BuiltIn FragCoord
|
||||
OpDecorate %91 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%8 = OpTypeFloat 32
|
||||
%9 = OpTypeVector %8 3
|
||||
%19 = OpConstant %8 0
|
||||
%27 = OpConstant %6 1
|
||||
%35 = OpTypeVector %8 2
|
||||
%36 = OpTypeStruct %35
|
||||
%37 = OpTypePointer Uniform %36
|
||||
%38 = OpVariable %37 Uniform
|
||||
%39 = OpConstant %6 0
|
||||
%40 = OpTypeInt 32 0
|
||||
%41 = OpConstant %40 0
|
||||
%42 = OpTypePointer Uniform %8
|
||||
%45 = OpConstant %8 10
|
||||
%46 = OpTypeBool
|
||||
%53 = OpConstant %8 20
|
||||
%62 = OpConstant %8 30
|
||||
%66 = OpConstant %8 1
|
||||
%67 = OpConstantComposite %9 %66 %66 %66
|
||||
%77 = OpTypeVector %8 4
|
||||
%78 = OpTypePointer Input %77
|
||||
%79 = OpVariable %78 Input
|
||||
%80 = OpTypePointer Input %8
|
||||
%90 = OpTypePointer Output %77
|
||||
%91 = OpVariable %90 Output
|
||||
%92 = OpConstantComposite %77 %66 %66 %66 %66
|
||||
%93 = OpConstant %40 1
|
||||
%128 = OpConstant %6 2
|
||||
%130 = OpConstant %40 16
|
||||
%131 = OpTypeArray %9 %130
|
||||
%132 = OpTypePointer Function %131
|
||||
%138 = OpTypePointer Function %9
|
||||
%159 = OpConstantFalse %46
|
||||
%162 = OpConstantTrue %46
|
||||
%251 = OpUndef %9
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%133 = OpVariable %132 Function
|
||||
OpBranch %111
|
||||
%111 = OpLabel
|
||||
%237 = OpPhi %6 %39 %5 %143 %124
|
||||
%250 = OpPhi %9 %251 %5 %249 %124
|
||||
%117 = OpAccessChain %42 %38 %39 %93
|
||||
%118 = OpLoad %8 %117
|
||||
%119 = OpConvertFToS %6 %118
|
||||
%120 = OpSLessThan %46 %237 %119
|
||||
OpLoopMerge %113 %124 None
|
||||
OpBranchConditional %120 %112 %113
|
||||
%112 = OpLabel
|
||||
OpBranch %122
|
||||
%122 = OpLabel
|
||||
%249 = OpPhi %9 %250 %112 %245 %175
|
||||
%238 = OpPhi %6 %39 %112 %141 %175
|
||||
%129 = OpSLessThan %46 %238 %128
|
||||
OpLoopMerge %252 %175 None
|
||||
OpBranchConditional %129 %123 %252
|
||||
%123 = OpLabel
|
||||
%134 = OpAccessChain %42 %38 %39 %41
|
||||
%135 = OpLoad %8 %134
|
||||
%136 = OpConvertFToS %6 %135
|
||||
OpBranch %174
|
||||
%174 = OpLabel
|
||||
OpLoopMerge %254 %176 None
|
||||
OpBranch %178
|
||||
%178 = OpLabel
|
||||
%240 = OpPhi %6 %27 %174 %194 %198
|
||||
OpLoopMerge %179 %198 None
|
||||
OpBranch %181
|
||||
%181 = OpLabel
|
||||
%184 = OpFOrdLessThan %46 %135 %45
|
||||
OpSelectionMerge %185 None
|
||||
OpBranchConditional %184 %186 %185
|
||||
%186 = OpLabel
|
||||
OpBranch %179
|
||||
%185 = OpLabel
|
||||
%189 = OpFOrdLessThan %46 %135 %53
|
||||
OpSelectionMerge %190 None
|
||||
OpBranchConditional %189 %191 %190
|
||||
%191 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%190 = OpLabel
|
||||
%194 = OpIAdd %6 %240 %27
|
||||
%197 = OpFOrdLessThan %46 %135 %62
|
||||
OpSelectionMerge %253 None
|
||||
OpBranchConditional %197 %199 %198
|
||||
%199 = OpLabel
|
||||
OpBranch %179
|
||||
%253 = OpLabel
|
||||
OpBranch %198
|
||||
%198 = OpLabel
|
||||
OpBranch %178
|
||||
%179 = OpLabel
|
||||
%246 = OpPhi %9 %249 %186 %67 %199
|
||||
%244 = OpPhi %6 %240 %186 %194 %199
|
||||
%241 = OpPhi %46 %159 %186 %162 %199
|
||||
OpSelectionMerge %204 None
|
||||
OpBranchConditional %241 %254 %204
|
||||
%204 = OpLabel
|
||||
%207 = OpFOrdGreaterThan %46 %135 %45
|
||||
OpSelectionMerge %208 None
|
||||
OpBranchConditional %207 %209 %208
|
||||
%209 = OpLabel
|
||||
%210 = OpAccessChain %80 %79 %41
|
||||
%211 = OpLoad %8 %210
|
||||
%212 = OpFOrdLessThan %46 %211 %19
|
||||
OpSelectionMerge %213 None
|
||||
OpBranchConditional %212 %214 %213
|
||||
%214 = OpLabel
|
||||
OpBranch %215
|
||||
%215 = OpLabel
|
||||
OpStore %91 %92
|
||||
%219 = OpAccessChain %80 %79 %93
|
||||
%220 = OpLoad %8 %219
|
||||
%221 = OpFOrdLessThan %46 %220 %19
|
||||
OpLoopMerge %216 %215 None
|
||||
OpBranchConditional %221 %215 %216
|
||||
%216 = OpLabel
|
||||
OpBranch %213
|
||||
%213 = OpLabel
|
||||
OpBranch %222
|
||||
%222 = OpLabel
|
||||
OpStore %91 %92
|
||||
OpLoopMerge %223 %222 None
|
||||
OpBranchConditional %212 %222 %223
|
||||
%223 = OpLabel
|
||||
OpBranch %254
|
||||
%208 = OpLabel
|
||||
%235 = OpConvertSToF %8 %244
|
||||
%236 = OpCompositeConstruct %9 %235 %19 %19
|
||||
OpBranch %254
|
||||
%176 = OpLabel
|
||||
OpBranch %174
|
||||
%254 = OpLabel
|
||||
%245 = OpPhi %9 %246 %179 %67 %223 %236 %208
|
||||
OpBranch %175
|
||||
%175 = OpLabel
|
||||
%139 = OpAccessChain %138 %133 %136
|
||||
OpStore %139 %245
|
||||
%141 = OpIAdd %6 %238 %27
|
||||
OpBranch %122
|
||||
%252 = OpLabel
|
||||
OpBranch %124
|
||||
%124 = OpLabel
|
||||
%143 = OpIAdd %6 %237 %27
|
||||
OpBranch %111
|
||||
%113 = OpLabel
|
||||
%144 = OpAccessChain %138 %133 %39
|
||||
%145 = OpLoad %9 %144
|
||||
%146 = OpCompositeExtract %8 %145 0
|
||||
%147 = OpCompositeExtract %8 %145 1
|
||||
%148 = OpCompositeExtract %8 %145 2
|
||||
%149 = OpCompositeConstruct %77 %146 %147 %148 %66
|
||||
OpStore %91 %149
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,193 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A shader with conditional return inside an infinite loop
|
||||
|
||||
# The test passes because the shader always writes the color red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# int GLF_live6tree[10];
|
||||
#
|
||||
# int GLF_live6search()
|
||||
# {
|
||||
# // This function is never accessed
|
||||
# int GLF_live6currentNode;
|
||||
# int GLF_live6index = 0;
|
||||
# while (true)
|
||||
# {
|
||||
# GLF_live6currentNode = GLF_live6tree[GLF_live6index];
|
||||
# if (GLF_live6currentNode != 1)
|
||||
# {
|
||||
# return 1;
|
||||
# }
|
||||
# GLF_live6index = 1;
|
||||
# }
|
||||
# return 1;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if (injectionSwitch.x > 1.0) // Always false
|
||||
# {
|
||||
# GLF_live6search();
|
||||
# }
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 57
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %54
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "GLF_live6search("
|
||||
OpName %11 "GLF_live6index"
|
||||
OpName %20 "GLF_live6currentNode"
|
||||
OpName %25 "GLF_live6tree"
|
||||
OpName %40 "buf0"
|
||||
OpMemberName %40 0 "injectionSwitch"
|
||||
OpName %42 ""
|
||||
OpName %54 "_GLF_color"
|
||||
OpDecorate %8 RelaxedPrecision
|
||||
OpDecorate %11 RelaxedPrecision
|
||||
OpDecorate %20 RelaxedPrecision
|
||||
OpDecorate %25 RelaxedPrecision
|
||||
OpDecorate %26 RelaxedPrecision
|
||||
OpDecorate %29 RelaxedPrecision
|
||||
OpDecorate %30 RelaxedPrecision
|
||||
OpMemberDecorate %40 0 Offset 0
|
||||
OpDecorate %40 Block
|
||||
OpDecorate %42 DescriptorSet 0
|
||||
OpDecorate %42 Binding 0
|
||||
OpDecorate %51 RelaxedPrecision
|
||||
OpDecorate %54 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeFunction %6
|
||||
%10 = OpTypePointer Function %6
|
||||
%12 = OpConstant %6 0
|
||||
%18 = OpTypeBool
|
||||
%19 = OpConstantTrue %18
|
||||
%21 = OpTypeInt 32 0
|
||||
%22 = OpConstant %21 10
|
||||
%23 = OpTypeArray %6 %22
|
||||
%24 = OpTypePointer Private %23
|
||||
%25 = OpVariable %24 Private
|
||||
%27 = OpTypePointer Private %6
|
||||
%31 = OpConstant %6 1
|
||||
%38 = OpTypeFloat 32
|
||||
%39 = OpTypeVector %38 2
|
||||
%40 = OpTypeStruct %39
|
||||
%41 = OpTypePointer Uniform %40
|
||||
%42 = OpVariable %41 Uniform
|
||||
%43 = OpConstant %21 0
|
||||
%44 = OpTypePointer Uniform %38
|
||||
%47 = OpConstant %38 1
|
||||
%52 = OpTypeVector %38 4
|
||||
%53 = OpTypePointer Output %52
|
||||
%54 = OpVariable %53 Output
|
||||
%55 = OpConstant %38 0
|
||||
%56 = OpConstantComposite %52 %47 %55 %55 %47
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%45 = OpAccessChain %44 %42 %12 %43
|
||||
%46 = OpLoad %38 %45
|
||||
%48 = OpFOrdGreaterThan %18 %46 %47
|
||||
OpSelectionMerge %50 None
|
||||
OpBranchConditional %48 %49 %50
|
||||
%49 = OpLabel
|
||||
%51 = OpFunctionCall %6 %8
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
OpStore %54 %56
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%8 = OpFunction %6 None %7
|
||||
%9 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%20 = OpVariable %10 Function
|
||||
OpStore %11 %12
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
OpLoopMerge %15 %16 None
|
||||
OpBranch %17
|
||||
%17 = OpLabel
|
||||
OpBranchConditional %19 %14 %15
|
||||
%14 = OpLabel
|
||||
%26 = OpLoad %6 %11
|
||||
%28 = OpAccessChain %27 %25 %26
|
||||
%29 = OpLoad %6 %28
|
||||
OpStore %20 %29
|
||||
%30 = OpLoad %6 %20
|
||||
%32 = OpINotEqual %18 %30 %31
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %34
|
||||
%33 = OpLabel
|
||||
OpReturnValue %31
|
||||
%34 = OpLabel
|
||||
OpStore %11 %31
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
OpBranch %13
|
||||
%15 = OpLabel
|
||||
OpReturnValue %31
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,86 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz; reduced by spirv-fuzz and by hand.
|
||||
# A fragment shader with two nested loops. All loop conditions are false.
|
||||
# We check that all pixels are red. The test passes because the final statement
|
||||
# writes red to _GLF_color.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 22
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %2 "main" %3
|
||||
OpExecutionMode %2 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %2 "main"
|
||||
OpName %3 "_GLF_color"
|
||||
OpDecorate %3 Location 0
|
||||
%4 = OpTypeVoid
|
||||
%5 = OpTypeFunction %4
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpConstant %6 1
|
||||
%8 = OpConstant %6 0
|
||||
%9 = OpTypeVector %6 4
|
||||
%10 = OpConstantComposite %9 %7 %8 %8 %7
|
||||
%11 = OpTypePointer Output %9
|
||||
%3 = OpVariable %11 Output
|
||||
%12 = OpTypeBool
|
||||
%13 = OpConstantTrue %12
|
||||
%14 = OpConstantFalse %12
|
||||
%2 = OpFunction %4 None %5
|
||||
%15 = OpLabel
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
OpLoopMerge %17 %18 None
|
||||
OpBranchConditional %14 %19 %17
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %20 %21 None
|
||||
OpBranchConditional %14 %20 %20
|
||||
%21 = OpLabel
|
||||
OpBranch %19
|
||||
%20 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpBranch %16
|
||||
%17 = OpLabel
|
||||
OpStore %3 %10
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,852 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader with a lot of control flow
|
||||
|
||||
# The test passes because the fragment shader does not enter the first if statement, then writes
|
||||
# the color red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# vec3 drawShape(vec2 pos)
|
||||
# {
|
||||
# bool c2;
|
||||
# c2 = pos.x > 1.0;
|
||||
# if (c2)
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# bool c3;
|
||||
# c3 = pos.y < 1.0;
|
||||
# if (c3)
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# bool c4;
|
||||
# c4 = pos.y > 1.0;
|
||||
# if (c4)
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# bool c5;
|
||||
# c5 = pos.x < 1.0;
|
||||
# if (c5)
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# bool c6;
|
||||
# c6 = pos.x + 1.0 > 1.0;
|
||||
# if (c6)
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# int GLF_live4_looplimiter5;
|
||||
# for (
|
||||
# int GLF_live4i = 0;
|
||||
# GLF_live4i < 4;
|
||||
# ++GLF_live4i)
|
||||
# {
|
||||
# if (GLF_live4_looplimiter5 >= 7)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# GLF_live4_looplimiter5++;
|
||||
# mat4x2 GLF_live7m42;
|
||||
# GLF_live7m42 = mat4x2(1.0);
|
||||
# mat3 GLF_live7m33;
|
||||
# GLF_live7m33 = mat3(1.0);
|
||||
# int GLF_live7_looplimiter3;
|
||||
# for (
|
||||
# int GLF_live7cols = 2;
|
||||
# GLF_live7cols < 4;
|
||||
# ++GLF_live7cols)
|
||||
# {
|
||||
# if (GLF_live7_looplimiter3 >= 7)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# GLF_live7_looplimiter3++;
|
||||
# int GLF_live7_looplimiter2;
|
||||
# for (
|
||||
# int GLF_live7rows = 2;
|
||||
# GLF_live7rows < 4;
|
||||
# ++GLF_live7rows)
|
||||
# {
|
||||
# if (GLF_live7_looplimiter2 >= 7)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# GLF_live7_looplimiter2++;
|
||||
# int GLF_live7_looplimiter1;
|
||||
# GLF_live7_looplimiter1 = 0;
|
||||
# for (
|
||||
# int GLF_live7c = 0;
|
||||
# GLF_live7c < 3;
|
||||
# GLF_live7c++)
|
||||
# {
|
||||
# if (GLF_live7_looplimiter1 >= 7)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# GLF_live7_looplimiter1++;
|
||||
# int GLF_live7_looplimiter0;
|
||||
# for (
|
||||
# int GLF_live7r = 0;
|
||||
# GLF_live7r < 2;
|
||||
# ++GLF_live7r)
|
||||
# {
|
||||
# if (GLF_live7_looplimiter0 >= 7)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# GLF_live7_looplimiter0++;
|
||||
# GLF_live7m33[GLF_live7c >= 0 && GLF_live7c < 3 ? GLF_live7c : 0][GLF_live7r >= 0 && GLF_live7r < 3 ? GLF_live7r : 0] = 1.0;
|
||||
# if (0.0 > injectionSwitch.y)
|
||||
# {
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# GLF_live7m42[GLF_live7c >= 0 && GLF_live7c < 4 ? GLF_live7c : 0][GLF_live7r >= 0 && GLF_live7r < 2 ? GLF_live7r : 0] = 1.0;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# float GLF_live7sums[9];
|
||||
# int GLF_live7sum_index;
|
||||
# GLF_live7sum_index = 0;
|
||||
# int GLF_live7_looplimiter7;
|
||||
# GLF_live7_looplimiter7 = 0;
|
||||
# for (
|
||||
# int GLF_live7cols = 2;
|
||||
# GLF_live7cols < 4;
|
||||
# ++GLF_live7cols)
|
||||
# {
|
||||
# if (GLF_live7_looplimiter7 >= 7)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# GLF_live7_looplimiter7++;
|
||||
# int GLF_live7rows;
|
||||
# GLF_live7rows = 2;
|
||||
# GLF_live7sums[GLF_live7sum_index >= 0 && GLF_live7sum_index < 9 ? GLF_live7sum_index : 0] = 0.0;
|
||||
# for (
|
||||
# int GLF_live7c = 0;
|
||||
# GLF_live7c < 1;
|
||||
# GLF_live7c++)
|
||||
# {
|
||||
# for (
|
||||
# int GLF_live7r = 0;
|
||||
# GLF_live7r < GLF_live7rows;
|
||||
# GLF_live7r++)
|
||||
# {
|
||||
# GLF_live7sums[GLF_live7sum_index >= 0 && GLF_live7sum_index < 9 ? GLF_live7sum_index : 0] += transpose(GLF_live7m33)[GLF_live7c < 3 ? 1 : int(injectionSwitch.x)][GLF_live7r < 3 ? 1 : 0];
|
||||
# GLF_live7sums[GLF_live7sum_index >= 0 && GLF_live7sum_index < 9 ? GLF_live7sum_index : 0] += GLF_live7m42[1][GLF_live7r];
|
||||
# }
|
||||
# }
|
||||
# GLF_live7sum_index++;
|
||||
# }
|
||||
# }
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# if (injectionSwitch.x >= 2.0) // always false
|
||||
# {
|
||||
# vec2 position = gl_FragCoord.xy;
|
||||
# drawShape(position);
|
||||
# drawShape(position);
|
||||
#
|
||||
# for (
|
||||
# int i = 25;
|
||||
# i > 0;
|
||||
# --i)
|
||||
# {
|
||||
# drawShape(position);
|
||||
# }
|
||||
# }
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 352
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %326 %350
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %12 "drawShape(vf2;"
|
||||
OpName %11 "pos"
|
||||
OpName %16 "c2"
|
||||
OpName %29 "c3"
|
||||
OpName %38 "c4"
|
||||
OpName %46 "c5"
|
||||
OpName %54 "c6"
|
||||
OpName %65 "GLF_live4i"
|
||||
OpName %75 "GLF_live4_looplimiter5"
|
||||
OpName %87 "GLF_live7m42"
|
||||
OpName %95 "GLF_live7m33"
|
||||
OpName %100 "GLF_live7cols"
|
||||
OpName %109 "GLF_live7_looplimiter3"
|
||||
OpName %117 "GLF_live7rows"
|
||||
OpName %125 "GLF_live7_looplimiter2"
|
||||
OpName %133 "GLF_live7_looplimiter1"
|
||||
OpName %134 "GLF_live7c"
|
||||
OpName %150 "GLF_live7r"
|
||||
OpName %158 "GLF_live7_looplimiter0"
|
||||
OpName %181 "buf0"
|
||||
OpMemberName %181 0 "injectionSwitch"
|
||||
OpName %183 ""
|
||||
OpName %214 "GLF_live7sum_index"
|
||||
OpName %215 "GLF_live7_looplimiter7"
|
||||
OpName %216 "GLF_live7cols"
|
||||
OpName %231 "GLF_live7rows"
|
||||
OpName %235 "GLF_live7sums"
|
||||
OpName %245 "GLF_live7c"
|
||||
OpName %253 "GLF_live7r"
|
||||
OpName %284 "indexable"
|
||||
OpName %323 "position"
|
||||
OpName %326 "gl_FragCoord"
|
||||
OpName %329 "param"
|
||||
OpName %332 "param"
|
||||
OpName %335 "i"
|
||||
OpName %344 "param"
|
||||
OpName %350 "_GLF_color"
|
||||
OpDecorate %65 RelaxedPrecision
|
||||
OpDecorate %72 RelaxedPrecision
|
||||
OpDecorate %75 RelaxedPrecision
|
||||
OpDecorate %76 RelaxedPrecision
|
||||
OpDecorate %82 RelaxedPrecision
|
||||
OpDecorate %84 RelaxedPrecision
|
||||
OpDecorate %100 RelaxedPrecision
|
||||
OpDecorate %107 RelaxedPrecision
|
||||
OpDecorate %109 RelaxedPrecision
|
||||
OpDecorate %110 RelaxedPrecision
|
||||
OpDecorate %115 RelaxedPrecision
|
||||
OpDecorate %116 RelaxedPrecision
|
||||
OpDecorate %117 RelaxedPrecision
|
||||
OpDecorate %123 RelaxedPrecision
|
||||
OpDecorate %125 RelaxedPrecision
|
||||
OpDecorate %126 RelaxedPrecision
|
||||
OpDecorate %131 RelaxedPrecision
|
||||
OpDecorate %132 RelaxedPrecision
|
||||
OpDecorate %133 RelaxedPrecision
|
||||
OpDecorate %134 RelaxedPrecision
|
||||
OpDecorate %140 RelaxedPrecision
|
||||
OpDecorate %143 RelaxedPrecision
|
||||
OpDecorate %148 RelaxedPrecision
|
||||
OpDecorate %149 RelaxedPrecision
|
||||
OpDecorate %150 RelaxedPrecision
|
||||
OpDecorate %156 RelaxedPrecision
|
||||
OpDecorate %158 RelaxedPrecision
|
||||
OpDecorate %159 RelaxedPrecision
|
||||
OpDecorate %164 RelaxedPrecision
|
||||
OpDecorate %165 RelaxedPrecision
|
||||
OpDecorate %166 RelaxedPrecision
|
||||
OpDecorate %168 RelaxedPrecision
|
||||
OpDecorate %171 RelaxedPrecision
|
||||
OpDecorate %173 RelaxedPrecision
|
||||
OpDecorate %175 RelaxedPrecision
|
||||
OpDecorate %178 RelaxedPrecision
|
||||
OpMemberDecorate %181 0 Offset 0
|
||||
OpDecorate %181 Block
|
||||
OpDecorate %183 DescriptorSet 0
|
||||
OpDecorate %183 Binding 0
|
||||
OpDecorate %191 RelaxedPrecision
|
||||
OpDecorate %193 RelaxedPrecision
|
||||
OpDecorate %196 RelaxedPrecision
|
||||
OpDecorate %198 RelaxedPrecision
|
||||
OpDecorate %200 RelaxedPrecision
|
||||
OpDecorate %203 RelaxedPrecision
|
||||
OpDecorate %206 RelaxedPrecision
|
||||
OpDecorate %207 RelaxedPrecision
|
||||
OpDecorate %208 RelaxedPrecision
|
||||
OpDecorate %209 RelaxedPrecision
|
||||
OpDecorate %210 RelaxedPrecision
|
||||
OpDecorate %211 RelaxedPrecision
|
||||
OpDecorate %212 RelaxedPrecision
|
||||
OpDecorate %213 RelaxedPrecision
|
||||
OpDecorate %214 RelaxedPrecision
|
||||
OpDecorate %215 RelaxedPrecision
|
||||
OpDecorate %216 RelaxedPrecision
|
||||
OpDecorate %222 RelaxedPrecision
|
||||
OpDecorate %224 RelaxedPrecision
|
||||
OpDecorate %229 RelaxedPrecision
|
||||
OpDecorate %230 RelaxedPrecision
|
||||
OpDecorate %231 RelaxedPrecision
|
||||
OpDecorate %236 RelaxedPrecision
|
||||
OpDecorate %238 RelaxedPrecision
|
||||
OpDecorate %242 RelaxedPrecision
|
||||
OpDecorate %245 RelaxedPrecision
|
||||
OpDecorate %251 RelaxedPrecision
|
||||
OpDecorate %253 RelaxedPrecision
|
||||
OpDecorate %259 RelaxedPrecision
|
||||
OpDecorate %260 RelaxedPrecision
|
||||
OpDecorate %262 RelaxedPrecision
|
||||
OpDecorate %264 RelaxedPrecision
|
||||
OpDecorate %267 RelaxedPrecision
|
||||
OpDecorate %271 RelaxedPrecision
|
||||
OpDecorate %281 RelaxedPrecision
|
||||
OpDecorate %291 RelaxedPrecision
|
||||
OpDecorate %293 RelaxedPrecision
|
||||
OpDecorate %296 RelaxedPrecision
|
||||
OpDecorate %298 RelaxedPrecision
|
||||
OpDecorate %305 RelaxedPrecision
|
||||
OpDecorate %306 RelaxedPrecision
|
||||
OpDecorate %307 RelaxedPrecision
|
||||
OpDecorate %308 RelaxedPrecision
|
||||
OpDecorate %309 RelaxedPrecision
|
||||
OpDecorate %310 RelaxedPrecision
|
||||
OpDecorate %311 RelaxedPrecision
|
||||
OpDecorate %312 RelaxedPrecision
|
||||
OpDecorate %313 RelaxedPrecision
|
||||
OpDecorate %314 RelaxedPrecision
|
||||
OpDecorate %326 BuiltIn FragCoord
|
||||
OpDecorate %335 RelaxedPrecision
|
||||
OpDecorate %342 RelaxedPrecision
|
||||
OpDecorate %347 RelaxedPrecision
|
||||
OpDecorate %348 RelaxedPrecision
|
||||
OpDecorate %350 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%9 = OpTypeVector %6 3
|
||||
%10 = OpTypeFunction %9 %8
|
||||
%14 = OpTypeBool
|
||||
%15 = OpTypePointer Function %14
|
||||
%17 = OpTypeInt 32 0
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpTypePointer Function %6
|
||||
%22 = OpConstant %6 1
|
||||
%27 = OpConstantComposite %9 %22 %22 %22
|
||||
%30 = OpConstant %17 1
|
||||
%63 = OpTypeInt 32 1
|
||||
%64 = OpTypePointer Function %63
|
||||
%66 = OpConstant %63 0
|
||||
%73 = OpConstant %63 4
|
||||
%77 = OpConstant %63 7
|
||||
%83 = OpConstant %63 1
|
||||
%85 = OpTypeMatrix %7 4
|
||||
%86 = OpTypePointer Function %85
|
||||
%88 = OpConstant %6 0
|
||||
%89 = OpConstantComposite %7 %22 %88
|
||||
%90 = OpConstantComposite %7 %88 %22
|
||||
%91 = OpConstantComposite %7 %88 %88
|
||||
%92 = OpConstantComposite %85 %89 %90 %91 %89
|
||||
%93 = OpTypeMatrix %9 3
|
||||
%94 = OpTypePointer Function %93
|
||||
%96 = OpConstantComposite %9 %22 %88 %88
|
||||
%97 = OpConstantComposite %9 %88 %22 %88
|
||||
%98 = OpConstantComposite %9 %88 %88 %22
|
||||
%99 = OpConstantComposite %93 %96 %97 %98
|
||||
%101 = OpConstant %63 2
|
||||
%141 = OpConstant %63 3
|
||||
%181 = OpTypeStruct %7
|
||||
%182 = OpTypePointer Uniform %181
|
||||
%183 = OpVariable %182 Uniform
|
||||
%184 = OpTypePointer Uniform %6
|
||||
%232 = OpConstant %17 9
|
||||
%233 = OpTypeArray %6 %232
|
||||
%234 = OpTypePointer Function %233
|
||||
%239 = OpConstant %63 9
|
||||
%319 = OpConstant %6 2
|
||||
%324 = OpTypeVector %6 4
|
||||
%325 = OpTypePointer Input %324
|
||||
%326 = OpVariable %325 Input
|
||||
%336 = OpConstant %63 25
|
||||
%349 = OpTypePointer Output %324
|
||||
%350 = OpVariable %349 Output
|
||||
%351 = OpConstantComposite %324 %22 %88 %88 %22
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%323 = OpVariable %8 Function
|
||||
%329 = OpVariable %8 Function
|
||||
%332 = OpVariable %8 Function
|
||||
%335 = OpVariable %64 Function
|
||||
%344 = OpVariable %8 Function
|
||||
%317 = OpAccessChain %184 %183 %66 %18
|
||||
%318 = OpLoad %6 %317
|
||||
%320 = OpFOrdGreaterThanEqual %14 %318 %319
|
||||
OpSelectionMerge %322 None
|
||||
OpBranchConditional %320 %321 %322
|
||||
%321 = OpLabel
|
||||
%327 = OpLoad %324 %326
|
||||
%328 = OpVectorShuffle %7 %327 %327 0 1
|
||||
OpStore %323 %328
|
||||
%330 = OpLoad %7 %323
|
||||
OpStore %329 %330
|
||||
%331 = OpFunctionCall %9 %12 %329
|
||||
%333 = OpLoad %7 %323
|
||||
OpStore %332 %333
|
||||
%334 = OpFunctionCall %9 %12 %332
|
||||
OpStore %335 %336
|
||||
OpBranch %337
|
||||
%337 = OpLabel
|
||||
OpLoopMerge %339 %340 None
|
||||
OpBranch %341
|
||||
%341 = OpLabel
|
||||
%342 = OpLoad %63 %335
|
||||
%343 = OpSGreaterThan %14 %342 %66
|
||||
OpBranchConditional %343 %338 %339
|
||||
%338 = OpLabel
|
||||
%345 = OpLoad %7 %323
|
||||
OpStore %344 %345
|
||||
%346 = OpFunctionCall %9 %12 %344
|
||||
OpBranch %340
|
||||
%340 = OpLabel
|
||||
%347 = OpLoad %63 %335
|
||||
%348 = OpISub %63 %347 %83
|
||||
OpStore %335 %348
|
||||
OpBranch %337
|
||||
%339 = OpLabel
|
||||
OpBranch %322
|
||||
%322 = OpLabel
|
||||
OpStore %350 %351
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%12 = OpFunction %9 None %10
|
||||
%11 = OpFunctionParameter %8
|
||||
%13 = OpLabel
|
||||
%16 = OpVariable %15 Function
|
||||
%29 = OpVariable %15 Function
|
||||
%38 = OpVariable %15 Function
|
||||
%46 = OpVariable %15 Function
|
||||
%54 = OpVariable %15 Function
|
||||
%65 = OpVariable %64 Function
|
||||
%75 = OpVariable %64 Function
|
||||
%87 = OpVariable %86 Function
|
||||
%95 = OpVariable %94 Function
|
||||
%100 = OpVariable %64 Function
|
||||
%109 = OpVariable %64 Function
|
||||
%117 = OpVariable %64 Function
|
||||
%125 = OpVariable %64 Function
|
||||
%133 = OpVariable %64 Function
|
||||
%134 = OpVariable %64 Function
|
||||
%150 = OpVariable %64 Function
|
||||
%158 = OpVariable %64 Function
|
||||
%214 = OpVariable %64 Function
|
||||
%215 = OpVariable %64 Function
|
||||
%216 = OpVariable %64 Function
|
||||
%231 = OpVariable %64 Function
|
||||
%235 = OpVariable %234 Function
|
||||
%245 = OpVariable %64 Function
|
||||
%253 = OpVariable %64 Function
|
||||
%273 = OpVariable %64 Function
|
||||
%284 = OpVariable %94 Function
|
||||
%20 = OpAccessChain %19 %11 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpFOrdGreaterThan %14 %21 %22
|
||||
OpStore %16 %23
|
||||
%24 = OpLoad %14 %16
|
||||
OpSelectionMerge %26 None
|
||||
OpBranchConditional %24 %25 %26
|
||||
%25 = OpLabel
|
||||
OpReturnValue %27
|
||||
%26 = OpLabel
|
||||
%31 = OpAccessChain %19 %11 %30
|
||||
%32 = OpLoad %6 %31
|
||||
%33 = OpFOrdLessThan %14 %32 %22
|
||||
OpStore %29 %33
|
||||
%34 = OpLoad %14 %29
|
||||
OpSelectionMerge %36 None
|
||||
OpBranchConditional %34 %35 %36
|
||||
%35 = OpLabel
|
||||
OpReturnValue %27
|
||||
%36 = OpLabel
|
||||
%39 = OpAccessChain %19 %11 %30
|
||||
%40 = OpLoad %6 %39
|
||||
%41 = OpFOrdGreaterThan %14 %40 %22
|
||||
OpStore %38 %41
|
||||
%42 = OpLoad %14 %38
|
||||
OpSelectionMerge %44 None
|
||||
OpBranchConditional %42 %43 %44
|
||||
%43 = OpLabel
|
||||
OpReturnValue %27
|
||||
%44 = OpLabel
|
||||
%47 = OpAccessChain %19 %11 %18
|
||||
%48 = OpLoad %6 %47
|
||||
%49 = OpFOrdLessThan %14 %48 %22
|
||||
OpStore %46 %49
|
||||
%50 = OpLoad %14 %46
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %50 %51 %52
|
||||
%51 = OpLabel
|
||||
OpReturnValue %27
|
||||
%52 = OpLabel
|
||||
%55 = OpAccessChain %19 %11 %18
|
||||
%56 = OpLoad %6 %55
|
||||
%57 = OpFAdd %6 %56 %22
|
||||
%58 = OpFOrdGreaterThan %14 %57 %22
|
||||
OpStore %54 %58
|
||||
%59 = OpLoad %14 %54
|
||||
OpSelectionMerge %61 None
|
||||
OpBranchConditional %59 %60 %61
|
||||
%60 = OpLabel
|
||||
OpReturnValue %27
|
||||
%61 = OpLabel
|
||||
OpStore %65 %66
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
OpLoopMerge %69 %70 None
|
||||
OpBranch %71
|
||||
%71 = OpLabel
|
||||
%72 = OpLoad %63 %65
|
||||
%74 = OpSLessThan %14 %72 %73
|
||||
OpBranchConditional %74 %68 %69
|
||||
%68 = OpLabel
|
||||
%76 = OpLoad %63 %75
|
||||
%78 = OpSGreaterThanEqual %14 %76 %77
|
||||
OpSelectionMerge %80 None
|
||||
OpBranchConditional %78 %79 %80
|
||||
%79 = OpLabel
|
||||
OpBranch %69
|
||||
%80 = OpLabel
|
||||
%82 = OpLoad %63 %75
|
||||
%84 = OpIAdd %63 %82 %83
|
||||
OpStore %75 %84
|
||||
OpStore %87 %92
|
||||
OpStore %95 %99
|
||||
OpStore %100 %101
|
||||
OpBranch %102
|
||||
%102 = OpLabel
|
||||
OpLoopMerge %104 %105 None
|
||||
OpBranch %106
|
||||
%106 = OpLabel
|
||||
%107 = OpLoad %63 %100
|
||||
%108 = OpSLessThan %14 %107 %73
|
||||
OpBranchConditional %108 %103 %104
|
||||
%103 = OpLabel
|
||||
%110 = OpLoad %63 %109
|
||||
%111 = OpSGreaterThanEqual %14 %110 %77
|
||||
OpSelectionMerge %113 None
|
||||
OpBranchConditional %111 %112 %113
|
||||
%112 = OpLabel
|
||||
OpBranch %104
|
||||
%113 = OpLabel
|
||||
%115 = OpLoad %63 %109
|
||||
%116 = OpIAdd %63 %115 %83
|
||||
OpStore %109 %116
|
||||
OpStore %117 %101
|
||||
OpBranch %118
|
||||
%118 = OpLabel
|
||||
OpLoopMerge %120 %121 None
|
||||
OpBranch %122
|
||||
%122 = OpLabel
|
||||
%123 = OpLoad %63 %117
|
||||
%124 = OpSLessThan %14 %123 %73
|
||||
OpBranchConditional %124 %119 %120
|
||||
%119 = OpLabel
|
||||
%126 = OpLoad %63 %125
|
||||
%127 = OpSGreaterThanEqual %14 %126 %77
|
||||
OpSelectionMerge %129 None
|
||||
OpBranchConditional %127 %128 %129
|
||||
%128 = OpLabel
|
||||
OpBranch %120
|
||||
%129 = OpLabel
|
||||
%131 = OpLoad %63 %125
|
||||
%132 = OpIAdd %63 %131 %83
|
||||
OpStore %125 %132
|
||||
OpStore %133 %66
|
||||
OpStore %134 %66
|
||||
OpBranch %135
|
||||
%135 = OpLabel
|
||||
OpLoopMerge %137 %138 None
|
||||
OpBranch %139
|
||||
%139 = OpLabel
|
||||
%140 = OpLoad %63 %134
|
||||
%142 = OpSLessThan %14 %140 %141
|
||||
OpBranchConditional %142 %136 %137
|
||||
%136 = OpLabel
|
||||
%143 = OpLoad %63 %133
|
||||
%144 = OpSGreaterThanEqual %14 %143 %77
|
||||
OpSelectionMerge %146 None
|
||||
OpBranchConditional %144 %145 %146
|
||||
%145 = OpLabel
|
||||
OpBranch %137
|
||||
%146 = OpLabel
|
||||
%148 = OpLoad %63 %133
|
||||
%149 = OpIAdd %63 %148 %83
|
||||
OpStore %133 %149
|
||||
OpStore %150 %66
|
||||
OpBranch %151
|
||||
%151 = OpLabel
|
||||
OpLoopMerge %153 %154 None
|
||||
OpBranch %155
|
||||
%155 = OpLabel
|
||||
%156 = OpLoad %63 %150
|
||||
%157 = OpSLessThan %14 %156 %101
|
||||
OpBranchConditional %157 %152 %153
|
||||
%152 = OpLabel
|
||||
%159 = OpLoad %63 %158
|
||||
%160 = OpSGreaterThanEqual %14 %159 %77
|
||||
OpSelectionMerge %162 None
|
||||
OpBranchConditional %160 %161 %162
|
||||
%161 = OpLabel
|
||||
OpBranch %153
|
||||
%162 = OpLabel
|
||||
%164 = OpLoad %63 %158
|
||||
%165 = OpIAdd %63 %164 %83
|
||||
OpStore %158 %165
|
||||
%166 = OpLoad %63 %134
|
||||
%167 = OpSGreaterThanEqual %14 %166 %66
|
||||
%168 = OpLoad %63 %134
|
||||
%169 = OpSLessThan %14 %168 %141
|
||||
%170 = OpLogicalAnd %14 %167 %169
|
||||
%171 = OpLoad %63 %134
|
||||
%172 = OpSelect %63 %170 %171 %66
|
||||
%173 = OpLoad %63 %150
|
||||
%174 = OpSGreaterThanEqual %14 %173 %66
|
||||
%175 = OpLoad %63 %150
|
||||
%176 = OpSLessThan %14 %175 %141
|
||||
%177 = OpLogicalAnd %14 %174 %176
|
||||
%178 = OpLoad %63 %150
|
||||
%179 = OpSelect %63 %177 %178 %66
|
||||
%180 = OpAccessChain %19 %95 %172 %179
|
||||
OpStore %180 %22
|
||||
%185 = OpAccessChain %184 %183 %66 %30
|
||||
%186 = OpLoad %6 %185
|
||||
%187 = OpFOrdGreaterThan %14 %88 %186
|
||||
OpSelectionMerge %189 None
|
||||
OpBranchConditional %187 %188 %190
|
||||
%188 = OpLabel
|
||||
OpBranch %189
|
||||
%190 = OpLabel
|
||||
%191 = OpLoad %63 %134
|
||||
%192 = OpSGreaterThanEqual %14 %191 %66
|
||||
%193 = OpLoad %63 %134
|
||||
%194 = OpSLessThan %14 %193 %73
|
||||
%195 = OpLogicalAnd %14 %192 %194
|
||||
%196 = OpLoad %63 %134
|
||||
%197 = OpSelect %63 %195 %196 %66
|
||||
%198 = OpLoad %63 %150
|
||||
%199 = OpSGreaterThanEqual %14 %198 %66
|
||||
%200 = OpLoad %63 %150
|
||||
%201 = OpSLessThan %14 %200 %101
|
||||
%202 = OpLogicalAnd %14 %199 %201
|
||||
%203 = OpLoad %63 %150
|
||||
%204 = OpSelect %63 %202 %203 %66
|
||||
%205 = OpAccessChain %19 %87 %197 %204
|
||||
OpStore %205 %22
|
||||
OpBranch %189
|
||||
%189 = OpLabel
|
||||
OpBranch %154
|
||||
%154 = OpLabel
|
||||
%206 = OpLoad %63 %150
|
||||
%207 = OpIAdd %63 %206 %83
|
||||
OpStore %150 %207
|
||||
OpBranch %151
|
||||
%153 = OpLabel
|
||||
OpBranch %138
|
||||
%138 = OpLabel
|
||||
%208 = OpLoad %63 %134
|
||||
%209 = OpIAdd %63 %208 %83
|
||||
OpStore %134 %209
|
||||
OpBranch %135
|
||||
%137 = OpLabel
|
||||
OpBranch %121
|
||||
%121 = OpLabel
|
||||
%210 = OpLoad %63 %117
|
||||
%211 = OpIAdd %63 %210 %83
|
||||
OpStore %117 %211
|
||||
OpBranch %118
|
||||
%120 = OpLabel
|
||||
OpBranch %105
|
||||
%105 = OpLabel
|
||||
%212 = OpLoad %63 %100
|
||||
%213 = OpIAdd %63 %212 %83
|
||||
OpStore %100 %213
|
||||
OpBranch %102
|
||||
%104 = OpLabel
|
||||
OpStore %214 %66
|
||||
OpStore %215 %66
|
||||
OpStore %216 %101
|
||||
OpBranch %217
|
||||
%217 = OpLabel
|
||||
OpLoopMerge %219 %220 None
|
||||
OpBranch %221
|
||||
%221 = OpLabel
|
||||
%222 = OpLoad %63 %216
|
||||
%223 = OpSLessThan %14 %222 %73
|
||||
OpBranchConditional %223 %218 %219
|
||||
%218 = OpLabel
|
||||
%224 = OpLoad %63 %215
|
||||
%225 = OpSGreaterThanEqual %14 %224 %77
|
||||
OpSelectionMerge %227 None
|
||||
OpBranchConditional %225 %226 %227
|
||||
%226 = OpLabel
|
||||
OpBranch %219
|
||||
%227 = OpLabel
|
||||
%229 = OpLoad %63 %215
|
||||
%230 = OpIAdd %63 %229 %83
|
||||
OpStore %215 %230
|
||||
OpStore %231 %101
|
||||
%236 = OpLoad %63 %214
|
||||
%237 = OpSGreaterThanEqual %14 %236 %66
|
||||
%238 = OpLoad %63 %214
|
||||
%240 = OpSLessThan %14 %238 %239
|
||||
%241 = OpLogicalAnd %14 %237 %240
|
||||
%242 = OpLoad %63 %214
|
||||
%243 = OpSelect %63 %241 %242 %66
|
||||
%244 = OpAccessChain %19 %235 %243
|
||||
OpStore %244 %88
|
||||
OpStore %245 %66
|
||||
OpBranch %246
|
||||
%246 = OpLabel
|
||||
OpLoopMerge %248 %249 None
|
||||
OpBranch %250
|
||||
%250 = OpLabel
|
||||
%251 = OpLoad %63 %245
|
||||
%252 = OpSLessThan %14 %251 %83
|
||||
OpBranchConditional %252 %247 %248
|
||||
%247 = OpLabel
|
||||
OpStore %253 %66
|
||||
OpBranch %254
|
||||
%254 = OpLabel
|
||||
OpLoopMerge %256 %257 None
|
||||
OpBranch %258
|
||||
%258 = OpLabel
|
||||
%259 = OpLoad %63 %253
|
||||
%260 = OpLoad %63 %231
|
||||
%261 = OpSLessThan %14 %259 %260
|
||||
OpBranchConditional %261 %255 %256
|
||||
%255 = OpLabel
|
||||
%262 = OpLoad %63 %214
|
||||
%263 = OpSGreaterThanEqual %14 %262 %66
|
||||
%264 = OpLoad %63 %214
|
||||
%265 = OpSLessThan %14 %264 %239
|
||||
%266 = OpLogicalAnd %14 %263 %265
|
||||
%267 = OpLoad %63 %214
|
||||
%268 = OpSelect %63 %266 %267 %66
|
||||
%269 = OpLoad %93 %95
|
||||
%270 = OpTranspose %93 %269
|
||||
%271 = OpLoad %63 %245
|
||||
%272 = OpSLessThan %14 %271 %141
|
||||
OpSelectionMerge %275 None
|
||||
OpBranchConditional %272 %274 %276
|
||||
%274 = OpLabel
|
||||
OpStore %273 %83
|
||||
OpBranch %275
|
||||
%276 = OpLabel
|
||||
%277 = OpAccessChain %184 %183 %66 %18
|
||||
%278 = OpLoad %6 %277
|
||||
%279 = OpConvertFToS %63 %278
|
||||
OpStore %273 %279
|
||||
OpBranch %275
|
||||
%275 = OpLabel
|
||||
%280 = OpLoad %63 %273
|
||||
%281 = OpLoad %63 %253
|
||||
%282 = OpSLessThan %14 %281 %141
|
||||
%283 = OpSelect %63 %282 %83 %66
|
||||
OpStore %284 %270
|
||||
%285 = OpAccessChain %19 %284 %280 %283
|
||||
%286 = OpLoad %6 %285
|
||||
%287 = OpAccessChain %19 %235 %268
|
||||
%288 = OpLoad %6 %287
|
||||
%289 = OpFAdd %6 %288 %286
|
||||
%290 = OpAccessChain %19 %235 %268
|
||||
OpStore %290 %289
|
||||
%291 = OpLoad %63 %214
|
||||
%292 = OpSGreaterThanEqual %14 %291 %66
|
||||
%293 = OpLoad %63 %214
|
||||
%294 = OpSLessThan %14 %293 %239
|
||||
%295 = OpLogicalAnd %14 %292 %294
|
||||
%296 = OpLoad %63 %214
|
||||
%297 = OpSelect %63 %295 %296 %66
|
||||
%298 = OpLoad %63 %253
|
||||
%299 = OpAccessChain %19 %87 %83 %298
|
||||
%300 = OpLoad %6 %299
|
||||
%301 = OpAccessChain %19 %235 %297
|
||||
%302 = OpLoad %6 %301
|
||||
%303 = OpFAdd %6 %302 %300
|
||||
%304 = OpAccessChain %19 %235 %297
|
||||
OpStore %304 %303
|
||||
OpBranch %257
|
||||
%257 = OpLabel
|
||||
%305 = OpLoad %63 %253
|
||||
%306 = OpIAdd %63 %305 %83
|
||||
OpStore %253 %306
|
||||
OpBranch %254
|
||||
%256 = OpLabel
|
||||
OpBranch %249
|
||||
%249 = OpLabel
|
||||
%307 = OpLoad %63 %245
|
||||
%308 = OpIAdd %63 %307 %83
|
||||
OpStore %245 %308
|
||||
OpBranch %246
|
||||
%248 = OpLabel
|
||||
%309 = OpLoad %63 %214
|
||||
%310 = OpIAdd %63 %309 %83
|
||||
OpStore %214 %310
|
||||
OpBranch %220
|
||||
%220 = OpLabel
|
||||
%311 = OpLoad %63 %216
|
||||
%312 = OpIAdd %63 %311 %83
|
||||
OpStore %216 %312
|
||||
OpBranch %217
|
||||
%219 = OpLabel
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
%313 = OpLoad %63 %65
|
||||
%314 = OpIAdd %63 %313 %83
|
||||
OpStore %65 %314
|
||||
OpBranch %67
|
||||
%69 = OpLabel
|
||||
OpReturnValue %27
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,242 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2018 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 bug found by GraphicsFuzz.
|
||||
|
||||
# A fragment shader with somewhat complex control flow and a switch.
|
||||
# Derived from the following GLSL fragment shader.
|
||||
# We check that all pixels are red. The test passes because the final
|
||||
# statement writes red to _GLF_color and there are no discard statements.
|
||||
|
||||
# #version 310 es
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0 {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# layout(location=0) out vec4 _GLF_color;
|
||||
#
|
||||
# struct S {
|
||||
# bool ok;
|
||||
# };
|
||||
#
|
||||
# bool g()
|
||||
# {
|
||||
# for(
|
||||
# int i = 0;
|
||||
# i < 1;
|
||||
# i++
|
||||
# )
|
||||
# {
|
||||
# switch(int(injectionSwitch.x))
|
||||
# {
|
||||
# case 9:
|
||||
# S a = S(bool(injectionSwitch.x));
|
||||
# S b = a;
|
||||
# case 42:
|
||||
# if(b.ok)
|
||||
# {
|
||||
# return true;
|
||||
# }
|
||||
# default:
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
# return true;
|
||||
# }
|
||||
# vec3 f()
|
||||
# {
|
||||
# {
|
||||
# S a = S(bool(injectionSwitch.x));
|
||||
# if(a.ok)
|
||||
# {
|
||||
# return vec3(0.0);
|
||||
# }
|
||||
# if(g())
|
||||
# {
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# }
|
||||
# return vec3(1.0);
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(f(), 1.0);
|
||||
# // always true at runtime
|
||||
# if (injectionSwitch.x == 0.0) {
|
||||
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# }
|
||||
# }
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 73
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %2 "main" %3
|
||||
OpExecutionMode %2 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %2 "main"
|
||||
OpName %4 "buf0"
|
||||
OpMemberName %4 0 "injectionSwitch"
|
||||
OpName %5 ""
|
||||
OpName %3 "_GLF_color"
|
||||
OpMemberDecorate %4 0 Offset 0
|
||||
OpDecorate %4 Block
|
||||
OpDecorate %5 DescriptorSet 0
|
||||
OpDecorate %5 Binding 0
|
||||
OpDecorate %3 Location 0
|
||||
%6 = OpTypeVoid
|
||||
%7 = OpTypeFunction %6
|
||||
%8 = OpTypeBool
|
||||
%9 = OpTypeFloat 32
|
||||
%10 = OpTypeVector %9 3
|
||||
%11 = OpTypeInt 32 1
|
||||
%12 = OpConstant %11 0
|
||||
%13 = OpConstant %11 1
|
||||
%14 = OpTypeVector %9 2
|
||||
%4 = OpTypeStruct %14
|
||||
%15 = OpTypePointer Uniform %4
|
||||
%5 = OpVariable %15 Uniform
|
||||
%16 = OpTypeInt 32 0
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpTypePointer Uniform %9
|
||||
%19 = OpConstant %9 0
|
||||
%20 = OpConstantTrue %8
|
||||
%21 = OpConstantComposite %10 %19 %19 %19
|
||||
%22 = OpConstant %9 1
|
||||
%23 = OpConstantComposite %10 %22 %22 %22
|
||||
%24 = OpTypeVector %9 4
|
||||
%25 = OpTypePointer Output %24
|
||||
%3 = OpVariable %25 Output
|
||||
%26 = OpConstantComposite %24 %22 %19 %19 %22
|
||||
%27 = OpConstantFalse %8
|
||||
%28 = OpUndef %8
|
||||
%2 = OpFunction %6 None %7
|
||||
%29 = OpLabel
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpAccessChain %18 %5 %12 %17
|
||||
%35 = OpLoad %9 %34
|
||||
%36 = OpFOrdNotEqual %8 %35 %19
|
||||
OpSelectionMerge %37 None
|
||||
OpBranchConditional %36 %38 %37
|
||||
%38 = OpLabel
|
||||
OpBranch %31
|
||||
%37 = OpLabel
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
OpLoopMerge %40 %41 None
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%43 = OpPhi %8 %28 %39 %44 %72
|
||||
%46 = OpPhi %11 %12 %39 %47 %72
|
||||
%48 = OpSLessThan %8 %46 %13
|
||||
OpLoopMerge %49 %72 None
|
||||
OpBranchConditional %48 %50 %49
|
||||
%50 = OpLabel
|
||||
%51 = OpConvertFToS %11 %35
|
||||
OpSelectionMerge %52 None
|
||||
OpSwitch %51 %45 9 %53 42 %54
|
||||
%52 = OpLabel
|
||||
OpBranch %72
|
||||
%45 = OpLabel
|
||||
%44 = OpPhi %8 %43 %50 %55 %56
|
||||
%47 = OpIAdd %11 %46 %13
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
OpBranch %42
|
||||
%53 = OpLabel
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%55 = OpPhi %8 %43 %50 %36 %53
|
||||
OpSelectionMerge %56 None
|
||||
OpBranchConditional %55 %57 %56
|
||||
%57 = OpLabel
|
||||
OpBranch %49
|
||||
%56 = OpLabel
|
||||
OpBranch %45
|
||||
%49 = OpLabel
|
||||
%58 = OpPhi %8 %28 %42 %20 %57
|
||||
%59 = OpPhi %8 %27 %42 %20 %57
|
||||
OpSelectionMerge %60 None
|
||||
OpBranchConditional %59 %40 %60
|
||||
%60 = OpLabel
|
||||
OpBranch %40
|
||||
%41 = OpLabel
|
||||
OpBranch %39
|
||||
%40 = OpLabel
|
||||
%61 = OpPhi %8 %58 %49 %20 %60
|
||||
OpSelectionMerge %62 None
|
||||
OpBranchConditional %61 %63 %62
|
||||
%63 = OpLabel
|
||||
OpBranch %31
|
||||
%62 = OpLabel
|
||||
OpBranch %31
|
||||
%32 = OpLabel
|
||||
OpBranch %30
|
||||
%31 = OpLabel
|
||||
%64 = OpPhi %10 %21 %38 %23 %63 %23 %62
|
||||
%65 = OpCompositeExtract %9 %64 0
|
||||
%66 = OpCompositeExtract %9 %64 1
|
||||
%67 = OpCompositeExtract %9 %64 2
|
||||
%68 = OpCompositeConstruct %24 %65 %66 %67 %22
|
||||
OpStore %3 %68
|
||||
%69 = OpFOrdEqual %8 %35 %19
|
||||
OpSelectionMerge %70 None
|
||||
OpBranchConditional %69 %71 %70
|
||||
%71 = OpLabel
|
||||
OpStore %3 %26
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,348 @@
|
||||
#!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.
|
||||
|
||||
DEVICE_EXTENSION VK_KHR_shader_terminate_invocation
|
||||
|
||||
# A test for a bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: Cosh returns inf for one component which is never used
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float zero;
|
||||
# };
|
||||
#
|
||||
# // Returns 3.0 if b > 1, otherwise returns 5.0.
|
||||
# float func(int b)
|
||||
# {
|
||||
# for (int ndx = 0; ndx < 2; ndx++)
|
||||
# {
|
||||
# // Always false.
|
||||
# if (gl_FragCoord.x < 0.0)
|
||||
# {
|
||||
# for (int i = 0; i < 2; i++)
|
||||
# {
|
||||
# // Always false.
|
||||
# if (int(cosh(vec2(1, 800)).x) <= 1)
|
||||
# discard;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# if (b > 1)
|
||||
# return 3.0;
|
||||
#
|
||||
# // Always false.
|
||||
# if (gl_FragCoord.x < 0.0)
|
||||
# _GLF_color = vec4(0);
|
||||
#
|
||||
# return 5.0;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(1);
|
||||
# float f = 0.0;
|
||||
#
|
||||
# do
|
||||
# {
|
||||
# // Always false.
|
||||
# if (int(_GLF_color.y) < 0)
|
||||
# discard;
|
||||
# else
|
||||
# f = func(int(zero)); // f == 5.0
|
||||
#
|
||||
# // Always false.
|
||||
# if (int(_GLF_color.y) > 65)
|
||||
# discard;
|
||||
#
|
||||
# for (int x = 0; x < int(zero) + 1; x++)
|
||||
# {
|
||||
# f = func(x + 10); // f == 3.0
|
||||
# }
|
||||
#
|
||||
# } while (int(zero) > 1); // Always false.
|
||||
#
|
||||
# if (f == 3.0)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 140
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %26 %72
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "func(i1;"
|
||||
OpName %10 "b"
|
||||
OpName %13 "ndx"
|
||||
OpName %26 "gl_FragCoord"
|
||||
OpName %36 "i"
|
||||
OpName %72 "_GLF_color"
|
||||
OpName %79 "f"
|
||||
OpName %94 "buf0"
|
||||
OpMemberName %94 0 "zero"
|
||||
OpName %96 ""
|
||||
OpName %101 "param"
|
||||
OpName %111 "x"
|
||||
OpName %126 "param"
|
||||
OpDecorate %26 BuiltIn FragCoord
|
||||
OpDecorate %72 Location 0
|
||||
OpMemberDecorate %94 0 Offset 0
|
||||
OpDecorate %94 Block
|
||||
OpDecorate %96 DescriptorSet 0
|
||||
OpDecorate %96 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%8 = OpTypeFloat 32
|
||||
%9 = OpTypeFunction %8 %7
|
||||
%14 = OpConstant %6 0
|
||||
%21 = OpConstant %6 2
|
||||
%22 = OpTypeBool
|
||||
%24 = OpTypeVector %8 4
|
||||
%25 = OpTypePointer Input %24
|
||||
%26 = OpVariable %25 Input
|
||||
%27 = OpTypeInt 32 0
|
||||
%28 = OpConstant %27 0
|
||||
%29 = OpTypePointer Input %8
|
||||
%32 = OpConstant %8 0
|
||||
%44 = OpTypeVector %8 2
|
||||
%45 = OpConstant %8 1
|
||||
%46 = OpConstant %8 800
|
||||
%47 = OpConstantComposite %44 %45 %46
|
||||
%51 = OpConstant %6 1
|
||||
%64 = OpConstant %8 3
|
||||
%71 = OpTypePointer Output %24
|
||||
%72 = OpVariable %71 Output
|
||||
%73 = OpConstantComposite %24 %32 %32 %32 %32
|
||||
%74 = OpConstant %8 5
|
||||
%77 = OpConstantComposite %24 %45 %45 %45 %45
|
||||
%78 = OpTypePointer Function %8
|
||||
%84 = OpConstant %27 1
|
||||
%85 = OpTypePointer Output %8
|
||||
%94 = OpTypeStruct %8
|
||||
%95 = OpTypePointer Uniform %94
|
||||
%96 = OpVariable %95 Uniform
|
||||
%97 = OpTypePointer Uniform %8
|
||||
%106 = OpConstant %6 65
|
||||
%124 = OpConstant %6 10
|
||||
%138 = OpConstantComposite %24 %45 %32 %32 %45
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%79 = OpVariable %78 Function
|
||||
%101 = OpVariable %7 Function
|
||||
%111 = OpVariable %7 Function
|
||||
%126 = OpVariable %7 Function
|
||||
OpStore %72 %77
|
||||
OpStore %79 %32
|
||||
OpBranch %80
|
||||
%80 = OpLabel
|
||||
OpLoopMerge %82 %83 None
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
%86 = OpAccessChain %85 %72 %84
|
||||
%87 = OpLoad %8 %86
|
||||
%88 = OpConvertFToS %6 %87
|
||||
%89 = OpSLessThan %22 %88 %14
|
||||
OpSelectionMerge %91 None
|
||||
OpBranchConditional %89 %90 %93
|
||||
%90 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%93 = OpLabel
|
||||
%98 = OpAccessChain %97 %96 %14
|
||||
%99 = OpLoad %8 %98
|
||||
%100 = OpConvertFToS %6 %99
|
||||
OpStore %101 %100
|
||||
%102 = OpFunctionCall %8 %11 %101
|
||||
OpStore %79 %102
|
||||
OpBranch %91
|
||||
%91 = OpLabel
|
||||
%103 = OpAccessChain %85 %72 %84
|
||||
%104 = OpLoad %8 %103
|
||||
%105 = OpConvertFToS %6 %104
|
||||
%107 = OpSGreaterThan %22 %105 %106
|
||||
OpSelectionMerge %109 None
|
||||
OpBranchConditional %107 %108 %109
|
||||
%108 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%109 = OpLabel
|
||||
OpStore %111 %14
|
||||
OpBranch %112
|
||||
%112 = OpLabel
|
||||
OpLoopMerge %114 %115 None
|
||||
OpBranch %116
|
||||
%116 = OpLabel
|
||||
%117 = OpLoad %6 %111
|
||||
%118 = OpAccessChain %97 %96 %14
|
||||
%119 = OpLoad %8 %118
|
||||
%120 = OpConvertFToS %6 %119
|
||||
%121 = OpIAdd %6 %120 %51
|
||||
%122 = OpSLessThan %22 %117 %121
|
||||
OpBranchConditional %122 %113 %114
|
||||
%113 = OpLabel
|
||||
%123 = OpLoad %6 %111
|
||||
%125 = OpIAdd %6 %123 %124
|
||||
OpStore %126 %125
|
||||
%127 = OpFunctionCall %8 %11 %126
|
||||
OpStore %79 %127
|
||||
OpBranch %115
|
||||
%115 = OpLabel
|
||||
%128 = OpLoad %6 %111
|
||||
%129 = OpIAdd %6 %128 %51
|
||||
OpStore %111 %129
|
||||
OpBranch %112
|
||||
%114 = OpLabel
|
||||
OpBranch %83
|
||||
%83 = OpLabel
|
||||
%130 = OpAccessChain %97 %96 %14
|
||||
%131 = OpLoad %8 %130
|
||||
%132 = OpConvertFToS %6 %131
|
||||
%133 = OpSGreaterThan %22 %132 %51
|
||||
OpBranchConditional %133 %80 %82
|
||||
%82 = OpLabel
|
||||
%134 = OpLoad %8 %79
|
||||
%135 = OpFOrdEqual %22 %134 %64
|
||||
OpSelectionMerge %137 None
|
||||
OpBranchConditional %135 %136 %139
|
||||
%136 = OpLabel
|
||||
OpStore %72 %138
|
||||
OpBranch %137
|
||||
%139 = OpLabel
|
||||
OpStore %72 %73
|
||||
OpBranch %137
|
||||
%137 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %8 None %9
|
||||
%10 = OpFunctionParameter %7
|
||||
%12 = OpLabel
|
||||
%13 = OpVariable %7 Function
|
||||
%36 = OpVariable %7 Function
|
||||
OpStore %13 %14
|
||||
OpBranch %15
|
||||
%15 = OpLabel
|
||||
OpLoopMerge %17 %18 None
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
%20 = OpLoad %6 %13
|
||||
%23 = OpSLessThan %22 %20 %21
|
||||
OpBranchConditional %23 %16 %17
|
||||
%16 = OpLabel
|
||||
%30 = OpAccessChain %29 %26 %28
|
||||
%31 = OpLoad %8 %30
|
||||
%33 = OpFOrdLessThan %22 %31 %32
|
||||
OpSelectionMerge %35 None
|
||||
OpBranchConditional %33 %34 %35
|
||||
%34 = OpLabel
|
||||
OpStore %36 %14
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpLoopMerge %39 %40 None
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%42 = OpLoad %6 %36
|
||||
%43 = OpSLessThan %22 %42 %21
|
||||
OpBranchConditional %43 %38 %39
|
||||
%38 = OpLabel
|
||||
%48 = OpExtInst %44 %1 Cosh %47
|
||||
%49 = OpCompositeExtract %8 %48 0
|
||||
%50 = OpConvertFToS %6 %49
|
||||
%52 = OpSLessThanEqual %22 %50 %51
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %52 %53 %54
|
||||
%53 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%54 = OpLabel
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%56 = OpLoad %6 %36
|
||||
%57 = OpIAdd %6 %56 %51
|
||||
OpStore %36 %57
|
||||
OpBranch %37
|
||||
%39 = OpLabel
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
%58 = OpLoad %6 %13
|
||||
%59 = OpIAdd %6 %58 %51
|
||||
OpStore %13 %59
|
||||
OpBranch %15
|
||||
%17 = OpLabel
|
||||
%60 = OpLoad %6 %10
|
||||
%61 = OpSGreaterThan %22 %60 %51
|
||||
OpSelectionMerge %63 None
|
||||
OpBranchConditional %61 %62 %63
|
||||
%62 = OpLabel
|
||||
OpReturnValue %64
|
||||
%63 = OpLabel
|
||||
%66 = OpAccessChain %29 %26 %28
|
||||
%67 = OpLoad %8 %66
|
||||
%68 = OpFOrdLessThan %22 %67 %32
|
||||
OpSelectionMerge %70 None
|
||||
OpBranchConditional %68 %69 %70
|
||||
%69 = OpLabel
|
||||
OpStore %72 %73
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
OpReturnValue %74
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE float DATA
|
||||
0.0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,239 @@
|
||||
#!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: Covers instruction combine casting, combine shifting and DAG 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 310 es
|
||||
# #define _int_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _int_2 _GLF_uniform_int_values[2]
|
||||
# #define _float_2_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [2.0, 1.0, 0.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1, 2]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int numbers[3];
|
||||
# numbers[_int_0] = _int_0;
|
||||
# numbers[_int_1] = _int_1;
|
||||
# numbers[_int_2] = _int_2;
|
||||
#
|
||||
# vec2 a = vec2(_int_0, numbers[((0.0 < _float_0_0) ? 1 : 2)]);
|
||||
# float b = dot(a, vec2(_float_1_0, _float_1_0));
|
||||
#
|
||||
# if (b == _float_2_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; 8
|
||||
; Bound: 94
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %75
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "numbers"
|
||||
OpName %13 "buf1"
|
||||
OpMemberName %13 0 "_GLF_uniform_int_values"
|
||||
OpName %15 ""
|
||||
OpName %39 "a"
|
||||
OpName %45 "buf0"
|
||||
OpMemberName %45 0 "_GLF_uniform_float_values"
|
||||
OpName %47 ""
|
||||
OpName %59 "b"
|
||||
OpName %75 "_GLF_color"
|
||||
OpDecorate %12 ArrayStride 16
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 1
|
||||
OpDecorate %44 ArrayStride 16
|
||||
OpMemberDecorate %45 0 Offset 0
|
||||
OpDecorate %45 Block
|
||||
OpDecorate %47 DescriptorSet 0
|
||||
OpDecorate %47 Binding 0
|
||||
OpDecorate %75 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 3
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpTypeArray %6 %8
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpConstant %6 0
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%22 = OpTypePointer Function %6
|
||||
%24 = OpConstant %6 1
|
||||
%30 = OpConstant %6 2
|
||||
%36 = OpTypeFloat 32
|
||||
%37 = OpTypeVector %36 2
|
||||
%38 = OpTypePointer Function %37
|
||||
%43 = OpConstant %36 0
|
||||
%44 = OpTypeArray %36 %8
|
||||
%45 = OpTypeStruct %44
|
||||
%46 = OpTypePointer Uniform %45
|
||||
%47 = OpVariable %46 Uniform
|
||||
%48 = OpTypePointer Uniform %36
|
||||
%51 = OpTypeBool
|
||||
%58 = OpTypePointer Function %36
|
||||
%73 = OpTypeVector %36 4
|
||||
%74 = OpTypePointer Output %73
|
||||
%75 = OpVariable %74 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%39 = OpVariable %38 Function
|
||||
%59 = OpVariable %58 Function
|
||||
%18 = OpAccessChain %17 %15 %16 %16
|
||||
%19 = OpLoad %6 %18
|
||||
%20 = OpAccessChain %17 %15 %16 %16
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpAccessChain %22 %11 %19
|
||||
OpStore %23 %21
|
||||
%25 = OpAccessChain %17 %15 %16 %24
|
||||
%26 = OpLoad %6 %25
|
||||
%27 = OpAccessChain %17 %15 %16 %24
|
||||
%28 = OpLoad %6 %27
|
||||
%29 = OpAccessChain %22 %11 %26
|
||||
OpStore %29 %28
|
||||
%31 = OpAccessChain %17 %15 %16 %30
|
||||
%32 = OpLoad %6 %31
|
||||
%33 = OpAccessChain %17 %15 %16 %30
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpAccessChain %22 %11 %32
|
||||
OpStore %35 %34
|
||||
%40 = OpAccessChain %17 %15 %16 %16
|
||||
%41 = OpLoad %6 %40
|
||||
%42 = OpConvertSToF %36 %41
|
||||
%49 = OpAccessChain %48 %47 %16 %30
|
||||
%50 = OpLoad %36 %49
|
||||
%52 = OpFOrdLessThan %51 %43 %50
|
||||
%53 = OpSelect %6 %52 %24 %30
|
||||
%54 = OpAccessChain %22 %11 %53
|
||||
%55 = OpLoad %6 %54
|
||||
%56 = OpConvertSToF %36 %55
|
||||
%57 = OpCompositeConstruct %37 %42 %56
|
||||
OpStore %39 %57
|
||||
%60 = OpLoad %37 %39
|
||||
%61 = OpAccessChain %48 %47 %16 %24
|
||||
%62 = OpLoad %36 %61
|
||||
%63 = OpAccessChain %48 %47 %16 %24
|
||||
%64 = OpLoad %36 %63
|
||||
%65 = OpCompositeConstruct %37 %62 %64
|
||||
%66 = OpDot %36 %60 %65
|
||||
OpStore %59 %66
|
||||
%67 = OpLoad %36 %59
|
||||
%68 = OpAccessChain %48 %47 %16 %16
|
||||
%69 = OpLoad %36 %68
|
||||
%70 = OpFOrdEqual %51 %67 %69
|
||||
OpSelectionMerge %72 None
|
||||
OpBranchConditional %70 %71 %89
|
||||
%71 = OpLabel
|
||||
%76 = OpAccessChain %17 %15 %16 %24
|
||||
%77 = OpLoad %6 %76
|
||||
%78 = OpConvertSToF %36 %77
|
||||
%79 = OpAccessChain %17 %15 %16 %16
|
||||
%80 = OpLoad %6 %79
|
||||
%81 = OpConvertSToF %36 %80
|
||||
%82 = OpAccessChain %17 %15 %16 %16
|
||||
%83 = OpLoad %6 %82
|
||||
%84 = OpConvertSToF %36 %83
|
||||
%85 = OpAccessChain %17 %15 %16 %24
|
||||
%86 = OpLoad %6 %85
|
||||
%87 = OpConvertSToF %36 %86
|
||||
%88 = OpCompositeConstruct %73 %78 %81 %84 %87
|
||||
OpStore %75 %88
|
||||
OpBranch %72
|
||||
%89 = OpLabel
|
||||
%90 = OpAccessChain %17 %15 %16 %16
|
||||
%91 = OpLoad %6 %90
|
||||
%92 = OpConvertSToF %36 %91
|
||||
%93 = OpCompositeConstruct %73 %92 %92 %92 %92
|
||||
OpStore %75 %93
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1 2
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
2.0 1.0 0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,219 @@
|
||||
#!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.
|
||||
|
||||
DEVICE_EXTENSION VK_KHR_shader_terminate_invocation
|
||||
|
||||
# A test for a coverage-gap found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific LLVM analysis code path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int zero;
|
||||
# };
|
||||
#
|
||||
# // Always returns 5.0.
|
||||
# float func()
|
||||
# {
|
||||
# float s = 2.0;
|
||||
#
|
||||
# for(int i = 0; i < (zero + 1); i++)
|
||||
# {
|
||||
# s += 3.0;
|
||||
#
|
||||
# for (int j = 0; j < 10; j++)
|
||||
# {
|
||||
# if (zero == 1) // Always false.
|
||||
# discard;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# return s;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 c = vec4(func(), 0, 0, 1);
|
||||
#
|
||||
# if (func() == 5.0)
|
||||
# _GLF_color = c;
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 75
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %71
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "func("
|
||||
OpName %11 "s"
|
||||
OpName %15 "i"
|
||||
OpName %23 "buf0"
|
||||
OpMemberName %23 0 "zero"
|
||||
OpName %25 ""
|
||||
OpName %36 "j"
|
||||
OpName %60 "c"
|
||||
OpName %71 "_GLF_color"
|
||||
OpMemberDecorate %23 0 Offset 0
|
||||
OpDecorate %23 Block
|
||||
OpDecorate %25 DescriptorSet 0
|
||||
OpDecorate %25 Binding 0
|
||||
OpDecorate %71 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeFunction %6
|
||||
%10 = OpTypePointer Function %6
|
||||
%12 = OpConstant %6 2
|
||||
%13 = OpTypeInt 32 1
|
||||
%14 = OpTypePointer Function %13
|
||||
%16 = OpConstant %13 0
|
||||
%23 = OpTypeStruct %13
|
||||
%24 = OpTypePointer Uniform %23
|
||||
%25 = OpVariable %24 Uniform
|
||||
%26 = OpTypePointer Uniform %13
|
||||
%29 = OpConstant %13 1
|
||||
%31 = OpTypeBool
|
||||
%33 = OpConstant %6 3
|
||||
%43 = OpConstant %13 10
|
||||
%58 = OpTypeVector %6 4
|
||||
%59 = OpTypePointer Function %58
|
||||
%62 = OpConstant %6 0
|
||||
%63 = OpConstant %6 1
|
||||
%66 = OpConstant %6 5
|
||||
%70 = OpTypePointer Output %58
|
||||
%71 = OpVariable %70 Output
|
||||
%74 = OpConstantComposite %58 %62 %62 %62 %62
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%60 = OpVariable %59 Function
|
||||
%61 = OpFunctionCall %6 %8
|
||||
%64 = OpCompositeConstruct %58 %61 %62 %62 %63
|
||||
OpStore %60 %64
|
||||
%65 = OpFunctionCall %6 %8
|
||||
%67 = OpFOrdEqual %31 %65 %66
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %67 %68 %73
|
||||
%68 = OpLabel
|
||||
%72 = OpLoad %58 %60
|
||||
OpStore %71 %72
|
||||
OpBranch %69
|
||||
%73 = OpLabel
|
||||
OpStore %71 %74
|
||||
OpBranch %69
|
||||
%69 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%8 = OpFunction %6 None %7
|
||||
%9 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%15 = OpVariable %14 Function
|
||||
%36 = OpVariable %14 Function
|
||||
OpStore %11 %12
|
||||
OpStore %15 %16
|
||||
OpBranch %17
|
||||
%17 = OpLabel
|
||||
OpLoopMerge %19 %20 None
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
%22 = OpLoad %13 %15
|
||||
%27 = OpAccessChain %26 %25 %16
|
||||
%28 = OpLoad %13 %27
|
||||
%30 = OpIAdd %13 %28 %29
|
||||
%32 = OpSLessThan %31 %22 %30
|
||||
OpBranchConditional %32 %18 %19
|
||||
%18 = OpLabel
|
||||
%34 = OpLoad %6 %11
|
||||
%35 = OpFAdd %6 %34 %33
|
||||
OpStore %11 %35
|
||||
OpStore %36 %16
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpLoopMerge %39 %40 None
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%42 = OpLoad %13 %36
|
||||
%44 = OpSLessThan %31 %42 %43
|
||||
OpBranchConditional %44 %38 %39
|
||||
%38 = OpLabel
|
||||
%45 = OpAccessChain %26 %25 %16
|
||||
%46 = OpLoad %13 %45
|
||||
%47 = OpIEqual %31 %46 %29
|
||||
OpSelectionMerge %49 None
|
||||
OpBranchConditional %47 %48 %49
|
||||
%48 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%49 = OpLabel
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%51 = OpLoad %13 %36
|
||||
%52 = OpIAdd %13 %51 %29
|
||||
OpStore %36 %52
|
||||
OpBranch %37
|
||||
%39 = OpLabel
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%53 = OpLoad %13 %15
|
||||
%54 = OpIAdd %13 %53 %29
|
||||
OpStore %15 %54
|
||||
OpBranch %17
|
||||
%19 = OpLabel
|
||||
%55 = OpLoad %6 %11
|
||||
OpReturnValue %55
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE int32 DATA
|
||||
0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,228 @@
|
||||
#!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 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_1 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_4 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_256_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_float_values: [0.4, 1.0, 256.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always false.
|
||||
# if(gl_FragCoord.y < _float_0_4)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_0);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# // gl_FragCoord has the decimal part of 0.5. If we name the integer part
|
||||
# // of gl_FragCoord (X, Y) it can be expressed as (X + 0.5, Y + 0.5).
|
||||
# //
|
||||
# // The value of v is calculated as follows:
|
||||
# // v = ((X + 0.5, Y + 0.5) - (1.0, 0.4)) * 256
|
||||
# // = (X - 1 + 0.5, Y + 0.5 - 0.4) * 256
|
||||
# // = (X - 0.5, Y + 0.1) * 256
|
||||
# // = (X * 256 - 128, Y * 256 + 25.6)
|
||||
# //
|
||||
# // X * 256 is always an even number, and substracting 128 still keeps it even.
|
||||
# // Y * 256 is always and even number, but adding 25.6 (and converting to an integer)
|
||||
# // makes it always odd.
|
||||
# ivec2 v = ivec2((gl_FragCoord.xy - vec2(_float_1_0, _float_0_4)) * _float_256_0);
|
||||
#
|
||||
# // v.x is even and v.y is odd. We substract one from v.y making it even too.
|
||||
# // Doing a bitwise AND with an even number always resuls in zero.
|
||||
# _GLF_color = vec4(_float_1_0, (v.y - _int_1) & _int_1, v.x & _int_1, _float_1_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: 82
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9 %30
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "gl_FragCoord"
|
||||
OpName %17 "buf1"
|
||||
OpMemberName %17 0 "_GLF_uniform_float_values"
|
||||
OpName %19 ""
|
||||
OpName %30 "_GLF_color"
|
||||
OpName %33 "buf0"
|
||||
OpMemberName %33 0 "_GLF_uniform_int_values"
|
||||
OpName %35 ""
|
||||
OpName %44 "v"
|
||||
OpDecorate %9 BuiltIn FragCoord
|
||||
OpDecorate %16 ArrayStride 16
|
||||
OpMemberDecorate %17 0 Offset 0
|
||||
OpDecorate %17 Block
|
||||
OpDecorate %19 DescriptorSet 0
|
||||
OpDecorate %19 Binding 1
|
||||
OpDecorate %30 Location 0
|
||||
OpDecorate %32 ArrayStride 16
|
||||
OpMemberDecorate %33 0 Offset 0
|
||||
OpDecorate %33 Block
|
||||
OpDecorate %35 DescriptorSet 0
|
||||
OpDecorate %35 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Input %7
|
||||
%9 = OpVariable %8 Input
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 1
|
||||
%12 = OpTypePointer Input %6
|
||||
%15 = OpConstant %10 3
|
||||
%16 = OpTypeArray %6 %15
|
||||
%17 = OpTypeStruct %16
|
||||
%18 = OpTypePointer Uniform %17
|
||||
%19 = OpVariable %18 Uniform
|
||||
%20 = OpTypeInt 32 1
|
||||
%21 = OpConstant %20 0
|
||||
%22 = OpTypePointer Uniform %6
|
||||
%25 = OpTypeBool
|
||||
%29 = OpTypePointer Output %7
|
||||
%30 = OpVariable %29 Output
|
||||
%31 = OpConstant %10 2
|
||||
%32 = OpTypeArray %20 %31
|
||||
%33 = OpTypeStruct %32
|
||||
%34 = OpTypePointer Uniform %33
|
||||
%35 = OpVariable %34 Uniform
|
||||
%36 = OpTypePointer Uniform %20
|
||||
%42 = OpTypeVector %20 2
|
||||
%43 = OpTypePointer Function %42
|
||||
%45 = OpTypeVector %6 2
|
||||
%48 = OpConstant %20 1
|
||||
%55 = OpConstant %20 2
|
||||
%62 = OpTypePointer Function %20
|
||||
%72 = OpConstant %10 0
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%44 = OpVariable %43 Function
|
||||
%13 = OpAccessChain %12 %9 %11
|
||||
%14 = OpLoad %6 %13
|
||||
%23 = OpAccessChain %22 %19 %21 %21
|
||||
%24 = OpLoad %6 %23
|
||||
%26 = OpFOrdLessThan %25 %14 %24
|
||||
OpSelectionMerge %28 None
|
||||
OpBranchConditional %26 %27 %41
|
||||
%27 = OpLabel
|
||||
%37 = OpAccessChain %36 %35 %21 %21
|
||||
%38 = OpLoad %20 %37
|
||||
%39 = OpConvertSToF %6 %38
|
||||
%40 = OpCompositeConstruct %7 %39 %39 %39 %39
|
||||
OpStore %30 %40
|
||||
OpBranch %28
|
||||
%41 = OpLabel
|
||||
%46 = OpLoad %7 %9
|
||||
%47 = OpVectorShuffle %45 %46 %46 0 1
|
||||
%49 = OpAccessChain %22 %19 %21 %48
|
||||
%50 = OpLoad %6 %49
|
||||
%51 = OpAccessChain %22 %19 %21 %21
|
||||
%52 = OpLoad %6 %51
|
||||
%53 = OpCompositeConstruct %45 %50 %52
|
||||
%54 = OpFSub %45 %47 %53
|
||||
%56 = OpAccessChain %22 %19 %21 %55
|
||||
%57 = OpLoad %6 %56
|
||||
%58 = OpVectorTimesScalar %45 %54 %57
|
||||
%59 = OpConvertFToS %42 %58
|
||||
OpStore %44 %59
|
||||
%60 = OpAccessChain %22 %19 %21 %48
|
||||
%61 = OpLoad %6 %60
|
||||
%63 = OpAccessChain %62 %44 %11
|
||||
%64 = OpLoad %20 %63
|
||||
%65 = OpAccessChain %36 %35 %21 %48
|
||||
%66 = OpLoad %20 %65
|
||||
%67 = OpISub %20 %64 %66
|
||||
%68 = OpAccessChain %36 %35 %21 %48
|
||||
%69 = OpLoad %20 %68
|
||||
%70 = OpBitwiseAnd %20 %67 %69
|
||||
%71 = OpConvertSToF %6 %70
|
||||
%73 = OpAccessChain %62 %44 %72
|
||||
%74 = OpLoad %20 %73
|
||||
%75 = OpAccessChain %36 %35 %21 %48
|
||||
%76 = OpLoad %20 %75
|
||||
%77 = OpBitwiseAnd %20 %74 %76
|
||||
%78 = OpConvertSToF %6 %77
|
||||
%79 = OpAccessChain %22 %19 %21 %48
|
||||
%80 = OpLoad %6 %79
|
||||
%81 = OpCompositeConstruct %7 %61 %71 %78 %80
|
||||
OpStore %30 %81
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.4 1.0 256.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
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
|
||||
@@ -0,0 +1,148 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific AP float code path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int two;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec2 v = acos(ldexp(vec2(0.1), ivec2(two, 3)));
|
||||
# float d = distance(v, vec2(1.15928, 0.64350));
|
||||
#
|
||||
# if (d < 0.01)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %40
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "v"
|
||||
OpName %13 "buf0"
|
||||
OpMemberName %13 0 "two"
|
||||
OpName %15 ""
|
||||
OpName %26 "d"
|
||||
OpName %40 "_GLF_color"
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %40 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpConstant %6 0.100000001
|
||||
%11 = OpConstantComposite %7 %10 %10
|
||||
%12 = OpTypeInt 32 1
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpConstant %12 0
|
||||
%17 = OpTypePointer Uniform %12
|
||||
%20 = OpConstant %12 3
|
||||
%21 = OpTypeVector %12 2
|
||||
%25 = OpTypePointer Function %6
|
||||
%28 = OpConstant %6 1.15927994
|
||||
%29 = OpConstant %6 0.64349997
|
||||
%30 = OpConstantComposite %7 %28 %29
|
||||
%33 = OpConstant %6 0.00999999978
|
||||
%34 = OpTypeBool
|
||||
%38 = OpTypeVector %6 4
|
||||
%39 = OpTypePointer Output %38
|
||||
%40 = OpVariable %39 Output
|
||||
%41 = OpConstant %6 1
|
||||
%42 = OpConstant %6 0
|
||||
%43 = OpConstantComposite %38 %41 %42 %42 %41
|
||||
%45 = OpConstantComposite %38 %42 %42 %42 %42
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%26 = OpVariable %25 Function
|
||||
%18 = OpAccessChain %17 %15 %16
|
||||
%19 = OpLoad %12 %18
|
||||
%22 = OpCompositeConstruct %21 %19 %20
|
||||
%23 = OpExtInst %7 %1 Ldexp %11 %22
|
||||
%24 = OpExtInst %7 %1 Acos %23
|
||||
OpStore %9 %24
|
||||
%27 = OpLoad %7 %9
|
||||
%31 = OpExtInst %6 %1 Distance %27 %30
|
||||
OpStore %26 %31
|
||||
%32 = OpLoad %6 %26
|
||||
%35 = OpFOrdLessThan %34 %32 %33
|
||||
OpSelectionMerge %37 None
|
||||
OpBranchConditional %35 %36 %44
|
||||
%36 = OpLabel
|
||||
OpStore %40 %43
|
||||
OpBranch %37
|
||||
%44 = OpLabel
|
||||
OpStore %40 %45
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# two
|
||||
BUFFER variant_two DATA_TYPE int32 DATA
|
||||
2
|
||||
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_two 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
|
||||
@@ -0,0 +1,225 @@
|
||||
#!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 a specific APFloat code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_100 _GLF_uniform_int_values[1]
|
||||
# #define _int_1 _GLF_uniform_int_values[2]
|
||||
# #define _int_9993001 _GLF_uniform_int_values[3]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 100, 1, 9993001]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Becomes -9993001.
|
||||
# float a = determinant(mat3(1.0, 5000.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2000.0));
|
||||
#
|
||||
# int b = _int_1;
|
||||
#
|
||||
# for (int i = _int_1; i < _int_100; i++)
|
||||
# {
|
||||
# if (b > _int_1)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# b = int(a);
|
||||
# }
|
||||
#
|
||||
# if (b == -_int_9993001)
|
||||
# {
|
||||
# _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: 87
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %68
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %21 "b"
|
||||
OpName %25 "buf0"
|
||||
OpMemberName %25 0 "_GLF_uniform_int_values"
|
||||
OpName %27 ""
|
||||
OpName %33 "i"
|
||||
OpName %68 "_GLF_color"
|
||||
OpDecorate %24 ArrayStride 16
|
||||
OpMemberDecorate %25 0 Offset 0
|
||||
OpDecorate %25 Block
|
||||
OpDecorate %27 DescriptorSet 0
|
||||
OpDecorate %27 Binding 0
|
||||
OpDecorate %68 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeVector %6 3
|
||||
%10 = OpTypeMatrix %9 3
|
||||
%11 = OpConstant %6 1
|
||||
%12 = OpConstant %6 5000
|
||||
%13 = OpConstantComposite %9 %11 %12 %11
|
||||
%14 = OpConstantComposite %9 %11 %11 %11
|
||||
%15 = OpConstant %6 2000
|
||||
%16 = OpConstantComposite %9 %11 %11 %15
|
||||
%17 = OpConstantComposite %10 %13 %14 %16
|
||||
%19 = OpTypeInt 32 1
|
||||
%20 = OpTypePointer Function %19
|
||||
%22 = OpTypeInt 32 0
|
||||
%23 = OpConstant %22 4
|
||||
%24 = OpTypeArray %19 %23
|
||||
%25 = OpTypeStruct %24
|
||||
%26 = OpTypePointer Uniform %25
|
||||
%27 = OpVariable %26 Uniform
|
||||
%28 = OpConstant %19 0
|
||||
%29 = OpConstant %19 2
|
||||
%30 = OpTypePointer Uniform %19
|
||||
%42 = OpConstant %19 1
|
||||
%45 = OpTypeBool
|
||||
%59 = OpConstant %19 3
|
||||
%66 = OpTypeVector %6 4
|
||||
%67 = OpTypePointer Output %66
|
||||
%68 = OpVariable %67 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%21 = OpVariable %20 Function
|
||||
%33 = OpVariable %20 Function
|
||||
%18 = OpExtInst %6 %1 Determinant %17
|
||||
OpStore %8 %18
|
||||
%31 = OpAccessChain %30 %27 %28 %29
|
||||
%32 = OpLoad %19 %31
|
||||
OpStore %21 %32
|
||||
%34 = OpAccessChain %30 %27 %28 %29
|
||||
%35 = OpLoad %19 %34
|
||||
OpStore %33 %35
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
OpLoopMerge %38 %39 None
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%41 = OpLoad %19 %33
|
||||
%43 = OpAccessChain %30 %27 %28 %42
|
||||
%44 = OpLoad %19 %43
|
||||
%46 = OpSLessThan %45 %41 %44
|
||||
OpBranchConditional %46 %37 %38
|
||||
%37 = OpLabel
|
||||
%47 = OpLoad %19 %21
|
||||
%48 = OpAccessChain %30 %27 %28 %29
|
||||
%49 = OpLoad %19 %48
|
||||
%50 = OpSGreaterThan %45 %47 %49
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %50 %51 %52
|
||||
%51 = OpLabel
|
||||
OpBranch %38
|
||||
%52 = OpLabel
|
||||
%54 = OpLoad %6 %8
|
||||
%55 = OpConvertFToS %19 %54
|
||||
OpStore %21 %55
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%56 = OpLoad %19 %33
|
||||
%57 = OpIAdd %19 %56 %42
|
||||
OpStore %33 %57
|
||||
OpBranch %36
|
||||
%38 = OpLabel
|
||||
%58 = OpLoad %19 %21
|
||||
%60 = OpAccessChain %30 %27 %28 %59
|
||||
%61 = OpLoad %19 %60
|
||||
%62 = OpSNegate %19 %61
|
||||
%63 = OpIEqual %45 %58 %62
|
||||
OpSelectionMerge %65 None
|
||||
OpBranchConditional %63 %64 %82
|
||||
%64 = OpLabel
|
||||
%69 = OpAccessChain %30 %27 %28 %29
|
||||
%70 = OpLoad %19 %69
|
||||
%71 = OpConvertSToF %6 %70
|
||||
%72 = OpAccessChain %30 %27 %28 %28
|
||||
%73 = OpLoad %19 %72
|
||||
%74 = OpConvertSToF %6 %73
|
||||
%75 = OpAccessChain %30 %27 %28 %28
|
||||
%76 = OpLoad %19 %75
|
||||
%77 = OpConvertSToF %6 %76
|
||||
%78 = OpAccessChain %30 %27 %28 %29
|
||||
%79 = OpLoad %19 %78
|
||||
%80 = OpConvertSToF %6 %79
|
||||
%81 = OpCompositeConstruct %66 %71 %74 %77 %80
|
||||
OpStore %68 %81
|
||||
OpBranch %65
|
||||
%82 = OpLabel
|
||||
%83 = OpAccessChain %30 %27 %28 %28
|
||||
%84 = OpLoad %19 %83
|
||||
%85 = OpConvertSToF %6 %84
|
||||
%86 = OpCompositeConstruct %66 %85 %85 %85 %85
|
||||
OpStore %68 %86
|
||||
OpBranch %65
|
||||
%65 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 100 1 9993001
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
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 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,169 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific arbitrary precision float usage.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
#
|
||||
# float det1 = determinant(mat4(0, 1, 0, 1,
|
||||
# 1, 1, 1, 2,
|
||||
# 1, 4, 6, 1,
|
||||
# 5, 35, 7, 63));
|
||||
#
|
||||
# float det2 = determinant(mat3(1, 0, 1,
|
||||
# 4, 6, 1,
|
||||
# 35, 7, 63));
|
||||
#
|
||||
# float det3 = determinant(mat3(1, 0, 1,
|
||||
# 1, 1, 2,
|
||||
# 35, 7, 63));
|
||||
#
|
||||
# float det4 = determinant(mat3(1, 0, 1,
|
||||
# 1, 1, 2,
|
||||
# 4, 6, 1));
|
||||
#
|
||||
# float ref = -det2 + det3 - 5.0 * det4;
|
||||
#
|
||||
# if (abs(ref - det1) < 0.1) // Always true.
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 63
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %59
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "det1"
|
||||
OpName %26 "det2"
|
||||
OpName %34 "det3"
|
||||
OpName %38 "det4"
|
||||
OpName %41 "ref"
|
||||
OpName %59 "_GLF_color"
|
||||
OpDecorate %59 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeVector %6 4
|
||||
%10 = OpTypeMatrix %9 4
|
||||
%11 = OpConstant %6 0
|
||||
%12 = OpConstant %6 1
|
||||
%13 = OpConstantComposite %9 %11 %12 %11 %12
|
||||
%14 = OpConstant %6 2
|
||||
%15 = OpConstantComposite %9 %12 %12 %12 %14
|
||||
%16 = OpConstant %6 4
|
||||
%17 = OpConstant %6 6
|
||||
%18 = OpConstantComposite %9 %12 %16 %17 %12
|
||||
%19 = OpConstant %6 5
|
||||
%20 = OpConstant %6 35
|
||||
%21 = OpConstant %6 7
|
||||
%22 = OpConstant %6 63
|
||||
%23 = OpConstantComposite %9 %19 %20 %21 %22
|
||||
%24 = OpConstantComposite %10 %13 %15 %18 %23
|
||||
%27 = OpTypeVector %6 3
|
||||
%28 = OpTypeMatrix %27 3
|
||||
%29 = OpConstantComposite %27 %12 %11 %12
|
||||
%30 = OpConstantComposite %27 %16 %17 %12
|
||||
%31 = OpConstantComposite %27 %20 %21 %22
|
||||
%32 = OpConstantComposite %28 %29 %30 %31
|
||||
%35 = OpConstantComposite %27 %12 %12 %14
|
||||
%36 = OpConstantComposite %28 %29 %35 %31
|
||||
%39 = OpConstantComposite %28 %29 %35 %30
|
||||
%53 = OpConstant %6 0.100000001
|
||||
%54 = OpTypeBool
|
||||
%58 = OpTypePointer Output %9
|
||||
%59 = OpVariable %58 Output
|
||||
%60 = OpConstantComposite %9 %12 %11 %11 %12
|
||||
%62 = OpConstantComposite %9 %11 %11 %11 %11
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%26 = OpVariable %7 Function
|
||||
%34 = OpVariable %7 Function
|
||||
%38 = OpVariable %7 Function
|
||||
%41 = OpVariable %7 Function
|
||||
%25 = OpExtInst %6 %1 Determinant %24
|
||||
OpStore %8 %25
|
||||
%33 = OpExtInst %6 %1 Determinant %32
|
||||
OpStore %26 %33
|
||||
%37 = OpExtInst %6 %1 Determinant %36
|
||||
OpStore %34 %37
|
||||
%40 = OpExtInst %6 %1 Determinant %39
|
||||
OpStore %38 %40
|
||||
%42 = OpLoad %6 %26
|
||||
%43 = OpFNegate %6 %42
|
||||
%44 = OpLoad %6 %34
|
||||
%45 = OpFAdd %6 %43 %44
|
||||
%46 = OpLoad %6 %38
|
||||
%47 = OpFMul %6 %19 %46
|
||||
%48 = OpFSub %6 %45 %47
|
||||
OpStore %41 %48
|
||||
%49 = OpLoad %6 %41
|
||||
%50 = OpLoad %6 %8
|
||||
%51 = OpFSub %6 %49 %50
|
||||
%52 = OpExtInst %6 %1 FAbs %51
|
||||
%55 = OpFOrdLessThan %54 %52 %53
|
||||
OpSelectionMerge %57 None
|
||||
OpBranchConditional %55 %56 %61
|
||||
%56 = OpLabel
|
||||
OpStore %59 %60
|
||||
OpBranch %57
|
||||
%61 = OpLabel
|
||||
OpStore %59 %62
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,251 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_2 _GLF_uniform_int_values[1]
|
||||
# #define _int_3 _GLF_uniform_int_values[2]
|
||||
# #define _int_4 _GLF_uniform_int_values[3]
|
||||
# #define _int_5 _GLF_uniform_int_values[4]
|
||||
# #define _int_6 _GLF_uniform_int_values[5]
|
||||
# #define _int_7 _GLF_uniform_int_values[6]
|
||||
# #define _int_8 _GLF_uniform_int_values[7]
|
||||
# #define _int_0 _GLF_uniform_int_values[8]
|
||||
# #define _also_1 _GLF_uniform_int_values[9]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 2, 3, 4, 5, 6, 7, 8, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[10];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float nan = intBitsToFloat(-1);
|
||||
#
|
||||
# // This results in an undefined value, but not in undefined behavior.
|
||||
# vec4 undefined = mix(vec4(_int_1, _int_2, _int_3, _int_4),
|
||||
# vec4(_int_5, _int_6, _int_7, _int_8), nan);
|
||||
#
|
||||
# if (_int_1 == _also_1 || undefined.x > _float_0_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; 8
|
||||
; Bound: 105
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %85
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "nan"
|
||||
OpName %14 "undefined"
|
||||
OpName %18 "buf1"
|
||||
OpMemberName %18 0 "_GLF_uniform_int_values"
|
||||
OpName %20 ""
|
||||
OpName %74 "buf0"
|
||||
OpMemberName %74 0 "_GLF_uniform_float_values"
|
||||
OpName %76 ""
|
||||
OpName %85 "_GLF_color"
|
||||
OpDecorate %17 ArrayStride 16
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 1
|
||||
OpDecorate %73 ArrayStride 16
|
||||
OpMemberDecorate %74 0 Offset 0
|
||||
OpDecorate %74 Block
|
||||
OpDecorate %76 DescriptorSet 0
|
||||
OpDecorate %76 Binding 0
|
||||
OpDecorate %85 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 1
|
||||
%10 = OpConstant %9 -1
|
||||
%12 = OpTypeVector %6 4
|
||||
%13 = OpTypePointer Function %12
|
||||
%15 = OpTypeInt 32 0
|
||||
%16 = OpConstant %15 10
|
||||
%17 = OpTypeArray %9 %16
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpConstant %9 0
|
||||
%22 = OpTypePointer Uniform %9
|
||||
%26 = OpConstant %9 1
|
||||
%30 = OpConstant %9 2
|
||||
%34 = OpConstant %9 3
|
||||
%39 = OpConstant %9 4
|
||||
%43 = OpConstant %9 5
|
||||
%47 = OpConstant %9 6
|
||||
%51 = OpConstant %9 7
|
||||
%59 = OpTypeBool
|
||||
%62 = OpConstant %9 9
|
||||
%69 = OpConstant %15 0
|
||||
%72 = OpConstant %15 1
|
||||
%73 = OpTypeArray %6 %72
|
||||
%74 = OpTypeStruct %73
|
||||
%75 = OpTypePointer Uniform %74
|
||||
%76 = OpVariable %75 Uniform
|
||||
%77 = OpTypePointer Uniform %6
|
||||
%84 = OpTypePointer Output %12
|
||||
%85 = OpVariable %84 Output
|
||||
%89 = OpConstant %9 8
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%14 = OpVariable %13 Function
|
||||
%11 = OpBitcast %6 %10
|
||||
OpStore %8 %11
|
||||
%23 = OpAccessChain %22 %20 %21 %21
|
||||
%24 = OpLoad %9 %23
|
||||
%25 = OpConvertSToF %6 %24
|
||||
%27 = OpAccessChain %22 %20 %21 %26
|
||||
%28 = OpLoad %9 %27
|
||||
%29 = OpConvertSToF %6 %28
|
||||
%31 = OpAccessChain %22 %20 %21 %30
|
||||
%32 = OpLoad %9 %31
|
||||
%33 = OpConvertSToF %6 %32
|
||||
%35 = OpAccessChain %22 %20 %21 %34
|
||||
%36 = OpLoad %9 %35
|
||||
%37 = OpConvertSToF %6 %36
|
||||
%38 = OpCompositeConstruct %12 %25 %29 %33 %37
|
||||
%40 = OpAccessChain %22 %20 %21 %39
|
||||
%41 = OpLoad %9 %40
|
||||
%42 = OpConvertSToF %6 %41
|
||||
%44 = OpAccessChain %22 %20 %21 %43
|
||||
%45 = OpLoad %9 %44
|
||||
%46 = OpConvertSToF %6 %45
|
||||
%48 = OpAccessChain %22 %20 %21 %47
|
||||
%49 = OpLoad %9 %48
|
||||
%50 = OpConvertSToF %6 %49
|
||||
%52 = OpAccessChain %22 %20 %21 %51
|
||||
%53 = OpLoad %9 %52
|
||||
%54 = OpConvertSToF %6 %53
|
||||
%55 = OpCompositeConstruct %12 %42 %46 %50 %54
|
||||
%56 = OpLoad %6 %8
|
||||
%57 = OpCompositeConstruct %12 %56 %56 %56 %56
|
||||
%58 = OpExtInst %12 %1 FMix %38 %55 %57
|
||||
OpStore %14 %58
|
||||
%60 = OpAccessChain %22 %20 %21 %21
|
||||
%61 = OpLoad %9 %60
|
||||
%63 = OpAccessChain %22 %20 %21 %62
|
||||
%64 = OpLoad %9 %63
|
||||
%65 = OpIEqual %59 %61 %64
|
||||
%66 = OpLogicalNot %59 %65
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %66 %67 %68
|
||||
%67 = OpLabel
|
||||
%70 = OpAccessChain %7 %14 %69
|
||||
%71 = OpLoad %6 %70
|
||||
%78 = OpAccessChain %77 %76 %21 %21
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpFOrdGreaterThan %59 %71 %79
|
||||
OpBranch %68
|
||||
%68 = OpLabel
|
||||
%81 = OpPhi %59 %65 %5 %80 %67
|
||||
OpSelectionMerge %83 None
|
||||
OpBranchConditional %81 %82 %100
|
||||
%82 = OpLabel
|
||||
%86 = OpAccessChain %22 %20 %21 %21
|
||||
%87 = OpLoad %9 %86
|
||||
%88 = OpConvertSToF %6 %87
|
||||
%90 = OpAccessChain %22 %20 %21 %89
|
||||
%91 = OpLoad %9 %90
|
||||
%92 = OpConvertSToF %6 %91
|
||||
%93 = OpAccessChain %22 %20 %21 %89
|
||||
%94 = OpLoad %9 %93
|
||||
%95 = OpConvertSToF %6 %94
|
||||
%96 = OpAccessChain %22 %20 %21 %21
|
||||
%97 = OpLoad %9 %96
|
||||
%98 = OpConvertSToF %6 %97
|
||||
%99 = OpCompositeConstruct %12 %88 %92 %95 %98
|
||||
OpStore %85 %99
|
||||
OpBranch %83
|
||||
%100 = OpLabel
|
||||
%101 = OpAccessChain %22 %20 %21 %89
|
||||
%102 = OpLoad %9 %101
|
||||
%103 = OpConvertSToF %6 %102
|
||||
%104 = OpCompositeConstruct %12 %103 %103 %103 %103
|
||||
OpStore %85 %104
|
||||
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
|
||||
1 2 3 4 5 6 7 8 0 1
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,208 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // This results in an undefined value, but not in undefined behavior.
|
||||
# float undefined = mod(5.0, 0.0);
|
||||
# if (_int_1 == (_int_1 + _int_0) || undefined > _float_0_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; 8
|
||||
; Bound: 68
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %49
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "undefined"
|
||||
OpName %17 "buf1"
|
||||
OpMemberName %17 0 "_GLF_uniform_int_values"
|
||||
OpName %19 ""
|
||||
OpName %37 "buf0"
|
||||
OpMemberName %37 0 "_GLF_uniform_float_values"
|
||||
OpName %39 ""
|
||||
OpName %49 "_GLF_color"
|
||||
OpDecorate %16 ArrayStride 16
|
||||
OpMemberDecorate %17 0 RelaxedPrecision
|
||||
OpMemberDecorate %17 0 Offset 0
|
||||
OpDecorate %17 Block
|
||||
OpDecorate %19 DescriptorSet 0
|
||||
OpDecorate %19 Binding 1
|
||||
OpDecorate %23 RelaxedPrecision
|
||||
OpDecorate %25 RelaxedPrecision
|
||||
OpDecorate %28 RelaxedPrecision
|
||||
OpDecorate %29 RelaxedPrecision
|
||||
OpDecorate %36 ArrayStride 16
|
||||
OpMemberDecorate %37 0 Offset 0
|
||||
OpDecorate %37 Block
|
||||
OpDecorate %39 DescriptorSet 0
|
||||
OpDecorate %39 Binding 0
|
||||
OpDecorate %49 Location 0
|
||||
OpDecorate %51 RelaxedPrecision
|
||||
OpDecorate %54 RelaxedPrecision
|
||||
OpDecorate %57 RelaxedPrecision
|
||||
OpDecorate %60 RelaxedPrecision
|
||||
OpDecorate %65 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 5
|
||||
%10 = OpConstant %6 0
|
||||
%12 = OpTypeBool
|
||||
%13 = OpTypeInt 32 1
|
||||
%14 = OpTypeInt 32 0
|
||||
%15 = OpConstant %14 3
|
||||
%16 = OpTypeArray %13 %15
|
||||
%17 = OpTypeStruct %16
|
||||
%18 = OpTypePointer Uniform %17
|
||||
%19 = OpVariable %18 Uniform
|
||||
%20 = OpConstant %13 0
|
||||
%21 = OpTypePointer Uniform %13
|
||||
%26 = OpConstant %13 1
|
||||
%35 = OpConstant %14 1
|
||||
%36 = OpTypeArray %6 %35
|
||||
%37 = OpTypeStruct %36
|
||||
%38 = OpTypePointer Uniform %37
|
||||
%39 = OpVariable %38 Uniform
|
||||
%40 = OpTypePointer Uniform %6
|
||||
%47 = OpTypeVector %6 4
|
||||
%48 = OpTypePointer Output %47
|
||||
%49 = OpVariable %48 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%11 = OpFMod %6 %9 %10
|
||||
OpStore %8 %11
|
||||
%22 = OpAccessChain %21 %19 %20 %20
|
||||
%23 = OpLoad %13 %22
|
||||
%24 = OpAccessChain %21 %19 %20 %20
|
||||
%25 = OpLoad %13 %24
|
||||
%27 = OpAccessChain %21 %19 %20 %26
|
||||
%28 = OpLoad %13 %27
|
||||
%29 = OpIAdd %13 %25 %28
|
||||
%30 = OpIEqual %12 %23 %29
|
||||
%31 = OpLogicalNot %12 %30
|
||||
OpSelectionMerge %33 None
|
||||
OpBranchConditional %31 %32 %33
|
||||
%32 = OpLabel
|
||||
%34 = OpLoad %6 %8
|
||||
%41 = OpAccessChain %40 %39 %20 %20
|
||||
%42 = OpLoad %6 %41
|
||||
%43 = OpFOrdGreaterThan %12 %34 %42
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%44 = OpPhi %12 %30 %5 %43 %32
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %44 %45 %63
|
||||
%45 = OpLabel
|
||||
%50 = OpAccessChain %21 %19 %20 %20
|
||||
%51 = OpLoad %13 %50
|
||||
%52 = OpConvertSToF %6 %51
|
||||
%53 = OpAccessChain %21 %19 %20 %26
|
||||
%54 = OpLoad %13 %53
|
||||
%55 = OpConvertSToF %6 %54
|
||||
%56 = OpAccessChain %21 %19 %20 %26
|
||||
%57 = OpLoad %13 %56
|
||||
%58 = OpConvertSToF %6 %57
|
||||
%59 = OpAccessChain %21 %19 %20 %20
|
||||
%60 = OpLoad %13 %59
|
||||
%61 = OpConvertSToF %6 %60
|
||||
%62 = OpCompositeConstruct %47 %52 %55 %58 %61
|
||||
OpStore %49 %62
|
||||
OpBranch %46
|
||||
%63 = OpLabel
|
||||
%64 = OpAccessChain %21 %19 %20 %26
|
||||
%65 = OpLoad %13 %64
|
||||
%66 = OpConvertSToF %6 %65
|
||||
%67 = OpCompositeConstruct %47 %66 %66 %66 %66
|
||||
OpStore %49 %67
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,223 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_01 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [0.01, 1.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float f0 = mod(10.0, 0.000001);
|
||||
# float s1 = 0.00000000000000000000000000000000000001;
|
||||
#
|
||||
# if (s1 == 0.0)
|
||||
# s1 = _float_1_0;
|
||||
#
|
||||
# float f1 = mod(10.0, s1);
|
||||
#
|
||||
# // Always true.
|
||||
# if ((f0 > -_float_0_01 && f0 < _float_0_01) || f0 == f1)
|
||||
# _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; 8
|
||||
; Bound: 79
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %55
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "f0"
|
||||
OpName %12 "s1"
|
||||
OpName %23 "buf0"
|
||||
OpMemberName %23 0 "_GLF_uniform_float_values"
|
||||
OpName %25 ""
|
||||
OpName %32 "f1"
|
||||
OpName %55 "_GLF_color"
|
||||
OpName %57 "buf1"
|
||||
OpMemberName %57 0 "_GLF_uniform_int_values"
|
||||
OpName %59 ""
|
||||
OpDecorate %22 ArrayStride 16
|
||||
OpMemberDecorate %23 0 Offset 0
|
||||
OpDecorate %23 Block
|
||||
OpDecorate %25 DescriptorSet 0
|
||||
OpDecorate %25 Binding 0
|
||||
OpDecorate %55 Location 0
|
||||
OpDecorate %56 ArrayStride 16
|
||||
OpMemberDecorate %57 0 Offset 0
|
||||
OpDecorate %57 Block
|
||||
OpDecorate %59 DescriptorSet 0
|
||||
OpDecorate %59 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 10
|
||||
%10 = OpConstant %6 9.99999997e-07
|
||||
%13 = OpConstant %6 0x1.b38fb8p-127
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpTypeBool
|
||||
%20 = OpTypeInt 32 0
|
||||
%21 = OpConstant %20 2
|
||||
%22 = OpTypeArray %6 %21
|
||||
%23 = OpTypeStruct %22
|
||||
%24 = OpTypePointer Uniform %23
|
||||
%25 = OpVariable %24 Uniform
|
||||
%26 = OpTypeInt 32 1
|
||||
%27 = OpConstant %26 0
|
||||
%28 = OpConstant %26 1
|
||||
%29 = OpTypePointer Uniform %6
|
||||
%53 = OpTypeVector %6 4
|
||||
%54 = OpTypePointer Output %53
|
||||
%55 = OpVariable %54 Output
|
||||
%56 = OpTypeArray %26 %21
|
||||
%57 = OpTypeStruct %56
|
||||
%58 = OpTypePointer Uniform %57
|
||||
%59 = OpVariable %58 Uniform
|
||||
%60 = OpTypePointer Uniform %26
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%12 = OpVariable %7 Function
|
||||
%32 = OpVariable %7 Function
|
||||
%11 = OpFMod %6 %9 %10
|
||||
OpStore %8 %11
|
||||
OpStore %12 %13
|
||||
%14 = OpLoad %6 %12
|
||||
%17 = OpFOrdEqual %16 %14 %15
|
||||
OpSelectionMerge %19 None
|
||||
OpBranchConditional %17 %18 %19
|
||||
%18 = OpLabel
|
||||
%30 = OpAccessChain %29 %25 %27 %28
|
||||
%31 = OpLoad %6 %30
|
||||
OpStore %12 %31
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
%33 = OpLoad %6 %12
|
||||
%34 = OpFMod %6 %9 %33
|
||||
OpStore %32 %34
|
||||
%35 = OpLoad %6 %8
|
||||
%36 = OpAccessChain %29 %25 %27 %27
|
||||
%37 = OpLoad %6 %36
|
||||
%38 = OpFNegate %6 %37
|
||||
%39 = OpFOrdGreaterThan %16 %35 %38
|
||||
OpSelectionMerge %41 None
|
||||
OpBranchConditional %39 %40 %41
|
||||
%40 = OpLabel
|
||||
%42 = OpLoad %6 %8
|
||||
%43 = OpAccessChain %29 %25 %27 %27
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpFOrdLessThan %16 %42 %44
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%46 = OpPhi %16 %39 %19 %45 %40
|
||||
%47 = OpLoad %6 %8
|
||||
%48 = OpLoad %6 %32
|
||||
%49 = OpFOrdEqual %16 %47 %48
|
||||
%50 = OpLogicalOr %16 %46 %49
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %50 %51 %74
|
||||
%51 = OpLabel
|
||||
%61 = OpAccessChain %60 %59 %27 %28
|
||||
%62 = OpLoad %26 %61
|
||||
%63 = OpConvertSToF %6 %62
|
||||
%64 = OpAccessChain %60 %59 %27 %27
|
||||
%65 = OpLoad %26 %64
|
||||
%66 = OpConvertSToF %6 %65
|
||||
%67 = OpAccessChain %60 %59 %27 %27
|
||||
%68 = OpLoad %26 %67
|
||||
%69 = OpConvertSToF %6 %68
|
||||
%70 = OpAccessChain %60 %59 %27 %28
|
||||
%71 = OpLoad %26 %70
|
||||
%72 = OpConvertSToF %6 %71
|
||||
%73 = OpCompositeConstruct %53 %63 %66 %69 %72
|
||||
OpStore %55 %73
|
||||
OpBranch %52
|
||||
%74 = OpLabel
|
||||
%75 = OpAccessChain %60 %59 %27 %27
|
||||
%76 = OpLoad %26 %75
|
||||
%77 = OpConvertSToF %6 %76
|
||||
%78 = OpCompositeConstruct %53 %77 %77 %77 %77
|
||||
OpStore %55 %78
|
||||
OpBranch %52
|
||||
%52 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.01 1.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,197 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float edge = determinant(mat3(1));
|
||||
# if (step(edge, vec4(-3.0)) == vec4(_float_0_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; 8
|
||||
; Bound: 69
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %43
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "edge"
|
||||
OpName %27 "buf1"
|
||||
OpMemberName %27 0 "_GLF_uniform_float_values"
|
||||
OpName %29 ""
|
||||
OpName %43 "_GLF_color"
|
||||
OpName %46 "buf0"
|
||||
OpMemberName %46 0 "_GLF_uniform_int_values"
|
||||
OpName %48 ""
|
||||
OpDecorate %26 ArrayStride 16
|
||||
OpMemberDecorate %27 0 Offset 0
|
||||
OpDecorate %27 Block
|
||||
OpDecorate %29 DescriptorSet 0
|
||||
OpDecorate %29 Binding 1
|
||||
OpDecorate %43 Location 0
|
||||
OpDecorate %45 ArrayStride 16
|
||||
OpMemberDecorate %46 0 Offset 0
|
||||
OpDecorate %46 Block
|
||||
OpDecorate %48 DescriptorSet 0
|
||||
OpDecorate %48 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeVector %6 3
|
||||
%10 = OpTypeMatrix %9 3
|
||||
%11 = OpConstant %6 1
|
||||
%12 = OpConstant %6 0
|
||||
%13 = OpConstantComposite %9 %11 %12 %12
|
||||
%14 = OpConstantComposite %9 %12 %11 %12
|
||||
%15 = OpConstantComposite %9 %12 %12 %11
|
||||
%16 = OpConstantComposite %10 %13 %14 %15
|
||||
%19 = OpTypeVector %6 4
|
||||
%20 = OpConstant %6 -3
|
||||
%21 = OpConstantComposite %19 %20 %20 %20 %20
|
||||
%24 = OpTypeInt 32 0
|
||||
%25 = OpConstant %24 1
|
||||
%26 = OpTypeArray %6 %25
|
||||
%27 = OpTypeStruct %26
|
||||
%28 = OpTypePointer Uniform %27
|
||||
%29 = OpVariable %28 Uniform
|
||||
%30 = OpTypeInt 32 1
|
||||
%31 = OpConstant %30 0
|
||||
%32 = OpTypePointer Uniform %6
|
||||
%36 = OpTypeBool
|
||||
%37 = OpTypeVector %36 4
|
||||
%42 = OpTypePointer Output %19
|
||||
%43 = OpVariable %42 Output
|
||||
%44 = OpConstant %24 2
|
||||
%45 = OpTypeArray %30 %44
|
||||
%46 = OpTypeStruct %45
|
||||
%47 = OpTypePointer Uniform %46
|
||||
%48 = OpVariable %47 Uniform
|
||||
%49 = OpTypePointer Uniform %30
|
||||
%53 = OpConstant %30 1
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%17 = OpExtInst %6 %1 Determinant %16
|
||||
OpStore %8 %17
|
||||
%18 = OpLoad %6 %8
|
||||
%22 = OpCompositeConstruct %19 %18 %18 %18 %18
|
||||
%23 = OpExtInst %19 %1 Step %22 %21
|
||||
%33 = OpAccessChain %32 %29 %31 %31
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpCompositeConstruct %19 %34 %34 %34 %34
|
||||
%38 = OpFOrdEqual %37 %23 %35
|
||||
%39 = OpAll %36 %38
|
||||
OpSelectionMerge %41 None
|
||||
OpBranchConditional %39 %40 %64
|
||||
%40 = OpLabel
|
||||
%50 = OpAccessChain %49 %48 %31 %31
|
||||
%51 = OpLoad %30 %50
|
||||
%52 = OpConvertSToF %6 %51
|
||||
%54 = OpAccessChain %49 %48 %31 %53
|
||||
%55 = OpLoad %30 %54
|
||||
%56 = OpConvertSToF %6 %55
|
||||
%57 = OpAccessChain %49 %48 %31 %53
|
||||
%58 = OpLoad %30 %57
|
||||
%59 = OpConvertSToF %6 %58
|
||||
%60 = OpAccessChain %49 %48 %31 %31
|
||||
%61 = OpLoad %30 %60
|
||||
%62 = OpConvertSToF %6 %61
|
||||
%63 = OpCompositeConstruct %19 %52 %56 %59 %62
|
||||
OpStore %43 %63
|
||||
OpBranch %41
|
||||
%64 = OpLabel
|
||||
%65 = OpAccessChain %49 %48 %31 %53
|
||||
%66 = OpLoad %30 %65
|
||||
%67 = OpConvertSToF %6 %66
|
||||
%68 = OpCompositeConstruct %19 %67 %67 %67 %67
|
||||
OpStore %43 %68
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,238 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_768 _GLF_uniform_int_values[2]
|
||||
# #define _int_1792 _GLF_uniform_int_values[3]
|
||||
# #define _int_45056 _GLF_uniform_int_values[4]
|
||||
# #define _float_0_1 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_5 _GLF_uniform_float_values[1]
|
||||
# #define _float_2_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 768, 1792, 45056]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[5];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [0.1, 0.5, 2.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // All components of I are denormalized.
|
||||
# vec4 I = uintBitsToFloat(uvec4(_int_768, _int_1792, _int_45056, 0x16b39));
|
||||
# vec4 N = vec4(_float_0_5);
|
||||
#
|
||||
# // Whether or not denormalized values are supported or flushed to zero,
|
||||
# // the result of "reflect" should match the reference result.
|
||||
# vec4 R = reflect(I, vec4(0.5));
|
||||
# vec4 ref = I - _float_2_0 * dot(N, I) * N;
|
||||
#
|
||||
# if (distance(R, ref) < _float_0_1)
|
||||
# {
|
||||
# _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; 8
|
||||
; Bound: 91
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %72
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "I"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "_GLF_uniform_int_values"
|
||||
OpName %16 ""
|
||||
OpName %35 "N"
|
||||
OpName %38 "buf1"
|
||||
OpMemberName %38 0 "_GLF_uniform_float_values"
|
||||
OpName %40 ""
|
||||
OpName %46 "R"
|
||||
OpName %51 "ref"
|
||||
OpName %72 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpDecorate %37 ArrayStride 16
|
||||
OpMemberDecorate %38 0 Offset 0
|
||||
OpDecorate %38 Block
|
||||
OpDecorate %40 DescriptorSet 0
|
||||
OpDecorate %40 Binding 1
|
||||
OpDecorate %72 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 1
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 5
|
||||
%13 = OpTypeArray %10 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpConstant %10 0
|
||||
%18 = OpConstant %10 2
|
||||
%19 = OpTypePointer Uniform %10
|
||||
%23 = OpConstant %10 3
|
||||
%27 = OpConstant %10 4
|
||||
%31 = OpConstant %11 92985
|
||||
%32 = OpTypeVector %11 4
|
||||
%36 = OpConstant %11 3
|
||||
%37 = OpTypeArray %6 %36
|
||||
%38 = OpTypeStruct %37
|
||||
%39 = OpTypePointer Uniform %38
|
||||
%40 = OpVariable %39 Uniform
|
||||
%41 = OpConstant %10 1
|
||||
%42 = OpTypePointer Uniform %6
|
||||
%48 = OpConstant %6 0.5
|
||||
%49 = OpConstantComposite %7 %48 %48 %48 %48
|
||||
%67 = OpTypeBool
|
||||
%71 = OpTypePointer Output %7
|
||||
%72 = OpVariable %71 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%35 = OpVariable %8 Function
|
||||
%46 = OpVariable %8 Function
|
||||
%51 = OpVariable %8 Function
|
||||
%20 = OpAccessChain %19 %16 %17 %18
|
||||
%21 = OpLoad %10 %20
|
||||
%22 = OpBitcast %11 %21
|
||||
%24 = OpAccessChain %19 %16 %17 %23
|
||||
%25 = OpLoad %10 %24
|
||||
%26 = OpBitcast %11 %25
|
||||
%28 = OpAccessChain %19 %16 %17 %27
|
||||
%29 = OpLoad %10 %28
|
||||
%30 = OpBitcast %11 %29
|
||||
%33 = OpCompositeConstruct %32 %22 %26 %30 %31
|
||||
%34 = OpBitcast %7 %33
|
||||
OpStore %9 %34
|
||||
%43 = OpAccessChain %42 %40 %17 %41
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpCompositeConstruct %7 %44 %44 %44 %44
|
||||
OpStore %35 %45
|
||||
%47 = OpLoad %7 %9
|
||||
%50 = OpExtInst %7 %1 Reflect %47 %49
|
||||
OpStore %46 %50
|
||||
%52 = OpLoad %7 %9
|
||||
%53 = OpAccessChain %42 %40 %17 %18
|
||||
%54 = OpLoad %6 %53
|
||||
%55 = OpLoad %7 %35
|
||||
%56 = OpLoad %7 %9
|
||||
%57 = OpDot %6 %55 %56
|
||||
%58 = OpFMul %6 %54 %57
|
||||
%59 = OpLoad %7 %35
|
||||
%60 = OpVectorTimesScalar %7 %59 %58
|
||||
%61 = OpFSub %7 %52 %60
|
||||
OpStore %51 %61
|
||||
%62 = OpLoad %7 %46
|
||||
%63 = OpLoad %7 %51
|
||||
%64 = OpExtInst %6 %1 Distance %62 %63
|
||||
%65 = OpAccessChain %42 %40 %17 %17
|
||||
%66 = OpLoad %6 %65
|
||||
%68 = OpFOrdLessThan %67 %64 %66
|
||||
OpSelectionMerge %70 None
|
||||
OpBranchConditional %68 %69 %86
|
||||
%69 = OpLabel
|
||||
%73 = OpAccessChain %19 %16 %17 %17
|
||||
%74 = OpLoad %10 %73
|
||||
%75 = OpConvertSToF %6 %74
|
||||
%76 = OpAccessChain %19 %16 %17 %41
|
||||
%77 = OpLoad %10 %76
|
||||
%78 = OpConvertSToF %6 %77
|
||||
%79 = OpAccessChain %19 %16 %17 %41
|
||||
%80 = OpLoad %10 %79
|
||||
%81 = OpConvertSToF %6 %80
|
||||
%82 = OpAccessChain %19 %16 %17 %17
|
||||
%83 = OpLoad %10 %82
|
||||
%84 = OpConvertSToF %6 %83
|
||||
%85 = OpCompositeConstruct %7 %75 %78 %81 %84
|
||||
OpStore %72 %85
|
||||
OpBranch %70
|
||||
%86 = OpLabel
|
||||
%87 = OpAccessChain %19 %16 %17 %41
|
||||
%88 = OpLoad %10 %87
|
||||
%89 = OpConvertSToF %6 %88
|
||||
%90 = OpCompositeConstruct %7 %89 %89 %89 %89
|
||||
OpStore %72 %90
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.1 0.5 2.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 768 1792 45056
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
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 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,206 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // This results in an undefined value, but not in undefined behavior.
|
||||
# float undefined = sinh(log2(-8.9));
|
||||
#
|
||||
# if (1 == _int_1 || undefined > _float_0_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(_int_0);
|
||||
# }
|
||||
# }
|
||||
DEVICE_EXTENSION VK_KHR_shader_float_controls
|
||||
DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 62
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SignedZeroInfNanPreserve
|
||||
OpExtension "SPV_KHR_float_controls"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %43
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpExecutionMode %4 SignedZeroInfNanPreserve 32
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "undefined"
|
||||
OpName %17 "buf0"
|
||||
OpMemberName %17 0 "_GLF_uniform_int_values"
|
||||
OpName %19 ""
|
||||
OpName %31 "buf1"
|
||||
OpMemberName %31 0 "_GLF_uniform_float_values"
|
||||
OpName %33 ""
|
||||
OpName %43 "_GLF_color"
|
||||
OpDecorate %16 ArrayStride 16
|
||||
OpMemberDecorate %17 0 RelaxedPrecision
|
||||
OpMemberDecorate %17 0 Offset 0
|
||||
OpDecorate %17 Block
|
||||
OpDecorate %19 DescriptorSet 0
|
||||
OpDecorate %19 Binding 0
|
||||
OpDecorate %23 RelaxedPrecision
|
||||
OpDecorate %30 ArrayStride 16
|
||||
OpMemberDecorate %31 0 Offset 0
|
||||
OpDecorate %31 Block
|
||||
OpDecorate %33 DescriptorSet 0
|
||||
OpDecorate %33 Binding 1
|
||||
OpDecorate %43 Location 0
|
||||
OpDecorate %45 RelaxedPrecision
|
||||
OpDecorate %48 RelaxedPrecision
|
||||
OpDecorate %51 RelaxedPrecision
|
||||
OpDecorate %54 RelaxedPrecision
|
||||
OpDecorate %59 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 0x1.8p+128
|
||||
%11 = OpTypeBool
|
||||
%12 = OpTypeInt 32 1
|
||||
%13 = OpConstant %12 1
|
||||
%14 = OpTypeInt 32 0
|
||||
%15 = OpConstant %14 2
|
||||
%16 = OpTypeArray %12 %15
|
||||
%17 = OpTypeStruct %16
|
||||
%18 = OpTypePointer Uniform %17
|
||||
%19 = OpVariable %18 Uniform
|
||||
%20 = OpConstant %12 0
|
||||
%21 = OpTypePointer Uniform %12
|
||||
%29 = OpConstant %14 1
|
||||
%30 = OpTypeArray %6 %29
|
||||
%31 = OpTypeStruct %30
|
||||
%32 = OpTypePointer Uniform %31
|
||||
%33 = OpVariable %32 Uniform
|
||||
%34 = OpTypePointer Uniform %6
|
||||
%41 = OpTypeVector %6 4
|
||||
%42 = OpTypePointer Output %41
|
||||
%43 = OpVariable %42 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpExtInst %6 %1 Sinh %9
|
||||
OpStore %8 %10
|
||||
%22 = OpAccessChain %21 %19 %20 %20
|
||||
%23 = OpLoad %12 %22
|
||||
%24 = OpIEqual %11 %13 %23
|
||||
%25 = OpLogicalNot %11 %24
|
||||
OpSelectionMerge %27 None
|
||||
OpBranchConditional %25 %26 %27
|
||||
%26 = OpLabel
|
||||
%28 = OpLoad %6 %8
|
||||
%35 = OpAccessChain %34 %33 %20 %20
|
||||
%36 = OpLoad %6 %35
|
||||
%37 = OpFOrdGreaterThan %11 %28 %36
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
%38 = OpPhi %11 %24 %5 %37 %26
|
||||
OpSelectionMerge %40 None
|
||||
OpBranchConditional %38 %39 %57
|
||||
%39 = OpLabel
|
||||
%44 = OpAccessChain %21 %19 %20 %20
|
||||
%45 = OpLoad %12 %44
|
||||
%46 = OpConvertSToF %6 %45
|
||||
%47 = OpAccessChain %21 %19 %20 %13
|
||||
%48 = OpLoad %12 %47
|
||||
%49 = OpConvertSToF %6 %48
|
||||
%50 = OpAccessChain %21 %19 %20 %13
|
||||
%51 = OpLoad %12 %50
|
||||
%52 = OpConvertSToF %6 %51
|
||||
%53 = OpAccessChain %21 %19 %20 %20
|
||||
%54 = OpLoad %12 %53
|
||||
%55 = OpConvertSToF %6 %54
|
||||
%56 = OpCompositeConstruct %41 %46 %49 %52 %55
|
||||
OpStore %43 %56
|
||||
OpBranch %40
|
||||
%57 = OpLabel
|
||||
%58 = OpAccessChain %21 %19 %20 %13
|
||||
%59 = OpLoad %12 %58
|
||||
%60 = OpConvertSToF %6 %59
|
||||
%61 = OpCompositeConstruct %41 %60 %60 %60 %60
|
||||
OpStore %43 %61
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,136 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific arbitrary precision float usage.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 v = vec4(1, 2, 3, 4);
|
||||
# float dist1 = distance(tanh(v), sinh(v) / cosh(v));
|
||||
# float dist2 = distance(tanh(v), vec4(0.76159, 0.96403, 0.99505, 0.99933));
|
||||
#
|
||||
# // tanh(v) == sinh(v) / cosh(v). Allow some room for precision errors.
|
||||
# if (dist1 < 0.1 && dist2 < 0.1)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 49
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %44
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "v"
|
||||
OpName %16 "dist1"
|
||||
OpName %25 "dist2"
|
||||
OpName %44 "_GLF_color"
|
||||
OpDecorate %44 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpConstant %6 1
|
||||
%11 = OpConstant %6 2
|
||||
%12 = OpConstant %6 3
|
||||
%13 = OpConstant %6 4
|
||||
%14 = OpConstantComposite %7 %10 %11 %12 %13
|
||||
%15 = OpTypePointer Function %6
|
||||
%28 = OpConstant %6 0.761590004
|
||||
%29 = OpConstant %6 0.964030027
|
||||
%30 = OpConstant %6 0.995050013
|
||||
%31 = OpConstant %6 0.999329984
|
||||
%32 = OpConstantComposite %7 %28 %29 %30 %31
|
||||
%35 = OpConstant %6 0.100000001
|
||||
%36 = OpTypeBool
|
||||
%43 = OpTypePointer Output %7
|
||||
%44 = OpVariable %43 Output
|
||||
%45 = OpConstant %6 0
|
||||
%46 = OpConstantComposite %7 %10 %45 %45 %10
|
||||
%48 = OpConstantComposite %7 %45 %45 %45 %45
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%16 = OpVariable %15 Function
|
||||
%25 = OpVariable %15 Function
|
||||
OpStore %9 %14
|
||||
%17 = OpLoad %7 %9
|
||||
%18 = OpExtInst %7 %1 Tanh %17
|
||||
%19 = OpLoad %7 %9
|
||||
%20 = OpExtInst %7 %1 Sinh %19
|
||||
%21 = OpLoad %7 %9
|
||||
%22 = OpExtInst %7 %1 Cosh %21
|
||||
%23 = OpFDiv %7 %20 %22
|
||||
%24 = OpExtInst %6 %1 Distance %18 %23
|
||||
OpStore %16 %24
|
||||
%26 = OpLoad %7 %9
|
||||
%27 = OpExtInst %7 %1 Tanh %26
|
||||
%33 = OpExtInst %6 %1 Distance %27 %32
|
||||
OpStore %25 %33
|
||||
%34 = OpLoad %6 %16
|
||||
%37 = OpFOrdLessThan %36 %34 %35
|
||||
%38 = OpLoad %6 %25
|
||||
%39 = OpFOrdLessThan %36 %38 %35
|
||||
%40 = OpLogicalAnd %36 %37 %39
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %40 %41 %47
|
||||
%41 = OpLabel
|
||||
OpStore %44 %46
|
||||
OpBranch %42
|
||||
%47 = OpLabel
|
||||
OpStore %44 %48
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,355 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_50 _GLF_uniform_int_values[0]
|
||||
# #define _int_10 _GLF_uniform_int_values[1]
|
||||
# #define _int_11 _GLF_uniform_int_values[2]
|
||||
# #define _int_12 _GLF_uniform_int_values[3]
|
||||
# #define _int_1 _GLF_uniform_int_values[4]
|
||||
# #define _int_2 _GLF_uniform_int_values[5]
|
||||
# #define _int_3 _GLF_uniform_int_values[6]
|
||||
# #define _int_6 _GLF_uniform_int_values[7]
|
||||
# #define _int_7 _GLF_uniform_int_values[8]
|
||||
# #define _int_0 _GLF_uniform_int_values[9]
|
||||
# #define _int_5 _GLF_uniform_int_values[10]
|
||||
# #define _int_9 _GLF_uniform_int_values[11]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [50, 10, 11, 12, 1, 2, 3, 6, 7, 0, 5, 9]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[12];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# mat3x4 m0 = mat3x4(_int_1, _int_2, _int_3, 4, _int_5, _int_6, _int_7, 8,
|
||||
# _int_9, _int_10, _int_11, _int_12);
|
||||
# mat3x4 m1 = mat3x4(_int_1);
|
||||
#
|
||||
# // Results are too large to fit into a floating point type, thus the results are undefined.
|
||||
# vec3 undefined = ldexp(vec3(1), ivec3(500));
|
||||
# // These still fit into floating point type.
|
||||
# vec3 defined = ldexp(vec3(_int_1), ivec3(_int_50));
|
||||
#
|
||||
# // Vectors v0 and v1 are undefined.
|
||||
# vec4 v0 = m0 * undefined;
|
||||
# vec4 v1 = m1 * undefined;
|
||||
#
|
||||
# // Vectors v2 and v3 are defined.
|
||||
# vec4 v2 = m0 * defined;
|
||||
# vec4 v3 = m1 * defined;
|
||||
#
|
||||
# // Always true.
|
||||
# if (v2.x > v3.x)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(_int_0);
|
||||
# }
|
||||
#
|
||||
# // The result doesn't matter as the green channel is already zero.
|
||||
# if (v0.x < v1.x)
|
||||
# {
|
||||
# _GLF_color.g = _float_0_0;
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 158
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %121
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "m0"
|
||||
OpName %15 "buf1"
|
||||
OpMemberName %15 0 "_GLF_uniform_int_values"
|
||||
OpName %17 ""
|
||||
OpName %68 "m1"
|
||||
OpName %78 "undefined"
|
||||
OpName %84 "defined"
|
||||
OpName %94 "v0"
|
||||
OpName %98 "v1"
|
||||
OpName %102 "v2"
|
||||
OpName %106 "v3"
|
||||
OpName %121 "_GLF_color"
|
||||
OpName %150 "buf0"
|
||||
OpMemberName %150 0 "_GLF_uniform_float_values"
|
||||
OpName %152 ""
|
||||
OpDecorate %14 ArrayStride 16
|
||||
OpMemberDecorate %15 0 RelaxedPrecision
|
||||
OpMemberDecorate %15 0 Offset 0
|
||||
OpDecorate %15 Block
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 1
|
||||
OpDecorate %22 RelaxedPrecision
|
||||
OpDecorate %26 RelaxedPrecision
|
||||
OpDecorate %30 RelaxedPrecision
|
||||
OpDecorate %35 RelaxedPrecision
|
||||
OpDecorate %39 RelaxedPrecision
|
||||
OpDecorate %43 RelaxedPrecision
|
||||
OpDecorate %48 RelaxedPrecision
|
||||
OpDecorate %52 RelaxedPrecision
|
||||
OpDecorate %56 RelaxedPrecision
|
||||
OpDecorate %60 RelaxedPrecision
|
||||
OpDecorate %70 RelaxedPrecision
|
||||
OpDecorate %86 RelaxedPrecision
|
||||
OpDecorate %90 RelaxedPrecision
|
||||
OpDecorate %121 Location 0
|
||||
OpDecorate %123 RelaxedPrecision
|
||||
OpDecorate %127 RelaxedPrecision
|
||||
OpDecorate %130 RelaxedPrecision
|
||||
OpDecorate %133 RelaxedPrecision
|
||||
OpDecorate %138 RelaxedPrecision
|
||||
OpDecorate %149 ArrayStride 16
|
||||
OpMemberDecorate %150 0 Offset 0
|
||||
OpDecorate %150 Block
|
||||
OpDecorate %152 DescriptorSet 0
|
||||
OpDecorate %152 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypeMatrix %7 3
|
||||
%9 = OpTypePointer Function %8
|
||||
%11 = OpTypeInt 32 1
|
||||
%12 = OpTypeInt 32 0
|
||||
%13 = OpConstant %12 12
|
||||
%14 = OpTypeArray %11 %13
|
||||
%15 = OpTypeStruct %14
|
||||
%16 = OpTypePointer Uniform %15
|
||||
%17 = OpVariable %16 Uniform
|
||||
%18 = OpConstant %11 0
|
||||
%19 = OpConstant %11 4
|
||||
%20 = OpTypePointer Uniform %11
|
||||
%24 = OpConstant %11 5
|
||||
%28 = OpConstant %11 6
|
||||
%32 = OpConstant %6 4
|
||||
%33 = OpConstant %11 10
|
||||
%37 = OpConstant %11 7
|
||||
%41 = OpConstant %11 8
|
||||
%45 = OpConstant %6 8
|
||||
%46 = OpConstant %11 11
|
||||
%50 = OpConstant %11 1
|
||||
%54 = OpConstant %11 2
|
||||
%58 = OpConstant %11 3
|
||||
%62 = OpConstant %6 1
|
||||
%63 = OpConstant %6 0
|
||||
%76 = OpTypeVector %6 3
|
||||
%77 = OpTypePointer Function %76
|
||||
%79 = OpConstantComposite %76 %62 %62 %62
|
||||
%80 = OpTypeVector %11 3
|
||||
%81 = OpConstant %11 500
|
||||
%82 = OpConstantComposite %80 %81 %81 %81
|
||||
%93 = OpTypePointer Function %7
|
||||
%110 = OpConstant %12 0
|
||||
%111 = OpTypePointer Function %6
|
||||
%116 = OpTypeBool
|
||||
%120 = OpTypePointer Output %7
|
||||
%121 = OpVariable %120 Output
|
||||
%125 = OpConstant %11 9
|
||||
%148 = OpConstant %12 1
|
||||
%149 = OpTypeArray %6 %148
|
||||
%150 = OpTypeStruct %149
|
||||
%151 = OpTypePointer Uniform %150
|
||||
%152 = OpVariable %151 Uniform
|
||||
%153 = OpTypePointer Uniform %6
|
||||
%156 = OpTypePointer Output %6
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%10 = OpVariable %9 Function
|
||||
%68 = OpVariable %9 Function
|
||||
%78 = OpVariable %77 Function
|
||||
%84 = OpVariable %77 Function
|
||||
%94 = OpVariable %93 Function
|
||||
%98 = OpVariable %93 Function
|
||||
%102 = OpVariable %93 Function
|
||||
%106 = OpVariable %93 Function
|
||||
%21 = OpAccessChain %20 %17 %18 %19
|
||||
%22 = OpLoad %11 %21
|
||||
%23 = OpConvertSToF %6 %22
|
||||
%25 = OpAccessChain %20 %17 %18 %24
|
||||
%26 = OpLoad %11 %25
|
||||
%27 = OpConvertSToF %6 %26
|
||||
%29 = OpAccessChain %20 %17 %18 %28
|
||||
%30 = OpLoad %11 %29
|
||||
%31 = OpConvertSToF %6 %30
|
||||
%34 = OpAccessChain %20 %17 %18 %33
|
||||
%35 = OpLoad %11 %34
|
||||
%36 = OpConvertSToF %6 %35
|
||||
%38 = OpAccessChain %20 %17 %18 %37
|
||||
%39 = OpLoad %11 %38
|
||||
%40 = OpConvertSToF %6 %39
|
||||
%42 = OpAccessChain %20 %17 %18 %41
|
||||
%43 = OpLoad %11 %42
|
||||
%44 = OpConvertSToF %6 %43
|
||||
%47 = OpAccessChain %20 %17 %18 %46
|
||||
%48 = OpLoad %11 %47
|
||||
%49 = OpConvertSToF %6 %48
|
||||
%51 = OpAccessChain %20 %17 %18 %50
|
||||
%52 = OpLoad %11 %51
|
||||
%53 = OpConvertSToF %6 %52
|
||||
%55 = OpAccessChain %20 %17 %18 %54
|
||||
%56 = OpLoad %11 %55
|
||||
%57 = OpConvertSToF %6 %56
|
||||
%59 = OpAccessChain %20 %17 %18 %58
|
||||
%60 = OpLoad %11 %59
|
||||
%61 = OpConvertSToF %6 %60
|
||||
%64 = OpCompositeConstruct %7 %23 %27 %31 %32
|
||||
%65 = OpCompositeConstruct %7 %36 %40 %44 %45
|
||||
%66 = OpCompositeConstruct %7 %49 %53 %57 %61
|
||||
%67 = OpCompositeConstruct %8 %64 %65 %66
|
||||
OpStore %10 %67
|
||||
%69 = OpAccessChain %20 %17 %18 %19
|
||||
%70 = OpLoad %11 %69
|
||||
%71 = OpConvertSToF %6 %70
|
||||
%72 = OpCompositeConstruct %7 %71 %63 %63 %63
|
||||
%73 = OpCompositeConstruct %7 %63 %71 %63 %63
|
||||
%74 = OpCompositeConstruct %7 %63 %63 %71 %63
|
||||
%75 = OpCompositeConstruct %8 %72 %73 %74
|
||||
OpStore %68 %75
|
||||
%83 = OpExtInst %76 %1 Ldexp %79 %82
|
||||
OpStore %78 %83
|
||||
%85 = OpAccessChain %20 %17 %18 %19
|
||||
%86 = OpLoad %11 %85
|
||||
%87 = OpConvertSToF %6 %86
|
||||
%88 = OpCompositeConstruct %76 %87 %87 %87
|
||||
%89 = OpAccessChain %20 %17 %18 %18
|
||||
%90 = OpLoad %11 %89
|
||||
%91 = OpCompositeConstruct %80 %90 %90 %90
|
||||
%92 = OpExtInst %76 %1 Ldexp %88 %91
|
||||
OpStore %84 %92
|
||||
%95 = OpLoad %8 %10
|
||||
%96 = OpLoad %76 %78
|
||||
%97 = OpMatrixTimesVector %7 %95 %96
|
||||
OpStore %94 %97
|
||||
%99 = OpLoad %8 %68
|
||||
%100 = OpLoad %76 %78
|
||||
%101 = OpMatrixTimesVector %7 %99 %100
|
||||
OpStore %98 %101
|
||||
%103 = OpLoad %8 %10
|
||||
%104 = OpLoad %76 %84
|
||||
%105 = OpMatrixTimesVector %7 %103 %104
|
||||
OpStore %102 %105
|
||||
%107 = OpLoad %8 %68
|
||||
%108 = OpLoad %76 %84
|
||||
%109 = OpMatrixTimesVector %7 %107 %108
|
||||
OpStore %106 %109
|
||||
%112 = OpAccessChain %111 %102 %110
|
||||
%113 = OpLoad %6 %112
|
||||
%114 = OpAccessChain %111 %106 %110
|
||||
%115 = OpLoad %6 %114
|
||||
%117 = OpFOrdGreaterThan %116 %113 %115
|
||||
OpSelectionMerge %119 None
|
||||
OpBranchConditional %117 %118 %136
|
||||
%118 = OpLabel
|
||||
%122 = OpAccessChain %20 %17 %18 %19
|
||||
%123 = OpLoad %11 %122
|
||||
%124 = OpConvertSToF %6 %123
|
||||
%126 = OpAccessChain %20 %17 %18 %125
|
||||
%127 = OpLoad %11 %126
|
||||
%128 = OpConvertSToF %6 %127
|
||||
%129 = OpAccessChain %20 %17 %18 %125
|
||||
%130 = OpLoad %11 %129
|
||||
%131 = OpConvertSToF %6 %130
|
||||
%132 = OpAccessChain %20 %17 %18 %19
|
||||
%133 = OpLoad %11 %132
|
||||
%134 = OpConvertSToF %6 %133
|
||||
%135 = OpCompositeConstruct %7 %124 %128 %131 %134
|
||||
OpStore %121 %135
|
||||
OpBranch %119
|
||||
%136 = OpLabel
|
||||
%137 = OpAccessChain %20 %17 %18 %125
|
||||
%138 = OpLoad %11 %137
|
||||
%139 = OpConvertSToF %6 %138
|
||||
%140 = OpCompositeConstruct %7 %139 %139 %139 %139
|
||||
OpStore %121 %140
|
||||
OpBranch %119
|
||||
%119 = OpLabel
|
||||
%141 = OpAccessChain %111 %94 %110
|
||||
%142 = OpLoad %6 %141
|
||||
%143 = OpAccessChain %111 %98 %110
|
||||
%144 = OpLoad %6 %143
|
||||
%145 = OpFOrdLessThan %116 %142 %144
|
||||
OpSelectionMerge %147 None
|
||||
OpBranchConditional %145 %146 %147
|
||||
%146 = OpLabel
|
||||
%154 = OpAccessChain %153 %152 %18 %18
|
||||
%155 = OpLoad %6 %154
|
||||
%157 = OpAccessChain %156 %121 %148
|
||||
OpStore %157 %155
|
||||
OpBranch %147
|
||||
%147 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
50 10 11 12 1 2 3 6 7 0 5 9
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,188 @@
|
||||
#!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 a specific floating point code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_5 _GLF_uniform_int_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# for (int i = _int_0; i < _int_5; i++)
|
||||
# {
|
||||
# vec4 v = unpackUnorm4x8(100u);
|
||||
#
|
||||
# // Always false.
|
||||
# if (int(v.x) > i)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_0);
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 68
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %47
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "i"
|
||||
OpName %12 "buf0"
|
||||
OpMemberName %12 0 "_GLF_uniform_int_values"
|
||||
OpName %14 ""
|
||||
OpName %34 "v"
|
||||
OpName %47 "_GLF_color"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %47 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 3
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpConstant %6 1
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%26 = OpConstant %6 2
|
||||
%29 = OpTypeBool
|
||||
%31 = OpTypeFloat 32
|
||||
%32 = OpTypeVector %31 4
|
||||
%33 = OpTypePointer Function %32
|
||||
%35 = OpConstant %9 100
|
||||
%37 = OpConstant %9 0
|
||||
%38 = OpTypePointer Function %31
|
||||
%46 = OpTypePointer Output %32
|
||||
%47 = OpVariable %46 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%34 = OpVariable %33 Function
|
||||
%18 = OpAccessChain %17 %14 %15 %16
|
||||
%19 = OpLoad %6 %18
|
||||
OpStore %8 %19
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
OpLoopMerge %22 %23 None
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%25 = OpLoad %6 %8
|
||||
%27 = OpAccessChain %17 %14 %15 %26
|
||||
%28 = OpLoad %6 %27
|
||||
%30 = OpSLessThan %29 %25 %28
|
||||
OpBranchConditional %30 %21 %22
|
||||
%21 = OpLabel
|
||||
%36 = OpExtInst %32 %1 UnpackUnorm4x8 %35
|
||||
OpStore %34 %36
|
||||
%39 = OpAccessChain %38 %34 %37
|
||||
%40 = OpLoad %31 %39
|
||||
%41 = OpConvertFToS %6 %40
|
||||
%42 = OpLoad %6 %8
|
||||
%43 = OpSGreaterThan %29 %41 %42
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %43 %44 %45
|
||||
%44 = OpLabel
|
||||
%48 = OpAccessChain %17 %14 %15 %16
|
||||
%49 = OpLoad %6 %48
|
||||
%50 = OpConvertSToF %31 %49
|
||||
%51 = OpCompositeConstruct %32 %50 %50 %50 %50
|
||||
OpStore %47 %51
|
||||
OpReturn
|
||||
%45 = OpLabel
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
%53 = OpLoad %6 %8
|
||||
%54 = OpIAdd %6 %53 %16
|
||||
OpStore %8 %54
|
||||
OpBranch %20
|
||||
%22 = OpLabel
|
||||
%55 = OpAccessChain %17 %14 %15 %15
|
||||
%56 = OpLoad %6 %55
|
||||
%57 = OpConvertSToF %31 %56
|
||||
%58 = OpAccessChain %17 %14 %15 %16
|
||||
%59 = OpLoad %6 %58
|
||||
%60 = OpConvertSToF %31 %59
|
||||
%61 = OpAccessChain %17 %14 %15 %16
|
||||
%62 = OpLoad %6 %61
|
||||
%63 = OpConvertSToF %31 %62
|
||||
%64 = OpAccessChain %17 %14 %15 %15
|
||||
%65 = OpLoad %6 %64
|
||||
%66 = OpConvertSToF %31 %65
|
||||
%67 = OpCompositeConstruct %32 %57 %60 %63 %66
|
||||
OpStore %47 %67
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 5
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
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 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,239 @@
|
||||
#!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 a specific inst combine select path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _int_2 _GLF_uniform_int_values[2]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1, 2]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int arr[3] = int[3](_int_1, _int_1, _int_1);
|
||||
#
|
||||
# int a = arr[_int_0];
|
||||
#
|
||||
# int b = a - 1;
|
||||
#
|
||||
# // Always false.
|
||||
# if (gl_FragCoord.x < _float_0_0)
|
||||
# {
|
||||
# b++;
|
||||
# }
|
||||
#
|
||||
# int c = _int_0;
|
||||
#
|
||||
# // arr[1] becomes 0.
|
||||
# arr[clamp(c, _int_1, _int_2)] = b;
|
||||
#
|
||||
# _GLF_color = vec4(arr[_int_0], arr[_int_1], arr[_int_1], arr[_int_2]);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 92
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %38 %70
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "arr"
|
||||
OpName %13 "buf0"
|
||||
OpMemberName %13 0 "_GLF_uniform_int_values"
|
||||
OpName %15 ""
|
||||
OpName %27 "a"
|
||||
OpName %32 "b"
|
||||
OpName %38 "gl_FragCoord"
|
||||
OpName %45 "buf1"
|
||||
OpMemberName %45 0 "_GLF_uniform_float_values"
|
||||
OpName %47 ""
|
||||
OpName %57 "c"
|
||||
OpName %70 "_GLF_color"
|
||||
OpDecorate %12 ArrayStride 16
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %38 BuiltIn FragCoord
|
||||
OpDecorate %44 ArrayStride 16
|
||||
OpMemberDecorate %45 0 Offset 0
|
||||
OpDecorate %45 Block
|
||||
OpDecorate %47 DescriptorSet 0
|
||||
OpDecorate %47 Binding 1
|
||||
OpDecorate %70 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 3
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpTypeArray %6 %8
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpConstant %6 0
|
||||
%17 = OpConstant %6 1
|
||||
%18 = OpTypePointer Uniform %6
|
||||
%26 = OpTypePointer Function %6
|
||||
%35 = OpTypeFloat 32
|
||||
%36 = OpTypeVector %35 4
|
||||
%37 = OpTypePointer Input %36
|
||||
%38 = OpVariable %37 Input
|
||||
%39 = OpConstant %7 0
|
||||
%40 = OpTypePointer Input %35
|
||||
%43 = OpConstant %7 1
|
||||
%44 = OpTypeArray %35 %43
|
||||
%45 = OpTypeStruct %44
|
||||
%46 = OpTypePointer Uniform %45
|
||||
%47 = OpVariable %46 Uniform
|
||||
%48 = OpTypePointer Uniform %35
|
||||
%51 = OpTypeBool
|
||||
%63 = OpConstant %6 2
|
||||
%69 = OpTypePointer Output %36
|
||||
%70 = OpVariable %69 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%27 = OpVariable %26 Function
|
||||
%32 = OpVariable %26 Function
|
||||
%57 = OpVariable %26 Function
|
||||
%19 = OpAccessChain %18 %15 %16 %17
|
||||
%20 = OpLoad %6 %19
|
||||
%21 = OpAccessChain %18 %15 %16 %17
|
||||
%22 = OpLoad %6 %21
|
||||
%23 = OpAccessChain %18 %15 %16 %17
|
||||
%24 = OpLoad %6 %23
|
||||
%25 = OpCompositeConstruct %9 %20 %22 %24
|
||||
OpStore %11 %25
|
||||
%28 = OpAccessChain %18 %15 %16 %16
|
||||
%29 = OpLoad %6 %28
|
||||
%30 = OpAccessChain %26 %11 %29
|
||||
%31 = OpLoad %6 %30
|
||||
OpStore %27 %31
|
||||
%33 = OpLoad %6 %27
|
||||
%34 = OpISub %6 %33 %17
|
||||
OpStore %32 %34
|
||||
%41 = OpAccessChain %40 %38 %39
|
||||
%42 = OpLoad %35 %41
|
||||
%49 = OpAccessChain %48 %47 %16 %16
|
||||
%50 = OpLoad %35 %49
|
||||
%52 = OpFOrdLessThan %51 %42 %50
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %52 %53 %54
|
||||
%53 = OpLabel
|
||||
%55 = OpLoad %6 %32
|
||||
%56 = OpIAdd %6 %55 %17
|
||||
OpStore %32 %56
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%58 = OpAccessChain %18 %15 %16 %16
|
||||
%59 = OpLoad %6 %58
|
||||
OpStore %57 %59
|
||||
%60 = OpLoad %6 %57
|
||||
%61 = OpAccessChain %18 %15 %16 %17
|
||||
%62 = OpLoad %6 %61
|
||||
%64 = OpAccessChain %18 %15 %16 %63
|
||||
%65 = OpLoad %6 %64
|
||||
%66 = OpExtInst %6 %1 SClamp %60 %62 %65
|
||||
%67 = OpLoad %6 %32
|
||||
%68 = OpAccessChain %26 %11 %66
|
||||
OpStore %68 %67
|
||||
%71 = OpAccessChain %18 %15 %16 %16
|
||||
%72 = OpLoad %6 %71
|
||||
%73 = OpAccessChain %26 %11 %72
|
||||
%74 = OpLoad %6 %73
|
||||
%75 = OpConvertSToF %35 %74
|
||||
%76 = OpAccessChain %18 %15 %16 %17
|
||||
%77 = OpLoad %6 %76
|
||||
%78 = OpAccessChain %26 %11 %77
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpConvertSToF %35 %79
|
||||
%81 = OpAccessChain %18 %15 %16 %17
|
||||
%82 = OpLoad %6 %81
|
||||
%83 = OpAccessChain %26 %11 %82
|
||||
%84 = OpLoad %6 %83
|
||||
%85 = OpConvertSToF %35 %84
|
||||
%86 = OpAccessChain %18 %15 %16 %63
|
||||
%87 = OpLoad %6 %86
|
||||
%88 = OpAccessChain %26 %11 %87
|
||||
%89 = OpLoad %6 %88
|
||||
%90 = OpConvertSToF %35 %89
|
||||
%91 = OpCompositeConstruct %36 %75 %80 %85 %90
|
||||
OpStore %70 %91
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1 2
|
||||
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
|
||||
@@ -0,0 +1,261 @@
|
||||
#!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.
|
||||
|
||||
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 _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // 1.0 / float(false) = 1.0 / 0.0. This value has no effect on the output color.
|
||||
# float arr[5] = float[5](_float_1_0, _float_0_0, _float_0_0, (1.0 / float(false)), _float_0_0);
|
||||
#
|
||||
# for(int i = 0; i < 5; i++)
|
||||
# {
|
||||
# if(arr[_int_0] > arr[i])
|
||||
# {
|
||||
# arr[i] = _float_1_0;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(arr[_int_0] == _float_1_0 && arr[_int_1] == _float_1_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: 104
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %85
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %11 "arr"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "_GLF_uniform_float_values"
|
||||
OpName %16 ""
|
||||
OpName %32 "i"
|
||||
OpName %43 "buf1"
|
||||
OpMemberName %43 0 "_GLF_uniform_int_values"
|
||||
OpName %45 ""
|
||||
OpName %85 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpDecorate %42 ArrayStride 16
|
||||
OpMemberDecorate %43 0 Offset 0
|
||||
OpDecorate %43 Block
|
||||
OpDecorate %45 DescriptorSet 0
|
||||
OpDecorate %45 Binding 1
|
||||
OpDecorate %85 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 5
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpConstant %7 2
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%22 = OpConstant %17 1
|
||||
%27 = OpConstant %6 0x1p+128
|
||||
%31 = OpTypePointer Function %17
|
||||
%39 = OpConstant %17 5
|
||||
%40 = OpTypeBool
|
||||
%42 = OpTypeArray %17 %12
|
||||
%43 = OpTypeStruct %42
|
||||
%44 = OpTypePointer Uniform %43
|
||||
%45 = OpVariable %44 Uniform
|
||||
%46 = OpTypePointer Uniform %17
|
||||
%49 = OpTypePointer Function %6
|
||||
%83 = OpTypeVector %6 4
|
||||
%84 = OpTypePointer Output %83
|
||||
%85 = OpVariable %84 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%32 = OpVariable %31 Function
|
||||
%20 = OpAccessChain %19 %16 %18 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpAccessChain %19 %16 %18 %22
|
||||
%24 = OpLoad %6 %23
|
||||
%25 = OpAccessChain %19 %16 %18 %22
|
||||
%26 = OpLoad %6 %25
|
||||
%28 = OpAccessChain %19 %16 %18 %22
|
||||
%29 = OpLoad %6 %28
|
||||
%30 = OpCompositeConstruct %9 %21 %24 %26 %27 %29
|
||||
OpStore %11 %30
|
||||
OpStore %32 %18
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%38 = OpLoad %17 %32
|
||||
%41 = OpSLessThan %40 %38 %39
|
||||
OpBranchConditional %41 %34 %35
|
||||
%34 = OpLabel
|
||||
%47 = OpAccessChain %46 %45 %18 %18
|
||||
%48 = OpLoad %17 %47
|
||||
%50 = OpAccessChain %49 %11 %48
|
||||
%51 = OpLoad %6 %50
|
||||
%52 = OpLoad %17 %32
|
||||
%53 = OpAccessChain %49 %11 %52
|
||||
%54 = OpLoad %6 %53
|
||||
%55 = OpFOrdGreaterThan %40 %51 %54
|
||||
OpSelectionMerge %57 None
|
||||
OpBranchConditional %55 %56 %57
|
||||
%56 = OpLabel
|
||||
%58 = OpLoad %17 %32
|
||||
%59 = OpAccessChain %19 %16 %18 %18
|
||||
%60 = OpLoad %6 %59
|
||||
%61 = OpAccessChain %49 %11 %58
|
||||
OpStore %61 %60
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%62 = OpLoad %17 %32
|
||||
%63 = OpIAdd %17 %62 %22
|
||||
OpStore %32 %63
|
||||
OpBranch %33
|
||||
%35 = OpLabel
|
||||
%64 = OpAccessChain %46 %45 %18 %18
|
||||
%65 = OpLoad %17 %64
|
||||
%66 = OpAccessChain %49 %11 %65
|
||||
%67 = OpLoad %6 %66
|
||||
%68 = OpAccessChain %19 %16 %18 %18
|
||||
%69 = OpLoad %6 %68
|
||||
%70 = OpFOrdEqual %40 %67 %69
|
||||
OpSelectionMerge %72 None
|
||||
OpBranchConditional %70 %71 %72
|
||||
%71 = OpLabel
|
||||
%73 = OpAccessChain %46 %45 %18 %22
|
||||
%74 = OpLoad %17 %73
|
||||
%75 = OpAccessChain %49 %11 %74
|
||||
%76 = OpLoad %6 %75
|
||||
%77 = OpAccessChain %19 %16 %18 %18
|
||||
%78 = OpLoad %6 %77
|
||||
%79 = OpFOrdEqual %40 %76 %78
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
%80 = OpPhi %40 %70 %35 %79 %71
|
||||
OpSelectionMerge %82 None
|
||||
OpBranchConditional %80 %81 %99
|
||||
%81 = OpLabel
|
||||
%86 = OpAccessChain %46 %45 %18 %22
|
||||
%87 = OpLoad %17 %86
|
||||
%88 = OpConvertSToF %6 %87
|
||||
%89 = OpAccessChain %46 %45 %18 %18
|
||||
%90 = OpLoad %17 %89
|
||||
%91 = OpConvertSToF %6 %90
|
||||
%92 = OpAccessChain %46 %45 %18 %18
|
||||
%93 = OpLoad %17 %92
|
||||
%94 = OpConvertSToF %6 %93
|
||||
%95 = OpAccessChain %46 %45 %18 %22
|
||||
%96 = OpLoad %17 %95
|
||||
%97 = OpConvertSToF %6 %96
|
||||
%98 = OpCompositeConstruct %83 %88 %91 %94 %97
|
||||
OpStore %85 %98
|
||||
OpBranch %82
|
||||
%99 = OpLabel
|
||||
%100 = OpAccessChain %46 %45 %18 %18
|
||||
%101 = OpLoad %17 %100
|
||||
%102 = OpConvertSToF %6 %101
|
||||
%103 = OpCompositeConstruct %83 %102 %102 %102 %102
|
||||
OpStore %85 %103
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 0.0
|
||||
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__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,569 @@
|
||||
#!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 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_8 _GLF_uniform_int_values[0]
|
||||
# #define _int_10 _GLF_uniform_int_values[1]
|
||||
# #define _int_1 _GLF_uniform_int_values[2]
|
||||
# #define _int_0 _GLF_uniform_int_values[3]
|
||||
# #define _int_2 _GLF_uniform_int_values[4]
|
||||
# #define _int_3 _GLF_uniform_int_values[5]
|
||||
# #define _int_4 _GLF_uniform_int_values[6]
|
||||
# #define _int_5 _GLF_uniform_int_values[7]
|
||||
# #define _int_6 _GLF_uniform_int_values[8]
|
||||
# #define _int_7 _GLF_uniform_int_values[9]
|
||||
# #define _int_9 _GLF_uniform_int_values[10]
|
||||
# #define _int_17 _GLF_uniform_int_values[11]
|
||||
# #define _int_11 _GLF_uniform_int_values[12]
|
||||
# #define _int_15 _GLF_uniform_int_values[13]
|
||||
# #define _int_16 _GLF_uniform_int_values[14]
|
||||
# #define _int_12 _GLF_uniform_int_values[15]
|
||||
# #define _int_13 _GLF_uniform_int_values[16]
|
||||
# #define _int_14 _GLF_uniform_int_values[17]
|
||||
# #define _int_18 _GLF_uniform_int_values[18]
|
||||
# #define _int_19 _GLF_uniform_int_values[19]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [8, 10, 1, 0, 2, 3, 4, 5, 6, 7, 9, 17, 11, 15, 16, 12, 13, 14, 18, 19]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[20];
|
||||
# };
|
||||
#
|
||||
# // Contents of one: 1
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int one;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int arr0[10] = int[10](_int_0, _int_1, _int_2, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9);
|
||||
# int arr1[10] = int[10](_int_10, _int_11, _int_12, _int_13, _int_14, _int_15, _int_16, _int_17, _int_18, _int_19);
|
||||
#
|
||||
# for(int a = _int_6; a < _int_8; a++)
|
||||
# {
|
||||
# int limiter0 = _int_0;
|
||||
# while(limiter0 < _int_2)
|
||||
# {
|
||||
# limiter0++;
|
||||
#
|
||||
# int limiter1 = _int_1;
|
||||
# // Iterated for b = 0..3.
|
||||
# for(int b = _int_0; b < _int_10; b ++)
|
||||
# {
|
||||
# if(limiter1 > _int_3)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# limiter1++;
|
||||
# arr0[b] = arr1[a];
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# int limiter2 = 0;
|
||||
# // Does the same assignment five times.
|
||||
# while(limiter2 < 5)
|
||||
# {
|
||||
# limiter2++;
|
||||
# arr0[1] = arr1[1];
|
||||
# }
|
||||
#
|
||||
# // Iterated once.
|
||||
# do
|
||||
# {
|
||||
# int limiter3 = 0;
|
||||
# // Iterated for d = 0..4.
|
||||
# for(int d = 0; d < 10; d ++)
|
||||
# {
|
||||
# if(limiter3 > 4)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# limiter3 ++;
|
||||
# arr1[d] = arr0[d];
|
||||
# }
|
||||
# }
|
||||
# while(_int_1 == _int_0);
|
||||
# }
|
||||
#
|
||||
# // Reference values.
|
||||
# int ref0[10] = int[10](_int_17, _int_11, _int_17, _int_3, _int_4, _int_5, _int_6, _int_7, _int_8, _int_9);
|
||||
# int ref1[10] = int[10](_int_17, _int_11, _int_17, _int_3, _int_4, _int_15, _int_16, _int_17, _int_18, _int_19);
|
||||
#
|
||||
# // Return red if no error is detected.
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
#
|
||||
# for(int i = _int_0; i < _int_10; i ++)
|
||||
# {
|
||||
# // Unexpected value. Change the color to black.
|
||||
# if(arr0[i] != ref0[i] || arr1[i] != ref1[i])
|
||||
# {
|
||||
# _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: 289
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %234
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %11 "arr0"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "_GLF_uniform_int_values"
|
||||
OpName %16 ""
|
||||
OpName %49 "arr1"
|
||||
OpName %82 "a"
|
||||
OpName %95 "limiter0"
|
||||
OpName %109 "limiter1"
|
||||
OpName %112 "b"
|
||||
OpName %140 "limiter2"
|
||||
OpName %157 "limiter3"
|
||||
OpName %158 "d"
|
||||
OpName %187 "ref0"
|
||||
OpName %209 "ref1"
|
||||
OpName %234 "_GLF_color"
|
||||
OpName %248 "i"
|
||||
OpName %286 "buf1"
|
||||
OpMemberName %286 0 "one"
|
||||
OpName %288 ""
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpDecorate %234 Location 0
|
||||
OpMemberDecorate %286 0 Offset 0
|
||||
OpDecorate %286 Block
|
||||
OpDecorate %288 DescriptorSet 0
|
||||
OpDecorate %288 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 10
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpConstant %7 20
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpConstant %6 0
|
||||
%18 = OpConstant %6 3
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%22 = OpConstant %6 2
|
||||
%25 = OpConstant %6 4
|
||||
%28 = OpConstant %6 5
|
||||
%31 = OpConstant %6 6
|
||||
%34 = OpConstant %6 7
|
||||
%37 = OpConstant %6 8
|
||||
%40 = OpConstant %6 9
|
||||
%45 = OpConstant %6 10
|
||||
%50 = OpConstant %6 1
|
||||
%53 = OpConstant %6 12
|
||||
%56 = OpConstant %6 15
|
||||
%59 = OpConstant %6 16
|
||||
%62 = OpConstant %6 17
|
||||
%65 = OpConstant %6 13
|
||||
%68 = OpConstant %6 14
|
||||
%71 = OpConstant %6 11
|
||||
%74 = OpConstant %6 18
|
||||
%77 = OpConstant %6 19
|
||||
%81 = OpTypePointer Function %6
|
||||
%93 = OpTypeBool
|
||||
%231 = OpTypeFloat 32
|
||||
%232 = OpTypeVector %231 4
|
||||
%233 = OpTypePointer Output %232
|
||||
%234 = OpVariable %233 Output
|
||||
%286 = OpTypeStruct %6
|
||||
%287 = OpTypePointer Uniform %286
|
||||
%288 = OpVariable %287 Uniform
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%49 = OpVariable %10 Function
|
||||
%82 = OpVariable %81 Function
|
||||
%95 = OpVariable %81 Function
|
||||
%109 = OpVariable %81 Function
|
||||
%112 = OpVariable %81 Function
|
||||
%140 = OpVariable %81 Function
|
||||
%157 = OpVariable %81 Function
|
||||
%158 = OpVariable %81 Function
|
||||
%187 = OpVariable %10 Function
|
||||
%209 = OpVariable %10 Function
|
||||
%248 = OpVariable %81 Function
|
||||
%20 = OpAccessChain %19 %16 %17 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpAccessChain %19 %16 %17 %22
|
||||
%24 = OpLoad %6 %23
|
||||
%26 = OpAccessChain %19 %16 %17 %25
|
||||
%27 = OpLoad %6 %26
|
||||
%29 = OpAccessChain %19 %16 %17 %28
|
||||
%30 = OpLoad %6 %29
|
||||
%32 = OpAccessChain %19 %16 %17 %31
|
||||
%33 = OpLoad %6 %32
|
||||
%35 = OpAccessChain %19 %16 %17 %34
|
||||
%36 = OpLoad %6 %35
|
||||
%38 = OpAccessChain %19 %16 %17 %37
|
||||
%39 = OpLoad %6 %38
|
||||
%41 = OpAccessChain %19 %16 %17 %40
|
||||
%42 = OpLoad %6 %41
|
||||
%43 = OpAccessChain %19 %16 %17 %17
|
||||
%44 = OpLoad %6 %43
|
||||
%46 = OpAccessChain %19 %16 %17 %45
|
||||
%47 = OpLoad %6 %46
|
||||
%48 = OpCompositeConstruct %9 %21 %24 %27 %30 %33 %36 %39 %42 %44 %47
|
||||
OpStore %11 %48
|
||||
%51 = OpAccessChain %19 %16 %17 %50
|
||||
%52 = OpLoad %6 %51
|
||||
%54 = OpAccessChain %19 %16 %17 %53
|
||||
%55 = OpLoad %6 %54
|
||||
%57 = OpAccessChain %19 %16 %17 %56
|
||||
%58 = OpLoad %6 %57
|
||||
%60 = OpAccessChain %19 %16 %17 %59
|
||||
%61 = OpLoad %6 %60
|
||||
%63 = OpAccessChain %19 %16 %17 %62
|
||||
%64 = OpLoad %6 %63
|
||||
%66 = OpAccessChain %19 %16 %17 %65
|
||||
%67 = OpLoad %6 %66
|
||||
%69 = OpAccessChain %19 %16 %17 %68
|
||||
%70 = OpLoad %6 %69
|
||||
%72 = OpAccessChain %19 %16 %17 %71
|
||||
%73 = OpLoad %6 %72
|
||||
%75 = OpAccessChain %19 %16 %17 %74
|
||||
%76 = OpLoad %6 %75
|
||||
%78 = OpAccessChain %19 %16 %17 %77
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpCompositeConstruct %9 %52 %55 %58 %61 %64 %67 %70 %73 %76 %79
|
||||
OpStore %49 %80
|
||||
%83 = OpAccessChain %19 %16 %17 %37
|
||||
%84 = OpLoad %6 %83
|
||||
OpStore %82 %84
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
OpLoopMerge %87 %88 None
|
||||
OpBranch %89
|
||||
%89 = OpLabel
|
||||
%90 = OpLoad %6 %82
|
||||
%91 = OpAccessChain %19 %16 %17 %17
|
||||
%92 = OpLoad %6 %91
|
||||
%94 = OpSLessThan %93 %90 %92
|
||||
OpBranchConditional %94 %86 %87
|
||||
%86 = OpLabel
|
||||
%96 = OpAccessChain %19 %16 %17 %18
|
||||
%97 = OpLoad %6 %96
|
||||
OpStore %95 %97
|
||||
OpBranch %98
|
||||
%98 = OpLabel
|
||||
OpLoopMerge %100 %101 None
|
||||
OpBranch %102
|
||||
%102 = OpLabel
|
||||
%103 = OpLoad %6 %95
|
||||
%104 = OpAccessChain %19 %16 %17 %25
|
||||
%105 = OpLoad %6 %104
|
||||
%106 = OpSLessThan %93 %103 %105
|
||||
OpBranchConditional %106 %99 %100
|
||||
%99 = OpLabel
|
||||
%107 = OpLoad %6 %95
|
||||
%108 = OpIAdd %6 %107 %50
|
||||
OpStore %95 %108
|
||||
%110 = OpAccessChain %19 %16 %17 %22
|
||||
%111 = OpLoad %6 %110
|
||||
OpStore %109 %111
|
||||
%113 = OpAccessChain %19 %16 %17 %18
|
||||
%114 = OpLoad %6 %113
|
||||
OpStore %112 %114
|
||||
OpBranch %115
|
||||
%115 = OpLabel
|
||||
OpLoopMerge %117 %118 None
|
||||
OpBranch %119
|
||||
%119 = OpLabel
|
||||
%120 = OpLoad %6 %112
|
||||
%121 = OpAccessChain %19 %16 %17 %50
|
||||
%122 = OpLoad %6 %121
|
||||
%123 = OpSLessThan %93 %120 %122
|
||||
OpBranchConditional %123 %116 %117
|
||||
%116 = OpLabel
|
||||
%124 = OpLoad %6 %109
|
||||
%125 = OpAccessChain %19 %16 %17 %28
|
||||
%126 = OpLoad %6 %125
|
||||
%127 = OpSGreaterThan %93 %124 %126
|
||||
OpSelectionMerge %129 None
|
||||
OpBranchConditional %127 %128 %129
|
||||
%128 = OpLabel
|
||||
OpBranch %117
|
||||
%129 = OpLabel
|
||||
%131 = OpLoad %6 %109
|
||||
%132 = OpIAdd %6 %131 %50
|
||||
OpStore %109 %132
|
||||
%133 = OpLoad %6 %112
|
||||
%134 = OpLoad %6 %82
|
||||
%135 = OpAccessChain %81 %49 %134
|
||||
%136 = OpLoad %6 %135
|
||||
%137 = OpAccessChain %81 %11 %133
|
||||
OpStore %137 %136
|
||||
OpBranch %118
|
||||
%118 = OpLabel
|
||||
%138 = OpLoad %6 %112
|
||||
%139 = OpIAdd %6 %138 %50
|
||||
OpStore %112 %139
|
||||
OpBranch %115
|
||||
%117 = OpLabel
|
||||
OpBranch %101
|
||||
%101 = OpLabel
|
||||
OpBranch %98
|
||||
%100 = OpLabel
|
||||
OpStore %140 %17
|
||||
OpBranch %141
|
||||
%141 = OpLabel
|
||||
OpLoopMerge %143 %144 None
|
||||
OpBranch %145
|
||||
%145 = OpLabel
|
||||
%146 = OpLoad %6 %140
|
||||
%147 = OpSLessThan %93 %146 %28
|
||||
OpBranchConditional %147 %142 %143
|
||||
%142 = OpLabel
|
||||
%148 = OpLoad %6 %140
|
||||
%149 = OpIAdd %6 %148 %50
|
||||
OpStore %140 %149
|
||||
%150 = OpAccessChain %81 %49 %50
|
||||
%151 = OpLoad %6 %150
|
||||
%152 = OpAccessChain %81 %11 %50
|
||||
OpStore %152 %151
|
||||
OpBranch %144
|
||||
%144 = OpLabel
|
||||
OpBranch %141
|
||||
%143 = OpLabel
|
||||
OpBranch %153
|
||||
%153 = OpLabel
|
||||
OpLoopMerge %155 %156 None
|
||||
OpBranch %154
|
||||
%154 = OpLabel
|
||||
OpStore %157 %17
|
||||
OpStore %158 %17
|
||||
OpBranch %159
|
||||
%159 = OpLabel
|
||||
OpLoopMerge %161 %162 None
|
||||
OpBranch %163
|
||||
%163 = OpLabel
|
||||
%164 = OpLoad %6 %158
|
||||
%165 = OpSLessThan %93 %164 %45
|
||||
OpBranchConditional %165 %160 %161
|
||||
%160 = OpLabel
|
||||
%166 = OpLoad %6 %157
|
||||
%167 = OpSGreaterThan %93 %166 %25
|
||||
OpSelectionMerge %169 None
|
||||
OpBranchConditional %167 %168 %169
|
||||
%168 = OpLabel
|
||||
OpBranch %161
|
||||
%169 = OpLabel
|
||||
%171 = OpLoad %6 %157
|
||||
%172 = OpIAdd %6 %171 %50
|
||||
OpStore %157 %172
|
||||
%173 = OpLoad %6 %158
|
||||
%174 = OpLoad %6 %158
|
||||
%175 = OpAccessChain %81 %11 %174
|
||||
%176 = OpLoad %6 %175
|
||||
%177 = OpAccessChain %81 %49 %173
|
||||
OpStore %177 %176
|
||||
OpBranch %162
|
||||
%162 = OpLabel
|
||||
%178 = OpLoad %6 %158
|
||||
%179 = OpIAdd %6 %178 %50
|
||||
OpStore %158 %179
|
||||
OpBranch %159
|
||||
%161 = OpLabel
|
||||
OpBranch %156
|
||||
%156 = OpLabel
|
||||
%180 = OpAccessChain %19 %16 %17 %22
|
||||
%181 = OpLoad %6 %180
|
||||
%182 = OpAccessChain %19 %16 %17 %18
|
||||
%183 = OpLoad %6 %182
|
||||
%184 = OpIEqual %93 %181 %183
|
||||
OpBranchConditional %184 %153 %155
|
||||
%155 = OpLabel
|
||||
OpBranch %88
|
||||
%88 = OpLabel
|
||||
%185 = OpLoad %6 %82
|
||||
%186 = OpIAdd %6 %185 %50
|
||||
OpStore %82 %186
|
||||
OpBranch %85
|
||||
%87 = OpLabel
|
||||
%188 = OpAccessChain %19 %16 %17 %71
|
||||
%189 = OpLoad %6 %188
|
||||
%190 = OpAccessChain %19 %16 %17 %53
|
||||
%191 = OpLoad %6 %190
|
||||
%192 = OpAccessChain %19 %16 %17 %71
|
||||
%193 = OpLoad %6 %192
|
||||
%194 = OpAccessChain %19 %16 %17 %28
|
||||
%195 = OpLoad %6 %194
|
||||
%196 = OpAccessChain %19 %16 %17 %31
|
||||
%197 = OpLoad %6 %196
|
||||
%198 = OpAccessChain %19 %16 %17 %34
|
||||
%199 = OpLoad %6 %198
|
||||
%200 = OpAccessChain %19 %16 %17 %37
|
||||
%201 = OpLoad %6 %200
|
||||
%202 = OpAccessChain %19 %16 %17 %40
|
||||
%203 = OpLoad %6 %202
|
||||
%204 = OpAccessChain %19 %16 %17 %17
|
||||
%205 = OpLoad %6 %204
|
||||
%206 = OpAccessChain %19 %16 %17 %45
|
||||
%207 = OpLoad %6 %206
|
||||
%208 = OpCompositeConstruct %9 %189 %191 %193 %195 %197 %199 %201 %203 %205 %207
|
||||
OpStore %187 %208
|
||||
%210 = OpAccessChain %19 %16 %17 %71
|
||||
%211 = OpLoad %6 %210
|
||||
%212 = OpAccessChain %19 %16 %17 %53
|
||||
%213 = OpLoad %6 %212
|
||||
%214 = OpAccessChain %19 %16 %17 %71
|
||||
%215 = OpLoad %6 %214
|
||||
%216 = OpAccessChain %19 %16 %17 %28
|
||||
%217 = OpLoad %6 %216
|
||||
%218 = OpAccessChain %19 %16 %17 %31
|
||||
%219 = OpLoad %6 %218
|
||||
%220 = OpAccessChain %19 %16 %17 %65
|
||||
%221 = OpLoad %6 %220
|
||||
%222 = OpAccessChain %19 %16 %17 %68
|
||||
%223 = OpLoad %6 %222
|
||||
%224 = OpAccessChain %19 %16 %17 %71
|
||||
%225 = OpLoad %6 %224
|
||||
%226 = OpAccessChain %19 %16 %17 %74
|
||||
%227 = OpLoad %6 %226
|
||||
%228 = OpAccessChain %19 %16 %17 %77
|
||||
%229 = OpLoad %6 %228
|
||||
%230 = OpCompositeConstruct %9 %211 %213 %215 %217 %219 %221 %223 %225 %227 %229
|
||||
OpStore %209 %230
|
||||
%235 = OpAccessChain %19 %16 %17 %22
|
||||
%236 = OpLoad %6 %235
|
||||
%237 = OpConvertSToF %231 %236
|
||||
%238 = OpAccessChain %19 %16 %17 %18
|
||||
%239 = OpLoad %6 %238
|
||||
%240 = OpConvertSToF %231 %239
|
||||
%241 = OpAccessChain %19 %16 %17 %18
|
||||
%242 = OpLoad %6 %241
|
||||
%243 = OpConvertSToF %231 %242
|
||||
%244 = OpAccessChain %19 %16 %17 %22
|
||||
%245 = OpLoad %6 %244
|
||||
%246 = OpConvertSToF %231 %245
|
||||
%247 = OpCompositeConstruct %232 %237 %240 %243 %246
|
||||
OpStore %234 %247
|
||||
%249 = OpAccessChain %19 %16 %17 %18
|
||||
%250 = OpLoad %6 %249
|
||||
OpStore %248 %250
|
||||
OpBranch %251
|
||||
%251 = OpLabel
|
||||
OpLoopMerge %253 %254 None
|
||||
OpBranch %255
|
||||
%255 = OpLabel
|
||||
%256 = OpLoad %6 %248
|
||||
%257 = OpAccessChain %19 %16 %17 %50
|
||||
%258 = OpLoad %6 %257
|
||||
%259 = OpSLessThan %93 %256 %258
|
||||
OpBranchConditional %259 %252 %253
|
||||
%252 = OpLabel
|
||||
%260 = OpLoad %6 %248
|
||||
%261 = OpAccessChain %81 %11 %260
|
||||
%262 = OpLoad %6 %261
|
||||
%263 = OpLoad %6 %248
|
||||
%264 = OpAccessChain %81 %187 %263
|
||||
%265 = OpLoad %6 %264
|
||||
%266 = OpINotEqual %93 %262 %265
|
||||
%267 = OpLogicalNot %93 %266
|
||||
OpSelectionMerge %269 None
|
||||
OpBranchConditional %267 %268 %269
|
||||
%268 = OpLabel
|
||||
%270 = OpLoad %6 %248
|
||||
%271 = OpAccessChain %81 %49 %270
|
||||
%272 = OpLoad %6 %271
|
||||
%273 = OpLoad %6 %248
|
||||
%274 = OpAccessChain %81 %209 %273
|
||||
%275 = OpLoad %6 %274
|
||||
%276 = OpINotEqual %93 %272 %275
|
||||
OpBranch %269
|
||||
%269 = OpLabel
|
||||
%277 = OpPhi %93 %266 %252 %276 %268
|
||||
OpSelectionMerge %279 None
|
||||
OpBranchConditional %277 %278 %279
|
||||
%278 = OpLabel
|
||||
%280 = OpAccessChain %19 %16 %17 %18
|
||||
%281 = OpLoad %6 %280
|
||||
%282 = OpConvertSToF %231 %281
|
||||
%283 = OpCompositeConstruct %232 %282 %282 %282 %282
|
||||
OpStore %234 %283
|
||||
OpBranch %279
|
||||
%279 = OpLabel
|
||||
OpBranch %254
|
||||
%254 = OpLabel
|
||||
%284 = OpLoad %6 %248
|
||||
%285 = OpIAdd %6 %284 %50
|
||||
OpStore %248 %285
|
||||
OpBranch %251
|
||||
%253 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE int32 STD140 DATA
|
||||
1
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
8 10 1 0 2 3 4 5 6 7 9 17 11 15 16 12 13 14 18 19
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
BIND BUFFER variant_framebuffer AS color LOCATION 0
|
||||
BIND BUFFER variant_one 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 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,287 @@
|
||||
#!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.
|
||||
|
||||
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]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 2]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int arr[10] = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1);
|
||||
# ivec2 v = ivec2(_int_1);
|
||||
# int a = 1;
|
||||
#
|
||||
# // Always true.
|
||||
# if(arr[_int_1] == _int_1)
|
||||
# {
|
||||
# a++;
|
||||
# }
|
||||
#
|
||||
# // Always false.
|
||||
# if (_int_1 == 0)
|
||||
# {
|
||||
# // Modulus of a negative value is undefined, but this is never executed.
|
||||
# if(-5 % a >= _int_1)
|
||||
# {
|
||||
# arr[v.x + v.y] = _int_0;
|
||||
# }
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# // arr[2] becomes two.
|
||||
# arr[v.x + v.y] = _int_2;
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == _int_2 && arr[_int_2] == _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: 132
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %113
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %11 "arr"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "_GLF_uniform_int_values"
|
||||
OpName %16 ""
|
||||
OpName %42 "v"
|
||||
OpName %47 "a"
|
||||
OpName %113 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpDecorate %113 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 10
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpConstant %7 3
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpConstant %6 0
|
||||
%18 = OpTypePointer Uniform %6
|
||||
%40 = OpTypeVector %6 2
|
||||
%41 = OpTypePointer Function %40
|
||||
%46 = OpTypePointer Function %6
|
||||
%48 = OpConstant %6 1
|
||||
%55 = OpTypeBool
|
||||
%66 = OpConstant %6 -5
|
||||
%74 = OpConstant %7 0
|
||||
%77 = OpConstant %7 1
|
||||
%90 = OpConstant %6 2
|
||||
%110 = OpTypeFloat 32
|
||||
%111 = OpTypeVector %110 4
|
||||
%112 = OpTypePointer Output %111
|
||||
%113 = OpVariable %112 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%42 = OpVariable %41 Function
|
||||
%47 = OpVariable %46 Function
|
||||
%19 = OpAccessChain %18 %16 %17 %17
|
||||
%20 = OpLoad %6 %19
|
||||
%21 = OpAccessChain %18 %16 %17 %17
|
||||
%22 = OpLoad %6 %21
|
||||
%23 = OpAccessChain %18 %16 %17 %17
|
||||
%24 = OpLoad %6 %23
|
||||
%25 = OpAccessChain %18 %16 %17 %17
|
||||
%26 = OpLoad %6 %25
|
||||
%27 = OpAccessChain %18 %16 %17 %17
|
||||
%28 = OpLoad %6 %27
|
||||
%29 = OpAccessChain %18 %16 %17 %17
|
||||
%30 = OpLoad %6 %29
|
||||
%31 = OpAccessChain %18 %16 %17 %17
|
||||
%32 = OpLoad %6 %31
|
||||
%33 = OpAccessChain %18 %16 %17 %17
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpAccessChain %18 %16 %17 %17
|
||||
%36 = OpLoad %6 %35
|
||||
%37 = OpAccessChain %18 %16 %17 %17
|
||||
%38 = OpLoad %6 %37
|
||||
%39 = OpCompositeConstruct %9 %20 %22 %24 %26 %28 %30 %32 %34 %36 %38
|
||||
OpStore %11 %39
|
||||
%43 = OpAccessChain %18 %16 %17 %17
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpCompositeConstruct %40 %44 %44
|
||||
OpStore %42 %45
|
||||
OpStore %47 %48
|
||||
%49 = OpAccessChain %18 %16 %17 %17
|
||||
%50 = OpLoad %6 %49
|
||||
%51 = OpAccessChain %46 %11 %50
|
||||
%52 = OpLoad %6 %51
|
||||
%53 = OpAccessChain %18 %16 %17 %17
|
||||
%54 = OpLoad %6 %53
|
||||
%56 = OpIEqual %55 %52 %54
|
||||
OpSelectionMerge %58 None
|
||||
OpBranchConditional %56 %57 %58
|
||||
%57 = OpLabel
|
||||
%59 = OpLoad %6 %47
|
||||
%60 = OpIAdd %6 %59 %48
|
||||
OpStore %47 %60
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
%61 = OpAccessChain %18 %16 %17 %17
|
||||
%62 = OpLoad %6 %61
|
||||
%63 = OpIEqual %55 %62 %17
|
||||
OpSelectionMerge %65 None
|
||||
OpBranchConditional %63 %64 %84
|
||||
%64 = OpLabel
|
||||
%67 = OpLoad %6 %47
|
||||
%68 = OpSMod %6 %66 %67
|
||||
%69 = OpAccessChain %18 %16 %17 %17
|
||||
%70 = OpLoad %6 %69
|
||||
%71 = OpSGreaterThanEqual %55 %68 %70
|
||||
OpSelectionMerge %73 None
|
||||
OpBranchConditional %71 %72 %73
|
||||
%72 = OpLabel
|
||||
%75 = OpAccessChain %46 %42 %74
|
||||
%76 = OpLoad %6 %75
|
||||
%78 = OpAccessChain %46 %42 %77
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpIAdd %6 %76 %79
|
||||
%81 = OpAccessChain %18 %16 %17 %48
|
||||
%82 = OpLoad %6 %81
|
||||
%83 = OpAccessChain %46 %11 %80
|
||||
OpStore %83 %82
|
||||
OpBranch %73
|
||||
%73 = OpLabel
|
||||
OpBranch %65
|
||||
%84 = OpLabel
|
||||
%85 = OpAccessChain %46 %42 %74
|
||||
%86 = OpLoad %6 %85
|
||||
%87 = OpAccessChain %46 %42 %77
|
||||
%88 = OpLoad %6 %87
|
||||
%89 = OpIAdd %6 %86 %88
|
||||
%91 = OpAccessChain %18 %16 %17 %90
|
||||
%92 = OpLoad %6 %91
|
||||
%93 = OpAccessChain %46 %11 %89
|
||||
OpStore %93 %92
|
||||
OpBranch %65
|
||||
%65 = OpLabel
|
||||
%94 = OpLoad %6 %47
|
||||
%95 = OpAccessChain %18 %16 %17 %90
|
||||
%96 = OpLoad %6 %95
|
||||
%97 = OpIEqual %55 %94 %96
|
||||
OpSelectionMerge %99 None
|
||||
OpBranchConditional %97 %98 %99
|
||||
%98 = OpLabel
|
||||
%100 = OpAccessChain %18 %16 %17 %90
|
||||
%101 = OpLoad %6 %100
|
||||
%102 = OpAccessChain %46 %11 %101
|
||||
%103 = OpLoad %6 %102
|
||||
%104 = OpAccessChain %18 %16 %17 %90
|
||||
%105 = OpLoad %6 %104
|
||||
%106 = OpIEqual %55 %103 %105
|
||||
OpBranch %99
|
||||
%99 = OpLabel
|
||||
%107 = OpPhi %55 %97 %65 %106 %98
|
||||
OpSelectionMerge %109 None
|
||||
OpBranchConditional %107 %108 %127
|
||||
%108 = OpLabel
|
||||
%114 = OpAccessChain %18 %16 %17 %17
|
||||
%115 = OpLoad %6 %114
|
||||
%116 = OpConvertSToF %110 %115
|
||||
%117 = OpAccessChain %18 %16 %17 %48
|
||||
%118 = OpLoad %6 %117
|
||||
%119 = OpConvertSToF %110 %118
|
||||
%120 = OpAccessChain %18 %16 %17 %48
|
||||
%121 = OpLoad %6 %120
|
||||
%122 = OpConvertSToF %110 %121
|
||||
%123 = OpAccessChain %18 %16 %17 %17
|
||||
%124 = OpLoad %6 %123
|
||||
%125 = OpConvertSToF %110 %124
|
||||
%126 = OpCompositeConstruct %111 %116 %119 %122 %125
|
||||
OpStore %113 %126
|
||||
OpBranch %109
|
||||
%127 = OpLabel
|
||||
%128 = OpAccessChain %18 %16 %17 %48
|
||||
%129 = OpLoad %6 %128
|
||||
%130 = OpConvertSToF %110 %129
|
||||
%131 = OpCompositeConstruct %111 %130 %130 %130 %130
|
||||
OpStore %113 %131
|
||||
OpBranch %109
|
||||
%109 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 2
|
||||
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__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
|
||||
@@ -0,0 +1,257 @@
|
||||
#!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 a specific instruction simplify code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_0_2 _GLF_uniform_float_values[2]
|
||||
# #define _float_0_95 _GLF_uniform_float_values[3]
|
||||
# #define _float_0_62 _GLF_uniform_float_values[4]
|
||||
# #define _float_0_63 _GLF_uniform_float_values[5]
|
||||
# #define _float_0_96 _GLF_uniform_float_values[6]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 0.2, 0.95, 0.62, 0.63, 0.96]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[7];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 v1 = vec4(_float_0_2, _float_0_2, _float_1_0, _float_0_2);
|
||||
#
|
||||
# // This results in an undefined value, but not in undefined behavior. v2 becomes
|
||||
# // [1.57, 1.11, undefined, 0.92]. The undefined z-component doesn't matter
|
||||
# // since it's not accessed when assigning the final color.
|
||||
# vec4 v2 = asin(vec4(1.0, 0.9, 1.1, 0.8));
|
||||
#
|
||||
# vec4 v3 = vec4(_float_1_0);
|
||||
# vec4 v4 = smoothstep(v1, v2, v3);
|
||||
#
|
||||
# _GLF_color = v4.xywx;
|
||||
#
|
||||
# if (v4.x > _float_0_62 && v4.x < _float_0_63 && v4.y > _float_0_95
|
||||
# && v4.y < _float_0_96 && v4.w == _float_1_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, _float_1_0);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(_float_0_0);
|
||||
# }
|
||||
# }
|
||||
DEVICE_EXTENSION VK_KHR_shader_float_controls
|
||||
DEVICE_PROPERTY FloatControlsProperties.shaderSignedZeroInfNanPreserveFloat32
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 110
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SignedZeroInfNanPreserve
|
||||
OpExtension "SPV_KHR_float_controls"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %45
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpExecutionMode %4 SignedZeroInfNanPreserve 32
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "v1"
|
||||
OpName %13 "buf0"
|
||||
OpMemberName %13 0 "_GLF_uniform_float_values"
|
||||
OpName %15 ""
|
||||
OpName %29 "v2"
|
||||
OpName %35 "v3"
|
||||
OpName %39 "v4"
|
||||
OpName %45 "_GLF_color"
|
||||
OpDecorate %12 ArrayStride 16
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %45 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 7
|
||||
%12 = OpTypeArray %6 %11
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpTypeInt 32 1
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpConstant %16 2
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%30 = OpConstant %6 1.57079637
|
||||
%31 = OpConstant %6 1.11976957
|
||||
%32 = OpConstant %6 0x1.8p+128
|
||||
%33 = OpConstant %6 0.927295208
|
||||
%34 = OpConstantComposite %7 %30 %31 %32 %33
|
||||
%44 = OpTypePointer Output %7
|
||||
%45 = OpVariable %44 Output
|
||||
%48 = OpTypeBool
|
||||
%49 = OpConstant %10 0
|
||||
%50 = OpTypePointer Function %6
|
||||
%53 = OpConstant %16 4
|
||||
%61 = OpConstant %16 5
|
||||
%68 = OpConstant %10 1
|
||||
%71 = OpConstant %16 3
|
||||
%80 = OpConstant %16 6
|
||||
%87 = OpConstant %10 3
|
||||
%98 = OpConstant %16 1
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%29 = OpVariable %8 Function
|
||||
%35 = OpVariable %8 Function
|
||||
%39 = OpVariable %8 Function
|
||||
%20 = OpAccessChain %19 %15 %17 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%22 = OpAccessChain %19 %15 %17 %18
|
||||
%23 = OpLoad %6 %22
|
||||
%24 = OpAccessChain %19 %15 %17 %17
|
||||
%25 = OpLoad %6 %24
|
||||
%26 = OpAccessChain %19 %15 %17 %18
|
||||
%27 = OpLoad %6 %26
|
||||
%28 = OpCompositeConstruct %7 %21 %23 %25 %27
|
||||
OpStore %9 %28
|
||||
OpStore %29 %34
|
||||
%36 = OpAccessChain %19 %15 %17 %17
|
||||
%37 = OpLoad %6 %36
|
||||
%38 = OpCompositeConstruct %7 %37 %37 %37 %37
|
||||
OpStore %35 %38
|
||||
%40 = OpLoad %7 %9
|
||||
%41 = OpLoad %7 %29
|
||||
%42 = OpLoad %7 %35
|
||||
%43 = OpExtInst %7 %1 SmoothStep %40 %41 %42
|
||||
OpStore %39 %43
|
||||
%46 = OpLoad %7 %39
|
||||
%47 = OpVectorShuffle %7 %46 %46 0 1 3 0
|
||||
OpStore %45 %47
|
||||
%51 = OpAccessChain %50 %39 %49
|
||||
%52 = OpLoad %6 %51
|
||||
%54 = OpAccessChain %19 %15 %17 %53
|
||||
%55 = OpLoad %6 %54
|
||||
%56 = OpFOrdGreaterThan %48 %52 %55
|
||||
OpSelectionMerge %58 None
|
||||
OpBranchConditional %56 %57 %58
|
||||
%57 = OpLabel
|
||||
%59 = OpAccessChain %50 %39 %49
|
||||
%60 = OpLoad %6 %59
|
||||
%62 = OpAccessChain %19 %15 %17 %61
|
||||
%63 = OpLoad %6 %62
|
||||
%64 = OpFOrdLessThan %48 %60 %63
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
%65 = OpPhi %48 %56 %5 %64 %57
|
||||
OpSelectionMerge %67 None
|
||||
OpBranchConditional %65 %66 %67
|
||||
%66 = OpLabel
|
||||
%69 = OpAccessChain %50 %39 %68
|
||||
%70 = OpLoad %6 %69
|
||||
%72 = OpAccessChain %19 %15 %17 %71
|
||||
%73 = OpLoad %6 %72
|
||||
%74 = OpFOrdGreaterThan %48 %70 %73
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
%75 = OpPhi %48 %65 %58 %74 %66
|
||||
OpSelectionMerge %77 None
|
||||
OpBranchConditional %75 %76 %77
|
||||
%76 = OpLabel
|
||||
%78 = OpAccessChain %50 %39 %68
|
||||
%79 = OpLoad %6 %78
|
||||
%81 = OpAccessChain %19 %15 %17 %80
|
||||
%82 = OpLoad %6 %81
|
||||
%83 = OpFOrdLessThan %48 %79 %82
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
%84 = OpPhi %48 %75 %67 %83 %76
|
||||
OpSelectionMerge %86 None
|
||||
OpBranchConditional %84 %85 %86
|
||||
%85 = OpLabel
|
||||
%88 = OpAccessChain %50 %39 %87
|
||||
%89 = OpLoad %6 %88
|
||||
%90 = OpAccessChain %19 %15 %17 %17
|
||||
%91 = OpLoad %6 %90
|
||||
%92 = OpFOrdEqual %48 %89 %91
|
||||
OpBranch %86
|
||||
%86 = OpLabel
|
||||
%93 = OpPhi %48 %84 %77 %92 %85
|
||||
OpSelectionMerge %95 None
|
||||
OpBranchConditional %93 %94 %106
|
||||
%94 = OpLabel
|
||||
%96 = OpAccessChain %19 %15 %17 %17
|
||||
%97 = OpLoad %6 %96
|
||||
%99 = OpAccessChain %19 %15 %17 %98
|
||||
%100 = OpLoad %6 %99
|
||||
%101 = OpAccessChain %19 %15 %17 %98
|
||||
%102 = OpLoad %6 %101
|
||||
%103 = OpAccessChain %19 %15 %17 %17
|
||||
%104 = OpLoad %6 %103
|
||||
%105 = OpCompositeConstruct %7 %97 %100 %102 %104
|
||||
OpStore %45 %105
|
||||
OpBranch %95
|
||||
%106 = OpLabel
|
||||
%107 = OpAccessChain %19 %15 %17 %98
|
||||
%108 = OpLoad %6 %107
|
||||
%109 = OpCompositeConstruct %7 %108 %108 %108 %108
|
||||
OpStore %45 %109
|
||||
OpBranch %95
|
||||
%95 = 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 0.2 0.95 0.62 0.63 0.96
|
||||
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 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
|
||||
@@ -0,0 +1,214 @@
|
||||
#!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 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_1 _GLF_uniform_int_values[1]
|
||||
# #define _float_1_58 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_55 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.58, 1.55]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 1) uniform buf1 {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 v = vec4(_int_0, _int_0, -621.596, _int_0);
|
||||
# float f = atan(trunc(v)).z;
|
||||
#
|
||||
# // Always true.
|
||||
# if(f > - _float_1_58 && f < - _float_1_55)
|
||||
# {
|
||||
# _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: 78
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %59
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "v"
|
||||
OpName %14 "buf1"
|
||||
OpMemberName %14 0 "_GLF_uniform_int_values"
|
||||
OpName %16 ""
|
||||
OpName %31 "f"
|
||||
OpName %39 "buf0"
|
||||
OpMemberName %39 0 "_GLF_uniform_float_values"
|
||||
OpName %41 ""
|
||||
OpName %59 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %38 ArrayStride 16
|
||||
OpMemberDecorate %39 0 Offset 0
|
||||
OpDecorate %39 Block
|
||||
OpDecorate %41 DescriptorSet 0
|
||||
OpDecorate %41 Binding 0
|
||||
OpDecorate %59 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 1
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 2
|
||||
%13 = OpTypeArray %10 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpConstant %10 0
|
||||
%18 = OpTypePointer Uniform %10
|
||||
%25 = OpConstant %6 -621.596008
|
||||
%30 = OpTypePointer Function %6
|
||||
%36 = OpTypeBool
|
||||
%38 = OpTypeArray %6 %12
|
||||
%39 = OpTypeStruct %38
|
||||
%40 = OpTypePointer Uniform %39
|
||||
%41 = OpVariable %40 Uniform
|
||||
%42 = OpTypePointer Uniform %6
|
||||
%50 = OpConstant %10 1
|
||||
%58 = OpTypePointer Output %7
|
||||
%59 = OpVariable %58 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%31 = OpVariable %30 Function
|
||||
%19 = OpAccessChain %18 %16 %17 %17
|
||||
%20 = OpLoad %10 %19
|
||||
%21 = OpConvertSToF %6 %20
|
||||
%22 = OpAccessChain %18 %16 %17 %17
|
||||
%23 = OpLoad %10 %22
|
||||
%24 = OpConvertSToF %6 %23
|
||||
%26 = OpAccessChain %18 %16 %17 %17
|
||||
%27 = OpLoad %10 %26
|
||||
%28 = OpConvertSToF %6 %27
|
||||
%29 = OpCompositeConstruct %7 %21 %24 %25 %28
|
||||
OpStore %9 %29
|
||||
%32 = OpLoad %7 %9
|
||||
%33 = OpExtInst %7 %1 Trunc %32
|
||||
%34 = OpExtInst %7 %1 Atan %33
|
||||
%35 = OpCompositeExtract %6 %34 2
|
||||
OpStore %31 %35
|
||||
%37 = OpLoad %6 %31
|
||||
%43 = OpAccessChain %42 %41 %17 %17
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpFNegate %6 %44
|
||||
%46 = OpFOrdGreaterThan %36 %37 %45
|
||||
OpSelectionMerge %48 None
|
||||
OpBranchConditional %46 %47 %48
|
||||
%47 = OpLabel
|
||||
%49 = OpLoad %6 %31
|
||||
%51 = OpAccessChain %42 %41 %17 %50
|
||||
%52 = OpLoad %6 %51
|
||||
%53 = OpFNegate %6 %52
|
||||
%54 = OpFOrdLessThan %36 %49 %53
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%55 = OpPhi %36 %46 %5 %54 %47
|
||||
OpSelectionMerge %57 None
|
||||
OpBranchConditional %55 %56 %73
|
||||
%56 = OpLabel
|
||||
%60 = OpAccessChain %18 %16 %17 %50
|
||||
%61 = OpLoad %10 %60
|
||||
%62 = OpConvertSToF %6 %61
|
||||
%63 = OpAccessChain %18 %16 %17 %17
|
||||
%64 = OpLoad %10 %63
|
||||
%65 = OpConvertSToF %6 %64
|
||||
%66 = OpAccessChain %18 %16 %17 %17
|
||||
%67 = OpLoad %10 %66
|
||||
%68 = OpConvertSToF %6 %67
|
||||
%69 = OpAccessChain %18 %16 %17 %50
|
||||
%70 = OpLoad %10 %69
|
||||
%71 = OpConvertSToF %6 %70
|
||||
%72 = OpCompositeConstruct %7 %62 %65 %68 %71
|
||||
OpStore %59 %72
|
||||
OpBranch %57
|
||||
%73 = OpLabel
|
||||
%74 = OpAccessChain %18 %16 %17 %17
|
||||
%75 = OpLoad %10 %74
|
||||
%76 = OpConvertSToF %6 %75
|
||||
%77 = OpCompositeConstruct %7 %76 %76 %76 %76
|
||||
OpStore %59 %77
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.58 1.55
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,200 @@
|
||||
#!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.
|
||||
|
||||
DEVICE_EXTENSION VK_KHR_shader_terminate_invocation
|
||||
|
||||
# A test for a coverage-gap found by GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific basic block code path
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--vector-dce'
|
||||
# '--combine-access-chains'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--scalar-replacement=100'
|
||||
# '--simplify-instructions'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--combine-access-chains'
|
||||
# '--simplify-instructions'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int zero;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# int func(int x)
|
||||
# {
|
||||
# if (x == 10) // Always false.
|
||||
# discard;
|
||||
#
|
||||
# return x;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = 0;
|
||||
# int b = zero;
|
||||
#
|
||||
# do
|
||||
# {
|
||||
# a = func(b);
|
||||
# b++;
|
||||
# }
|
||||
# while(b < 4);
|
||||
#
|
||||
# if (a == 3)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 59
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %52
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "func(i1;"
|
||||
OpName %9 "x"
|
||||
OpName %22 "a"
|
||||
OpName %24 "b"
|
||||
OpName %25 "buf0"
|
||||
OpMemberName %25 0 "zero"
|
||||
OpName %27 ""
|
||||
OpName %35 "param"
|
||||
OpName %52 "_GLF_color"
|
||||
OpMemberDecorate %25 0 Offset 0
|
||||
OpDecorate %25 Block
|
||||
OpDecorate %27 DescriptorSet 0
|
||||
OpDecorate %27 Binding 0
|
||||
OpDecorate %52 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%8 = OpTypeFunction %6 %7
|
||||
%13 = OpConstant %6 10
|
||||
%14 = OpTypeBool
|
||||
%23 = OpConstant %6 0
|
||||
%25 = OpTypeStruct %6
|
||||
%26 = OpTypePointer Uniform %25
|
||||
%27 = OpVariable %26 Uniform
|
||||
%28 = OpTypePointer Uniform %6
|
||||
%39 = OpConstant %6 1
|
||||
%42 = OpConstant %6 4
|
||||
%45 = OpConstant %6 3
|
||||
%49 = OpTypeFloat 32
|
||||
%50 = OpTypeVector %49 4
|
||||
%51 = OpTypePointer Output %50
|
||||
%52 = OpVariable %51 Output
|
||||
%53 = OpConstant %49 1
|
||||
%54 = OpConstant %49 0
|
||||
%55 = OpConstantComposite %50 %53 %54 %54 %53
|
||||
%57 = OpConstantComposite %50 %54 %54 %54 %54
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%22 = OpVariable %7 Function
|
||||
%24 = OpVariable %7 Function
|
||||
%35 = OpVariable %7 Function
|
||||
OpStore %22 %23
|
||||
%29 = OpAccessChain %28 %27 %23
|
||||
%30 = OpLoad %6 %29
|
||||
OpStore %24 %30
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%58 = OpPhi %6 %30 %5 %40 %31
|
||||
OpStore %35 %58
|
||||
%37 = OpFunctionCall %6 %10 %35
|
||||
OpStore %22 %37
|
||||
%40 = OpIAdd %6 %58 %39
|
||||
OpStore %24 %40
|
||||
%43 = OpSLessThan %14 %40 %42
|
||||
OpLoopMerge %33 %31 None
|
||||
OpBranchConditional %43 %31 %33
|
||||
%33 = OpLabel
|
||||
%46 = OpIEqual %14 %37 %45
|
||||
OpSelectionMerge %48 None
|
||||
OpBranchConditional %46 %47 %56
|
||||
%47 = OpLabel
|
||||
OpStore %52 %55
|
||||
OpBranch %48
|
||||
%56 = OpLabel
|
||||
OpStore %52 %57
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%10 = OpFunction %6 None %8
|
||||
%9 = OpFunctionParameter %7
|
||||
%11 = OpLabel
|
||||
%12 = OpLoad %6 %9
|
||||
%15 = OpIEqual %14 %12 %13
|
||||
OpSelectionMerge %17 None
|
||||
OpBranchConditional %15 %16 %17
|
||||
%16 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%17 = OpLabel
|
||||
%19 = OpLoad %6 %9
|
||||
OpReturnValue %19
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE int32 DATA
|
||||
0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,252 @@
|
||||
#!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: Covers specific inst combine add sub and inst combine simplify demanded 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 310 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 _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 2]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# int f1()
|
||||
# {
|
||||
# int a = 256;
|
||||
#
|
||||
# if (gl_FragCoord.y > _float_0_0)
|
||||
# {
|
||||
# a++;
|
||||
# }
|
||||
#
|
||||
# // i becomes 2.
|
||||
# int i = bitCount(a);
|
||||
#
|
||||
# if (i < _int_1)
|
||||
# {
|
||||
# return _int_1;
|
||||
# }
|
||||
#
|
||||
# // Always returns 2.
|
||||
# return i;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = f1();
|
||||
#
|
||||
# if (a == _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: 87
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %16 %68
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "f1("
|
||||
OpName %11 "a"
|
||||
OpName %16 "gl_FragCoord"
|
||||
OpName %23 "buf0"
|
||||
OpMemberName %23 0 "_GLF_uniform_float_values"
|
||||
OpName %25 ""
|
||||
OpName %37 "i"
|
||||
OpName %43 "buf1"
|
||||
OpMemberName %43 0 "_GLF_uniform_int_values"
|
||||
OpName %45 ""
|
||||
OpName %58 "a"
|
||||
OpName %68 "_GLF_color"
|
||||
OpDecorate %16 BuiltIn FragCoord
|
||||
OpDecorate %22 ArrayStride 16
|
||||
OpMemberDecorate %23 0 Offset 0
|
||||
OpDecorate %23 Block
|
||||
OpDecorate %25 DescriptorSet 0
|
||||
OpDecorate %25 Binding 0
|
||||
OpDecorate %42 ArrayStride 16
|
||||
OpMemberDecorate %43 0 Offset 0
|
||||
OpDecorate %43 Block
|
||||
OpDecorate %45 DescriptorSet 0
|
||||
OpDecorate %45 Binding 1
|
||||
OpDecorate %68 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeFunction %6
|
||||
%10 = OpTypePointer Function %6
|
||||
%12 = OpConstant %6 256
|
||||
%13 = OpTypeFloat 32
|
||||
%14 = OpTypeVector %13 4
|
||||
%15 = OpTypePointer Input %14
|
||||
%16 = OpVariable %15 Input
|
||||
%17 = OpTypeInt 32 0
|
||||
%18 = OpConstant %17 1
|
||||
%19 = OpTypePointer Input %13
|
||||
%22 = OpTypeArray %13 %18
|
||||
%23 = OpTypeStruct %22
|
||||
%24 = OpTypePointer Uniform %23
|
||||
%25 = OpVariable %24 Uniform
|
||||
%26 = OpConstant %6 0
|
||||
%27 = OpTypePointer Uniform %13
|
||||
%30 = OpTypeBool
|
||||
%35 = OpConstant %6 1
|
||||
%41 = OpConstant %17 3
|
||||
%42 = OpTypeArray %6 %41
|
||||
%43 = OpTypeStruct %42
|
||||
%44 = OpTypePointer Uniform %43
|
||||
%45 = OpVariable %44 Uniform
|
||||
%46 = OpTypePointer Uniform %6
|
||||
%61 = OpConstant %6 2
|
||||
%67 = OpTypePointer Output %14
|
||||
%68 = OpVariable %67 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%58 = OpVariable %10 Function
|
||||
%59 = OpFunctionCall %6 %8
|
||||
OpStore %58 %59
|
||||
%60 = OpLoad %6 %58
|
||||
%62 = OpAccessChain %46 %45 %26 %61
|
||||
%63 = OpLoad %6 %62
|
||||
%64 = OpIEqual %30 %60 %63
|
||||
OpSelectionMerge %66 None
|
||||
OpBranchConditional %64 %65 %82
|
||||
%65 = OpLabel
|
||||
%69 = OpAccessChain %46 %45 %26 %26
|
||||
%70 = OpLoad %6 %69
|
||||
%71 = OpConvertSToF %13 %70
|
||||
%72 = OpAccessChain %46 %45 %26 %35
|
||||
%73 = OpLoad %6 %72
|
||||
%74 = OpConvertSToF %13 %73
|
||||
%75 = OpAccessChain %46 %45 %26 %35
|
||||
%76 = OpLoad %6 %75
|
||||
%77 = OpConvertSToF %13 %76
|
||||
%78 = OpAccessChain %46 %45 %26 %26
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpConvertSToF %13 %79
|
||||
%81 = OpCompositeConstruct %14 %71 %74 %77 %80
|
||||
OpStore %68 %81
|
||||
OpBranch %66
|
||||
%82 = OpLabel
|
||||
%83 = OpAccessChain %46 %45 %26 %35
|
||||
%84 = OpLoad %6 %83
|
||||
%85 = OpConvertSToF %13 %84
|
||||
%86 = OpCompositeConstruct %14 %85 %85 %85 %85
|
||||
OpStore %68 %86
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%8 = OpFunction %6 None %7
|
||||
%9 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%37 = OpVariable %10 Function
|
||||
OpStore %11 %12
|
||||
%20 = OpAccessChain %19 %16 %18
|
||||
%21 = OpLoad %13 %20
|
||||
%28 = OpAccessChain %27 %25 %26 %26
|
||||
%29 = OpLoad %13 %28
|
||||
%31 = OpFOrdGreaterThan %30 %21 %29
|
||||
OpSelectionMerge %33 None
|
||||
OpBranchConditional %31 %32 %33
|
||||
%32 = OpLabel
|
||||
%34 = OpLoad %6 %11
|
||||
%36 = OpIAdd %6 %34 %35
|
||||
OpStore %11 %36
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%38 = OpLoad %6 %11
|
||||
%39 = OpBitCount %6 %38
|
||||
OpStore %37 %39
|
||||
%40 = OpLoad %6 %37
|
||||
%47 = OpAccessChain %46 %45 %26 %26
|
||||
%48 = OpLoad %6 %47
|
||||
%49 = OpSLessThan %30 %40 %48
|
||||
OpSelectionMerge %51 None
|
||||
OpBranchConditional %49 %50 %51
|
||||
%50 = OpLabel
|
||||
%52 = OpAccessChain %46 %45 %26 %26
|
||||
%53 = OpLoad %6 %52
|
||||
OpReturnValue %53
|
||||
%51 = OpLabel
|
||||
%55 = OpLoad %6 %37
|
||||
OpReturnValue %55
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 2
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,176 @@
|
||||
#!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 a specific constant fold code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# uint a = 0x77777777u;
|
||||
#
|
||||
# // b becomes undefined. This results in an undefined value, but not in undefined behavior.
|
||||
# uint b = bitfieldExtract(a, -1, 1);
|
||||
#
|
||||
# uint c = a | b;
|
||||
#
|
||||
# // Always true.
|
||||
# if ((c & a) == a)
|
||||
# {
|
||||
# _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: 57
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %31
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %10 "b"
|
||||
OpName %16 "c"
|
||||
OpName %31 "_GLF_color"
|
||||
OpName %34 "buf0"
|
||||
OpMemberName %34 0 "_GLF_uniform_int_values"
|
||||
OpName %36 ""
|
||||
OpDecorate %31 Location 0
|
||||
OpDecorate %33 ArrayStride 16
|
||||
OpMemberDecorate %34 0 Offset 0
|
||||
OpDecorate %34 Block
|
||||
OpDecorate %36 DescriptorSet 0
|
||||
OpDecorate %36 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 0
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 2004318071
|
||||
%12 = OpTypeInt 32 1
|
||||
%13 = OpConstant %12 -1
|
||||
%14 = OpConstant %12 1
|
||||
%24 = OpTypeBool
|
||||
%28 = OpTypeFloat 32
|
||||
%29 = OpTypeVector %28 4
|
||||
%30 = OpTypePointer Output %29
|
||||
%31 = OpVariable %30 Output
|
||||
%32 = OpConstant %6 2
|
||||
%33 = OpTypeArray %12 %32
|
||||
%34 = OpTypeStruct %33
|
||||
%35 = OpTypePointer Uniform %34
|
||||
%36 = OpVariable %35 Uniform
|
||||
%37 = OpConstant %12 0
|
||||
%38 = OpTypePointer Uniform %12
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpVariable %7 Function
|
||||
%16 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%11 = OpLoad %6 %8
|
||||
%15 = OpBitFieldUExtract %6 %11 %13 %14
|
||||
OpStore %10 %15
|
||||
%17 = OpLoad %6 %8
|
||||
%18 = OpLoad %6 %10
|
||||
%19 = OpBitwiseOr %6 %17 %18
|
||||
OpStore %16 %19
|
||||
%20 = OpLoad %6 %16
|
||||
%21 = OpLoad %6 %8
|
||||
%22 = OpBitwiseAnd %6 %20 %21
|
||||
%23 = OpLoad %6 %8
|
||||
%25 = OpIEqual %24 %22 %23
|
||||
OpSelectionMerge %27 None
|
||||
OpBranchConditional %25 %26 %52
|
||||
%26 = OpLabel
|
||||
%39 = OpAccessChain %38 %36 %37 %37
|
||||
%40 = OpLoad %12 %39
|
||||
%41 = OpConvertSToF %28 %40
|
||||
%42 = OpAccessChain %38 %36 %37 %14
|
||||
%43 = OpLoad %12 %42
|
||||
%44 = OpConvertSToF %28 %43
|
||||
%45 = OpAccessChain %38 %36 %37 %14
|
||||
%46 = OpLoad %12 %45
|
||||
%47 = OpConvertSToF %28 %46
|
||||
%48 = OpAccessChain %38 %36 %37 %37
|
||||
%49 = OpLoad %12 %48
|
||||
%50 = OpConvertSToF %28 %49
|
||||
%51 = OpCompositeConstruct %29 %41 %44 %47 %50
|
||||
OpStore %31 %51
|
||||
OpBranch %27
|
||||
%52 = OpLabel
|
||||
%53 = OpAccessChain %38 %36 %37 %14
|
||||
%54 = OpLoad %12 %53
|
||||
%55 = OpConvertSToF %28 %54
|
||||
%56 = OpCompositeConstruct %29 %55 %55 %55 %55
|
||||
OpStore %31 %56
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,303 @@
|
||||
#!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 a specific instruction simplify code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_32 _GLF_uniform_int_values[1]
|
||||
# #define _int_0 _GLF_uniform_int_values[2]
|
||||
# #define _int_10 _GLF_uniform_int_values[3]
|
||||
# #define _int_2 _GLF_uniform_int_values[4]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_int_values: [1, 32, 0, 10]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[5];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = _int_0;
|
||||
# int b = _int_10;
|
||||
# int c = 1;
|
||||
#
|
||||
# // Always false.
|
||||
# if (gl_FragCoord.x < _float_0_0)
|
||||
# c--;
|
||||
#
|
||||
# // This results in an undefined value, but not in undefined behavior. Assigning
|
||||
# // an undefined value doesn't matter since d is reassigned a value >= 2 before
|
||||
# // using it.
|
||||
# int d = bitfieldInsert(1, 1, 32, c);
|
||||
#
|
||||
# if (d < _int_1)
|
||||
# d = _int_2;
|
||||
#
|
||||
# while ((a < b) || (d < _int_1))
|
||||
# {
|
||||
# d = bitfieldInsert(_int_1, _int_1, _int_32, c);
|
||||
#
|
||||
# if (d < _int_1)
|
||||
# d = _int_2;
|
||||
#
|
||||
# a++;
|
||||
# }
|
||||
#
|
||||
# if (a == _int_10)
|
||||
# _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: 121
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %29 %102
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %12 "buf1"
|
||||
OpMemberName %12 0 "_GLF_uniform_int_values"
|
||||
OpName %14 ""
|
||||
OpName %20 "b"
|
||||
OpName %24 "c"
|
||||
OpName %29 "gl_FragCoord"
|
||||
OpName %36 "buf0"
|
||||
OpMemberName %36 0 "_GLF_uniform_float_values"
|
||||
OpName %38 ""
|
||||
OpName %48 "d"
|
||||
OpName %102 "_GLF_color"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 1
|
||||
OpDecorate %29 BuiltIn FragCoord
|
||||
OpDecorate %35 ArrayStride 16
|
||||
OpMemberDecorate %36 0 Offset 0
|
||||
OpDecorate %36 Block
|
||||
OpDecorate %38 DescriptorSet 0
|
||||
OpDecorate %38 Binding 0
|
||||
OpDecorate %102 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 = OpConstant %6 2
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%21 = OpConstant %6 3
|
||||
%25 = OpConstant %6 1
|
||||
%26 = OpTypeFloat 32
|
||||
%27 = OpTypeVector %26 4
|
||||
%28 = OpTypePointer Input %27
|
||||
%29 = OpVariable %28 Input
|
||||
%30 = OpConstant %9 0
|
||||
%31 = OpTypePointer Input %26
|
||||
%34 = OpConstant %9 1
|
||||
%35 = OpTypeArray %26 %34
|
||||
%36 = OpTypeStruct %35
|
||||
%37 = OpTypePointer Uniform %36
|
||||
%38 = OpVariable %37 Uniform
|
||||
%39 = OpTypePointer Uniform %26
|
||||
%42 = OpTypeBool
|
||||
%49 = OpConstant %6 32
|
||||
%58 = OpConstant %6 4
|
||||
%101 = OpTypePointer Output %27
|
||||
%102 = OpVariable %101 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%20 = OpVariable %7 Function
|
||||
%24 = OpVariable %7 Function
|
||||
%48 = OpVariable %7 Function
|
||||
%18 = OpAccessChain %17 %14 %15 %16
|
||||
%19 = OpLoad %6 %18
|
||||
OpStore %8 %19
|
||||
%22 = OpAccessChain %17 %14 %15 %21
|
||||
%23 = OpLoad %6 %22
|
||||
OpStore %20 %23
|
||||
OpStore %24 %25
|
||||
%32 = OpAccessChain %31 %29 %30
|
||||
%33 = OpLoad %26 %32
|
||||
%40 = OpAccessChain %39 %38 %15 %15
|
||||
%41 = OpLoad %26 %40
|
||||
%43 = OpFOrdLessThan %42 %33 %41
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %43 %44 %45
|
||||
%44 = OpLabel
|
||||
%46 = OpLoad %6 %24
|
||||
%47 = OpISub %6 %46 %25
|
||||
OpStore %24 %47
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
%50 = OpLoad %6 %24
|
||||
%51 = OpBitFieldInsert %6 %25 %25 %49 %50
|
||||
OpStore %48 %51
|
||||
%52 = OpLoad %6 %48
|
||||
%53 = OpAccessChain %17 %14 %15 %15
|
||||
%54 = OpLoad %6 %53
|
||||
%55 = OpSLessThan %42 %52 %54
|
||||
OpSelectionMerge %57 None
|
||||
OpBranchConditional %55 %56 %57
|
||||
%56 = OpLabel
|
||||
%59 = OpAccessChain %17 %14 %15 %58
|
||||
%60 = OpLoad %6 %59
|
||||
OpStore %48 %60
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
OpLoopMerge %63 %64 None
|
||||
OpBranch %65
|
||||
%65 = OpLabel
|
||||
%66 = OpLoad %6 %8
|
||||
%67 = OpLoad %6 %20
|
||||
%68 = OpSLessThan %42 %66 %67
|
||||
%69 = OpLogicalNot %42 %68
|
||||
OpSelectionMerge %71 None
|
||||
OpBranchConditional %69 %70 %71
|
||||
%70 = OpLabel
|
||||
%72 = OpLoad %6 %48
|
||||
%73 = OpAccessChain %17 %14 %15 %15
|
||||
%74 = OpLoad %6 %73
|
||||
%75 = OpSLessThan %42 %72 %74
|
||||
OpBranch %71
|
||||
%71 = OpLabel
|
||||
%76 = OpPhi %42 %68 %65 %75 %70
|
||||
OpBranchConditional %76 %62 %63
|
||||
%62 = OpLabel
|
||||
%77 = OpAccessChain %17 %14 %15 %15
|
||||
%78 = OpLoad %6 %77
|
||||
%79 = OpAccessChain %17 %14 %15 %15
|
||||
%80 = OpLoad %6 %79
|
||||
%81 = OpAccessChain %17 %14 %15 %25
|
||||
%82 = OpLoad %6 %81
|
||||
%83 = OpLoad %6 %24
|
||||
%84 = OpBitFieldInsert %6 %78 %80 %82 %83
|
||||
OpStore %48 %84
|
||||
%85 = OpLoad %6 %48
|
||||
%86 = OpAccessChain %17 %14 %15 %15
|
||||
%87 = OpLoad %6 %86
|
||||
%88 = OpSLessThan %42 %85 %87
|
||||
OpSelectionMerge %90 None
|
||||
OpBranchConditional %88 %89 %90
|
||||
%89 = OpLabel
|
||||
%91 = OpAccessChain %17 %14 %15 %58
|
||||
%92 = OpLoad %6 %91
|
||||
OpStore %48 %92
|
||||
OpBranch %90
|
||||
%90 = OpLabel
|
||||
%93 = OpLoad %6 %8
|
||||
%94 = OpIAdd %6 %93 %25
|
||||
OpStore %8 %94
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
OpBranch %61
|
||||
%63 = OpLabel
|
||||
%95 = OpLoad %6 %8
|
||||
%96 = OpAccessChain %17 %14 %15 %21
|
||||
%97 = OpLoad %6 %96
|
||||
%98 = OpIEqual %42 %95 %97
|
||||
OpSelectionMerge %100 None
|
||||
OpBranchConditional %98 %99 %116
|
||||
%99 = OpLabel
|
||||
%103 = OpAccessChain %17 %14 %15 %15
|
||||
%104 = OpLoad %6 %103
|
||||
%105 = OpConvertSToF %26 %104
|
||||
%106 = OpAccessChain %17 %14 %15 %16
|
||||
%107 = OpLoad %6 %106
|
||||
%108 = OpConvertSToF %26 %107
|
||||
%109 = OpAccessChain %17 %14 %15 %16
|
||||
%110 = OpLoad %6 %109
|
||||
%111 = OpConvertSToF %26 %110
|
||||
%112 = OpAccessChain %17 %14 %15 %15
|
||||
%113 = OpLoad %6 %112
|
||||
%114 = OpConvertSToF %26 %113
|
||||
%115 = OpCompositeConstruct %27 %105 %108 %111 %114
|
||||
OpStore %102 %115
|
||||
OpBranch %100
|
||||
%116 = OpLabel
|
||||
%117 = OpAccessChain %17 %14 %15 %16
|
||||
%118 = OpLoad %6 %117
|
||||
%119 = OpConvertSToF %26 %118
|
||||
%120 = OpCompositeConstruct %27 %119 %119 %119 %119
|
||||
OpStore %102 %120
|
||||
OpBranch %100
|
||||
%100 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 32 0 10 2
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,179 @@
|
||||
#!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: Covers specific DAG combiner and legalize vector ops 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // a becomes -2147483648.
|
||||
# int a = bitfieldReverse(1);
|
||||
#
|
||||
# // a is negative therefore this results in an undefined value, but not in undefined behavior.
|
||||
# int b = 1 << a;
|
||||
#
|
||||
# int c = findMSB(b);
|
||||
#
|
||||
# _GLF_color = vec4(c);
|
||||
#
|
||||
# if (a == -2147483648)
|
||||
# {
|
||||
# _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: 56
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %20
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %11 "b"
|
||||
OpName %14 "c"
|
||||
OpName %20 "_GLF_color"
|
||||
OpName %33 "buf0"
|
||||
OpMemberName %33 0 "_GLF_uniform_int_values"
|
||||
OpName %35 ""
|
||||
OpDecorate %20 Location 0
|
||||
OpDecorate %32 ArrayStride 16
|
||||
OpMemberDecorate %33 0 Offset 0
|
||||
OpDecorate %33 Block
|
||||
OpDecorate %35 DescriptorSet 0
|
||||
OpDecorate %35 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 1
|
||||
%17 = OpTypeFloat 32
|
||||
%18 = OpTypeVector %17 4
|
||||
%19 = OpTypePointer Output %18
|
||||
%20 = OpVariable %19 Output
|
||||
%25 = OpConstant %6 -2147483648
|
||||
%26 = OpTypeBool
|
||||
%30 = OpTypeInt 32 0
|
||||
%31 = OpConstant %30 2
|
||||
%32 = OpTypeArray %6 %31
|
||||
%33 = OpTypeStruct %32
|
||||
%34 = OpTypePointer Uniform %33
|
||||
%35 = OpVariable %34 Uniform
|
||||
%36 = OpConstant %6 0
|
||||
%37 = OpTypePointer Uniform %6
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%11 = OpVariable %7 Function
|
||||
%14 = OpVariable %7 Function
|
||||
%10 = OpBitReverse %6 %9
|
||||
OpStore %8 %10
|
||||
%12 = OpLoad %6 %8
|
||||
%13 = OpShiftLeftLogical %6 %9 %12
|
||||
OpStore %11 %13
|
||||
%15 = OpLoad %6 %11
|
||||
%16 = OpExtInst %6 %1 FindSMsb %15
|
||||
OpStore %14 %16
|
||||
%21 = OpLoad %6 %14
|
||||
%22 = OpConvertSToF %17 %21
|
||||
%23 = OpCompositeConstruct %18 %22 %22 %22 %22
|
||||
OpStore %20 %23
|
||||
%24 = OpLoad %6 %8
|
||||
%27 = OpIEqual %26 %24 %25
|
||||
OpSelectionMerge %29 None
|
||||
OpBranchConditional %27 %28 %51
|
||||
%28 = OpLabel
|
||||
%38 = OpAccessChain %37 %35 %36 %36
|
||||
%39 = OpLoad %6 %38
|
||||
%40 = OpConvertSToF %17 %39
|
||||
%41 = OpAccessChain %37 %35 %36 %9
|
||||
%42 = OpLoad %6 %41
|
||||
%43 = OpConvertSToF %17 %42
|
||||
%44 = OpAccessChain %37 %35 %36 %9
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpConvertSToF %17 %45
|
||||
%47 = OpAccessChain %37 %35 %36 %36
|
||||
%48 = OpLoad %6 %47
|
||||
%49 = OpConvertSToF %17 %48
|
||||
%50 = OpCompositeConstruct %18 %40 %43 %46 %49
|
||||
OpStore %20 %50
|
||||
OpBranch %29
|
||||
%51 = OpLabel
|
||||
%52 = OpAccessChain %37 %35 %36 %9
|
||||
%53 = OpLoad %6 %52
|
||||
%54 = OpConvertSToF %17 %53
|
||||
%55 = OpCompositeConstruct %18 %54 %54 %54 %54
|
||||
OpStore %20 %55
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,199 @@
|
||||
#!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 NIR 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_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_6 _GLF_uniform_int_values[2]
|
||||
# #define _int_5 _GLF_uniform_int_values[3]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 6, 5]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // a becomes 0x8000000 which is the smallest possible negative integer.
|
||||
# int a = min(1, bitfieldReverse(1));
|
||||
# int b = _int_5;
|
||||
#
|
||||
# // a - 1 underflowa to the largest positive integer. The loop is executed
|
||||
# // once because of the break inside.
|
||||
# for (int i = 1; i <= a - 1; i++)
|
||||
# {
|
||||
# b += i;
|
||||
#
|
||||
# // Always true.
|
||||
# if (_int_1 == 1)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if (b == _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: 78
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %56
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %16 "buf0"
|
||||
OpMemberName %16 0 "_GLF_uniform_int_values"
|
||||
OpName %18 ""
|
||||
OpName %56 "_GLF_color"
|
||||
OpDecorate %15 ArrayStride 16
|
||||
OpMemberDecorate %16 0 Offset 0
|
||||
OpDecorate %16 Block
|
||||
OpDecorate %18 DescriptorSet 0
|
||||
OpDecorate %18 Binding 0
|
||||
OpDecorate %56 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%9 = OpConstant %6 1
|
||||
%13 = OpTypeInt 32 0
|
||||
%14 = OpConstant %13 4
|
||||
%15 = OpTypeArray %6 %14
|
||||
%16 = OpTypeStruct %15
|
||||
%17 = OpTypePointer Uniform %16
|
||||
%18 = OpVariable %17 Uniform
|
||||
%19 = OpConstant %6 0
|
||||
%20 = OpConstant %6 3
|
||||
%21 = OpTypePointer Uniform %6
|
||||
%33 = OpTypeBool
|
||||
%47 = OpConstant %6 2
|
||||
%53 = OpTypeFloat 32
|
||||
%54 = OpTypeVector %53 4
|
||||
%55 = OpTypePointer Output %54
|
||||
%56 = OpVariable %55 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%10 = OpBitReverse %6 %9
|
||||
%11 = OpExtInst %6 %1 SMin %9 %10
|
||||
%22 = OpAccessChain %21 %18 %19 %20
|
||||
%23 = OpLoad %6 %22
|
||||
OpBranch %25
|
||||
%25 = OpLabel
|
||||
%76 = OpPhi %6 %23 %5 %37 %28
|
||||
%75 = OpPhi %6 %9 %5 %45 %28
|
||||
%32 = OpISub %6 %11 %9
|
||||
%34 = OpSLessThanEqual %33 %75 %32
|
||||
OpLoopMerge %27 %28 None
|
||||
OpBranchConditional %34 %26 %27
|
||||
%26 = OpLabel
|
||||
%37 = OpIAdd %6 %76 %75
|
||||
%38 = OpAccessChain %21 %18 %19 %19
|
||||
%39 = OpLoad %6 %38
|
||||
%40 = OpIEqual %33 %39 %9
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %40 %41 %42
|
||||
%41 = OpLabel
|
||||
OpBranch %27
|
||||
%42 = OpLabel
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
%45 = OpIAdd %6 %75 %9
|
||||
OpBranch %25
|
||||
%27 = OpLabel
|
||||
%77 = OpPhi %6 %76 %25 %37 %41
|
||||
%48 = OpAccessChain %21 %18 %19 %47
|
||||
%49 = OpLoad %6 %48
|
||||
%50 = OpIEqual %33 %77 %49
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %50 %51 %70
|
||||
%51 = OpLabel
|
||||
%57 = OpAccessChain %21 %18 %19 %19
|
||||
%58 = OpLoad %6 %57
|
||||
%59 = OpConvertSToF %53 %58
|
||||
%60 = OpAccessChain %21 %18 %19 %9
|
||||
%61 = OpLoad %6 %60
|
||||
%62 = OpConvertSToF %53 %61
|
||||
%69 = OpCompositeConstruct %54 %59 %62 %62 %59
|
||||
OpStore %56 %69
|
||||
OpBranch %52
|
||||
%70 = OpLabel
|
||||
%71 = OpAccessChain %21 %18 %19 %9
|
||||
%72 = OpLoad %6 %71
|
||||
%73 = OpConvertSToF %53 %72
|
||||
%74 = OpCompositeConstruct %54 %73 %73 %73 %73
|
||||
OpStore %56 %74
|
||||
OpBranch %52
|
||||
%52 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 6 5
|
||||
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
|
||||
@@ -0,0 +1,174 @@
|
||||
#!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]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // After this a has either all or none of the bits as one.
|
||||
# int a = (int(gl_FragCoord.y) & 1) != 0 ? 0 : ~ 0;
|
||||
#
|
||||
# // Bitwise AND with a negation is always zero.
|
||||
# if((a & (~a)) == _int_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: 61
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %12 %42
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %12 "gl_FragCoord"
|
||||
OpName %32 "buf0"
|
||||
OpMemberName %32 0 "_GLF_uniform_int_values"
|
||||
OpName %34 ""
|
||||
OpName %42 "_GLF_color"
|
||||
OpDecorate %12 BuiltIn FragCoord
|
||||
OpDecorate %31 ArrayStride 16
|
||||
OpMemberDecorate %32 0 Offset 0
|
||||
OpDecorate %32 Block
|
||||
OpDecorate %34 DescriptorSet 0
|
||||
OpDecorate %34 Binding 0
|
||||
OpDecorate %42 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeFloat 32
|
||||
%10 = OpTypeVector %9 4
|
||||
%11 = OpTypePointer Input %10
|
||||
%12 = OpVariable %11 Input
|
||||
%13 = OpTypeInt 32 0
|
||||
%14 = OpConstant %13 1
|
||||
%15 = OpTypePointer Input %9
|
||||
%19 = OpConstant %6 1
|
||||
%21 = OpConstant %6 0
|
||||
%22 = OpTypeBool
|
||||
%24 = OpConstant %6 -1
|
||||
%30 = OpConstant %13 2
|
||||
%31 = OpTypeArray %6 %30
|
||||
%32 = OpTypeStruct %31
|
||||
%33 = OpTypePointer Uniform %32
|
||||
%34 = OpVariable %33 Uniform
|
||||
%35 = OpTypePointer Uniform %6
|
||||
%41 = OpTypePointer Output %10
|
||||
%42 = OpVariable %41 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%16 = OpAccessChain %15 %12 %14
|
||||
%17 = OpLoad %9 %16
|
||||
%18 = OpConvertFToS %6 %17
|
||||
%20 = OpBitwiseAnd %6 %18 %19
|
||||
%23 = OpINotEqual %22 %20 %21
|
||||
%25 = OpSelect %6 %23 %21 %24
|
||||
OpStore %8 %25
|
||||
%26 = OpLoad %6 %8
|
||||
%27 = OpLoad %6 %8
|
||||
%28 = OpNot %6 %27
|
||||
%29 = OpBitwiseAnd %6 %26 %28
|
||||
%36 = OpAccessChain %35 %34 %21 %19
|
||||
%37 = OpLoad %6 %36
|
||||
%38 = OpIEqual %22 %29 %37
|
||||
OpSelectionMerge %40 None
|
||||
OpBranchConditional %38 %39 %56
|
||||
%39 = OpLabel
|
||||
%43 = OpAccessChain %35 %34 %21 %21
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpConvertSToF %9 %44
|
||||
%46 = OpAccessChain %35 %34 %21 %19
|
||||
%47 = OpLoad %6 %46
|
||||
%48 = OpConvertSToF %9 %47
|
||||
%49 = OpAccessChain %35 %34 %21 %19
|
||||
%50 = OpLoad %6 %49
|
||||
%51 = OpConvertSToF %9 %50
|
||||
%52 = OpAccessChain %35 %34 %21 %21
|
||||
%53 = OpLoad %6 %52
|
||||
%54 = OpConvertSToF %9 %53
|
||||
%55 = OpCompositeConstruct %10 %45 %48 %51 %54
|
||||
OpStore %42 %55
|
||||
OpBranch %40
|
||||
%56 = OpLabel
|
||||
%57 = OpAccessChain %35 %34 %21 %19
|
||||
%58 = OpLoad %6 %57
|
||||
%59 = OpConvertSToF %9 %58
|
||||
%60 = OpCompositeConstruct %10 %59 %59 %59 %59
|
||||
OpStore %42 %60
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,227 @@
|
||||
#!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 BRW 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 _float_1_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 1.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of zero: 0.0
|
||||
# layout(set = 0, binding = 2) uniform buf2
|
||||
# {
|
||||
# float zero;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = ~(((zero < _float_1_0) ? _int_0 : _int_1) | 1);
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == ~ _int_1)
|
||||
# {
|
||||
# _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: 73
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %54
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %10 "buf2"
|
||||
OpMemberName %10 0 "zero"
|
||||
OpName %12 ""
|
||||
OpName %20 "buf0"
|
||||
OpMemberName %20 0 "_GLF_uniform_float_values"
|
||||
OpName %22 ""
|
||||
OpName %32 "buf1"
|
||||
OpMemberName %32 0 "_GLF_uniform_int_values"
|
||||
OpName %34 ""
|
||||
OpName %54 "_GLF_color"
|
||||
OpMemberDecorate %10 0 Offset 0
|
||||
OpDecorate %10 Block
|
||||
OpDecorate %12 DescriptorSet 0
|
||||
OpDecorate %12 Binding 2
|
||||
OpDecorate %19 ArrayStride 16
|
||||
OpMemberDecorate %20 0 Offset 0
|
||||
OpDecorate %20 Block
|
||||
OpDecorate %22 DescriptorSet 0
|
||||
OpDecorate %22 Binding 0
|
||||
OpDecorate %31 ArrayStride 16
|
||||
OpMemberDecorate %32 0 Offset 0
|
||||
OpDecorate %32 Block
|
||||
OpDecorate %34 DescriptorSet 0
|
||||
OpDecorate %34 Binding 1
|
||||
OpDecorate %54 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeFloat 32
|
||||
%10 = OpTypeStruct %9
|
||||
%11 = OpTypePointer Uniform %10
|
||||
%12 = OpVariable %11 Uniform
|
||||
%13 = OpConstant %6 0
|
||||
%14 = OpTypePointer Uniform %9
|
||||
%17 = OpTypeInt 32 0
|
||||
%18 = OpConstant %17 1
|
||||
%19 = OpTypeArray %9 %18
|
||||
%20 = OpTypeStruct %19
|
||||
%21 = OpTypePointer Uniform %20
|
||||
%22 = OpVariable %21 Uniform
|
||||
%25 = OpTypeBool
|
||||
%30 = OpConstant %17 2
|
||||
%31 = OpTypeArray %6 %30
|
||||
%32 = OpTypeStruct %31
|
||||
%33 = OpTypePointer Uniform %32
|
||||
%34 = OpVariable %33 Uniform
|
||||
%35 = OpConstant %6 1
|
||||
%36 = OpTypePointer Uniform %6
|
||||
%52 = OpTypeVector %9 4
|
||||
%53 = OpTypePointer Output %52
|
||||
%54 = OpVariable %53 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%27 = OpVariable %7 Function
|
||||
%15 = OpAccessChain %14 %12 %13
|
||||
%16 = OpLoad %9 %15
|
||||
%23 = OpAccessChain %14 %22 %13 %13
|
||||
%24 = OpLoad %9 %23
|
||||
%26 = OpFOrdLessThan %25 %16 %24
|
||||
OpSelectionMerge %29 None
|
||||
OpBranchConditional %26 %28 %39
|
||||
%28 = OpLabel
|
||||
%37 = OpAccessChain %36 %34 %13 %35
|
||||
%38 = OpLoad %6 %37
|
||||
OpStore %27 %38
|
||||
OpBranch %29
|
||||
%39 = OpLabel
|
||||
%40 = OpAccessChain %36 %34 %13 %13
|
||||
%41 = OpLoad %6 %40
|
||||
OpStore %27 %41
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
%42 = OpLoad %6 %27
|
||||
%43 = OpBitwiseOr %6 %42 %35
|
||||
%44 = OpNot %6 %43
|
||||
OpStore %8 %44
|
||||
%45 = OpLoad %6 %8
|
||||
%46 = OpAccessChain %36 %34 %13 %13
|
||||
%47 = OpLoad %6 %46
|
||||
%48 = OpNot %6 %47
|
||||
%49 = OpIEqual %25 %45 %48
|
||||
OpSelectionMerge %51 None
|
||||
OpBranchConditional %49 %50 %68
|
||||
%50 = OpLabel
|
||||
%55 = OpAccessChain %36 %34 %13 %13
|
||||
%56 = OpLoad %6 %55
|
||||
%57 = OpConvertSToF %9 %56
|
||||
%58 = OpAccessChain %36 %34 %13 %35
|
||||
%59 = OpLoad %6 %58
|
||||
%60 = OpConvertSToF %9 %59
|
||||
%61 = OpAccessChain %36 %34 %13 %35
|
||||
%62 = OpLoad %6 %61
|
||||
%63 = OpConvertSToF %9 %62
|
||||
%64 = OpAccessChain %36 %34 %13 %13
|
||||
%65 = OpLoad %6 %64
|
||||
%66 = OpConvertSToF %9 %65
|
||||
%67 = OpCompositeConstruct %52 %57 %60 %63 %66
|
||||
OpStore %54 %67
|
||||
OpBranch %51
|
||||
%68 = OpLabel
|
||||
%69 = OpAccessChain %36 %34 %13 %35
|
||||
%70 = OpLoad %6 %69
|
||||
%71 = OpConvertSToF %9 %70
|
||||
%72 = OpCompositeConstruct %52 %71 %71 %71 %71
|
||||
OpStore %54 %72
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE float STD140 DATA
|
||||
0.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0
|
||||
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_zero AS uniform DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
#!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.
|
||||
|
||||
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_9 _GLF_uniform_int_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 9]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int msb10 = _int_0 | 1024;
|
||||
# int a = _int_0;
|
||||
#
|
||||
# // Iterated nine times.
|
||||
# for(int i = _int_1; i < findLSB(msb10); i++)
|
||||
# {
|
||||
# a++;
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == _int_9)
|
||||
# {
|
||||
# _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: 71
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %52
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "msb10"
|
||||
OpName %12 "buf0"
|
||||
OpMemberName %12 0 "_GLF_uniform_int_values"
|
||||
OpName %14 ""
|
||||
OpName %22 "a"
|
||||
OpName %25 "i"
|
||||
OpName %52 "_GLF_color"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %52 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 3
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpConstant %6 1
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%20 = OpConstant %6 1024
|
||||
%36 = OpTypeBool
|
||||
%43 = OpConstant %6 2
|
||||
%49 = OpTypeFloat 32
|
||||
%50 = OpTypeVector %49 4
|
||||
%51 = OpTypePointer Output %50
|
||||
%52 = OpVariable %51 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%22 = OpVariable %7 Function
|
||||
%25 = OpVariable %7 Function
|
||||
%18 = OpAccessChain %17 %14 %15 %16
|
||||
%19 = OpLoad %6 %18
|
||||
%21 = OpBitwiseOr %6 %19 %20
|
||||
OpStore %8 %21
|
||||
%23 = OpAccessChain %17 %14 %15 %16
|
||||
%24 = OpLoad %6 %23
|
||||
OpStore %22 %24
|
||||
%26 = OpAccessChain %17 %14 %15 %15
|
||||
%27 = OpLoad %6 %26
|
||||
OpStore %25 %27
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
OpLoopMerge %30 %31 None
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%33 = OpLoad %6 %25
|
||||
%34 = OpLoad %6 %8
|
||||
%35 = OpExtInst %6 %1 FindILsb %34
|
||||
%37 = OpSLessThan %36 %33 %35
|
||||
OpBranchConditional %37 %29 %30
|
||||
%29 = OpLabel
|
||||
%38 = OpLoad %6 %22
|
||||
%39 = OpIAdd %6 %38 %16
|
||||
OpStore %22 %39
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%40 = OpLoad %6 %25
|
||||
%41 = OpIAdd %6 %40 %16
|
||||
OpStore %25 %41
|
||||
OpBranch %28
|
||||
%30 = OpLabel
|
||||
%42 = OpLoad %6 %22
|
||||
%44 = OpAccessChain %17 %14 %15 %43
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpIEqual %36 %42 %45
|
||||
OpSelectionMerge %48 None
|
||||
OpBranchConditional %46 %47 %66
|
||||
%47 = OpLabel
|
||||
%53 = OpAccessChain %17 %14 %15 %15
|
||||
%54 = OpLoad %6 %53
|
||||
%55 = OpConvertSToF %49 %54
|
||||
%56 = OpAccessChain %17 %14 %15 %16
|
||||
%57 = OpLoad %6 %56
|
||||
%58 = OpConvertSToF %49 %57
|
||||
%59 = OpAccessChain %17 %14 %15 %16
|
||||
%60 = OpLoad %6 %59
|
||||
%61 = OpConvertSToF %49 %60
|
||||
%62 = OpAccessChain %17 %14 %15 %15
|
||||
%63 = OpLoad %6 %62
|
||||
%64 = OpConvertSToF %49 %63
|
||||
%65 = OpCompositeConstruct %50 %55 %58 %61 %64
|
||||
OpStore %52 %65
|
||||
OpBranch %48
|
||||
%66 = OpLabel
|
||||
%67 = OpAccessChain %17 %14 %15 %16
|
||||
%68 = OpLoad %6 %67
|
||||
%69 = OpConvertSToF %49 %68
|
||||
%70 = OpCompositeConstruct %50 %69 %69 %69 %69
|
||||
OpStore %52 %70
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 9
|
||||
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__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
|
||||
@@ -0,0 +1,192 @@
|
||||
#!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 _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 2]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Shifting by 256 would be undefined, but value one is always selected.
|
||||
# if(4 >> (gl_FragCoord.y < _float_0_0 ? 256 : 1) == _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: 63
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %11 %44
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %11 "gl_FragCoord"
|
||||
OpName %18 "buf0"
|
||||
OpMemberName %18 0 "_GLF_uniform_float_values"
|
||||
OpName %20 ""
|
||||
OpName %33 "buf1"
|
||||
OpMemberName %33 0 "_GLF_uniform_int_values"
|
||||
OpName %35 ""
|
||||
OpName %44 "_GLF_color"
|
||||
OpDecorate %11 BuiltIn FragCoord
|
||||
OpDecorate %17 ArrayStride 16
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 0
|
||||
OpDecorate %32 ArrayStride 16
|
||||
OpMemberDecorate %33 0 Offset 0
|
||||
OpDecorate %33 Block
|
||||
OpDecorate %35 DescriptorSet 0
|
||||
OpDecorate %35 Binding 1
|
||||
OpDecorate %44 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpConstant %6 4
|
||||
%8 = OpTypeFloat 32
|
||||
%9 = OpTypeVector %8 4
|
||||
%10 = OpTypePointer Input %9
|
||||
%11 = OpVariable %10 Input
|
||||
%12 = OpTypeInt 32 0
|
||||
%13 = OpConstant %12 1
|
||||
%14 = OpTypePointer Input %8
|
||||
%17 = OpTypeArray %8 %13
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpConstant %6 0
|
||||
%22 = OpTypePointer Uniform %8
|
||||
%25 = OpTypeBool
|
||||
%27 = OpConstant %6 256
|
||||
%28 = OpConstant %6 1
|
||||
%31 = OpConstant %12 3
|
||||
%32 = OpTypeArray %6 %31
|
||||
%33 = OpTypeStruct %32
|
||||
%34 = OpTypePointer Uniform %33
|
||||
%35 = OpVariable %34 Uniform
|
||||
%36 = OpConstant %6 2
|
||||
%37 = OpTypePointer Uniform %6
|
||||
%43 = OpTypePointer Output %9
|
||||
%44 = OpVariable %43 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%15 = OpAccessChain %14 %11 %13
|
||||
%16 = OpLoad %8 %15
|
||||
%23 = OpAccessChain %22 %20 %21 %21
|
||||
%24 = OpLoad %8 %23
|
||||
%26 = OpFOrdLessThan %25 %16 %24
|
||||
%29 = OpSelect %6 %26 %27 %28
|
||||
%30 = OpShiftRightArithmetic %6 %7 %29
|
||||
%38 = OpAccessChain %37 %35 %21 %36
|
||||
%39 = OpLoad %6 %38
|
||||
%40 = OpIEqual %25 %30 %39
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %40 %41 %58
|
||||
%41 = OpLabel
|
||||
%45 = OpAccessChain %37 %35 %21 %21
|
||||
%46 = OpLoad %6 %45
|
||||
%47 = OpConvertSToF %8 %46
|
||||
%48 = OpAccessChain %37 %35 %21 %28
|
||||
%49 = OpLoad %6 %48
|
||||
%50 = OpConvertSToF %8 %49
|
||||
%51 = OpAccessChain %37 %35 %21 %28
|
||||
%52 = OpLoad %6 %51
|
||||
%53 = OpConvertSToF %8 %52
|
||||
%54 = OpAccessChain %37 %35 %21 %21
|
||||
%55 = OpLoad %6 %54
|
||||
%56 = OpConvertSToF %8 %55
|
||||
%57 = OpCompositeConstruct %9 %47 %50 %53 %56
|
||||
OpStore %44 %57
|
||||
OpBranch %42
|
||||
%58 = OpLabel
|
||||
%59 = OpAccessChain %37 %35 %21 %28
|
||||
%60 = OpLoad %6 %59
|
||||
%61 = OpConvertSToF %8 %60
|
||||
%62 = OpCompositeConstruct %9 %61 %61 %61 %61
|
||||
OpStore %44 %62
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 2
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,150 @@
|
||||
#!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
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int one;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Arithmetic shift replicates the sign bit.
|
||||
# int a = 0xffffffff >> one;
|
||||
# // Clamps to 2.0.
|
||||
# float f = clamp(5.0, 1.0, (a == 0xffffffff) ? 2.0 : 3.0);
|
||||
#
|
||||
# // Always true.
|
||||
# if (int(f) == 2)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(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: 43
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %38
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %10 "buf0"
|
||||
OpMemberName %10 0 "one"
|
||||
OpName %12 ""
|
||||
OpName %20 "f"
|
||||
OpName %38 "_GLF_color"
|
||||
OpMemberDecorate %10 0 Offset 0
|
||||
OpDecorate %10 Block
|
||||
OpDecorate %12 DescriptorSet 0
|
||||
OpDecorate %12 Binding 0
|
||||
OpDecorate %38 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 -1
|
||||
%10 = OpTypeStruct %6
|
||||
%11 = OpTypePointer Uniform %10
|
||||
%12 = OpVariable %11 Uniform
|
||||
%13 = OpConstant %6 0
|
||||
%14 = OpTypePointer Uniform %6
|
||||
%18 = OpTypeFloat 32
|
||||
%19 = OpTypePointer Function %18
|
||||
%21 = OpConstant %18 5
|
||||
%22 = OpConstant %18 1
|
||||
%24 = OpTypeBool
|
||||
%26 = OpConstant %18 2
|
||||
%27 = OpConstant %18 3
|
||||
%32 = OpConstant %6 2
|
||||
%36 = OpTypeVector %18 4
|
||||
%37 = OpTypePointer Output %36
|
||||
%38 = OpVariable %37 Output
|
||||
%39 = OpConstant %18 0
|
||||
%40 = OpConstantComposite %36 %22 %39 %39 %22
|
||||
%42 = OpConstantComposite %36 %39 %39 %39 %39
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%20 = OpVariable %19 Function
|
||||
%15 = OpAccessChain %14 %12 %13
|
||||
%16 = OpLoad %6 %15
|
||||
%17 = OpShiftRightArithmetic %6 %9 %16
|
||||
OpStore %8 %17
|
||||
%23 = OpLoad %6 %8
|
||||
%25 = OpIEqual %24 %23 %9
|
||||
%28 = OpSelect %18 %25 %26 %27
|
||||
%29 = OpExtInst %18 %1 FClamp %21 %22 %28
|
||||
OpStore %20 %29
|
||||
%30 = OpLoad %18 %20
|
||||
%31 = OpConvertFToS %6 %30
|
||||
%33 = OpIEqual %24 %31 %32
|
||||
OpSelectionMerge %35 None
|
||||
OpBranchConditional %33 %34 %41
|
||||
%34 = OpLabel
|
||||
OpStore %38 %40
|
||||
OpBranch %35
|
||||
%41 = OpLabel
|
||||
OpStore %38 %42
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE int32 STD140 DATA
|
||||
1
|
||||
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_one 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
|
||||
@@ -0,0 +1,310 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific block frequency info code path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 c = vec4(0, 0, 0, 1);
|
||||
# int a = 0;
|
||||
#
|
||||
# do
|
||||
# {
|
||||
# do
|
||||
# {
|
||||
# // Executed only once with a = 0.
|
||||
# c[a] = 1.0;
|
||||
#
|
||||
# for(int i1 = 0; i1 < 1; i1++)
|
||||
# for(int i2 = 0; i2 < 1; i2++)
|
||||
# for(int i3 = 0; i3 < 1; i3++)
|
||||
# for(int i4 = 0; i4 < 1; i4++)
|
||||
# for(int i5 = 0; i5 < 1; i5++)
|
||||
# for(int i6 = 0; i6 < 1; i6++)
|
||||
# for(int i7 = 0; i7 < 1; i7++)
|
||||
# for(int i8 = 0; i8 < 17; i8++)
|
||||
# a++;
|
||||
# }
|
||||
# while(gl_FragCoord.x < -1.0);
|
||||
# } while(gl_FragCoord.y < -1.0);
|
||||
# _GLF_color = c;
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 129
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %114 %127
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "c"
|
||||
OpName %15 "a"
|
||||
OpName %28 "i1"
|
||||
OpName %38 "i2"
|
||||
OpName %46 "i3"
|
||||
OpName %54 "i4"
|
||||
OpName %62 "i5"
|
||||
OpName %70 "i6"
|
||||
OpName %78 "i7"
|
||||
OpName %86 "i8"
|
||||
OpName %114 "gl_FragCoord"
|
||||
OpName %127 "_GLF_color"
|
||||
OpDecorate %114 BuiltIn FragCoord
|
||||
OpDecorate %127 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpConstant %6 0
|
||||
%11 = OpConstant %6 1
|
||||
%12 = OpConstantComposite %7 %10 %10 %10 %11
|
||||
%13 = OpTypeInt 32 1
|
||||
%14 = OpTypePointer Function %13
|
||||
%16 = OpConstant %13 0
|
||||
%26 = OpTypePointer Function %6
|
||||
%35 = OpConstant %13 1
|
||||
%36 = OpTypeBool
|
||||
%93 = OpConstant %13 17
|
||||
%113 = OpTypePointer Input %7
|
||||
%114 = OpVariable %113 Input
|
||||
%115 = OpTypeInt 32 0
|
||||
%116 = OpConstant %115 0
|
||||
%117 = OpTypePointer Input %6
|
||||
%120 = OpConstant %6 -1
|
||||
%122 = OpConstant %115 1
|
||||
%126 = OpTypePointer Output %7
|
||||
%127 = OpVariable %126 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%15 = OpVariable %14 Function
|
||||
%28 = OpVariable %14 Function
|
||||
%38 = OpVariable %14 Function
|
||||
%46 = OpVariable %14 Function
|
||||
%54 = OpVariable %14 Function
|
||||
%62 = OpVariable %14 Function
|
||||
%70 = OpVariable %14 Function
|
||||
%78 = OpVariable %14 Function
|
||||
%86 = OpVariable %14 Function
|
||||
OpStore %9 %12
|
||||
OpStore %15 %16
|
||||
OpBranch %17
|
||||
%17 = OpLabel
|
||||
OpLoopMerge %19 %20 None
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpLoopMerge %23 %24 None
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%25 = OpLoad %13 %15
|
||||
%27 = OpAccessChain %26 %9 %25
|
||||
OpStore %27 %11
|
||||
OpStore %28 %16
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpLoad %13 %28
|
||||
%37 = OpSLessThan %36 %34 %35
|
||||
OpBranchConditional %37 %30 %31
|
||||
%30 = OpLabel
|
||||
OpStore %38 %16
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
OpLoopMerge %41 %42 None
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
%44 = OpLoad %13 %38
|
||||
%45 = OpSLessThan %36 %44 %35
|
||||
OpBranchConditional %45 %40 %41
|
||||
%40 = OpLabel
|
||||
OpStore %46 %16
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpLoopMerge %49 %50 None
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
%52 = OpLoad %13 %46
|
||||
%53 = OpSLessThan %36 %52 %35
|
||||
OpBranchConditional %53 %48 %49
|
||||
%48 = OpLabel
|
||||
OpStore %54 %16
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
OpLoopMerge %57 %58 None
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
%60 = OpLoad %13 %54
|
||||
%61 = OpSLessThan %36 %60 %35
|
||||
OpBranchConditional %61 %56 %57
|
||||
%56 = OpLabel
|
||||
OpStore %62 %16
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
OpLoopMerge %65 %66 None
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
%68 = OpLoad %13 %62
|
||||
%69 = OpSLessThan %36 %68 %35
|
||||
OpBranchConditional %69 %64 %65
|
||||
%64 = OpLabel
|
||||
OpStore %70 %16
|
||||
OpBranch %71
|
||||
%71 = OpLabel
|
||||
OpLoopMerge %73 %74 None
|
||||
OpBranch %75
|
||||
%75 = OpLabel
|
||||
%76 = OpLoad %13 %70
|
||||
%77 = OpSLessThan %36 %76 %35
|
||||
OpBranchConditional %77 %72 %73
|
||||
%72 = OpLabel
|
||||
OpStore %78 %16
|
||||
OpBranch %79
|
||||
%79 = OpLabel
|
||||
OpLoopMerge %81 %82 None
|
||||
OpBranch %83
|
||||
%83 = OpLabel
|
||||
%84 = OpLoad %13 %78
|
||||
%85 = OpSLessThan %36 %84 %35
|
||||
OpBranchConditional %85 %80 %81
|
||||
%80 = OpLabel
|
||||
OpStore %86 %16
|
||||
OpBranch %87
|
||||
%87 = OpLabel
|
||||
OpLoopMerge %89 %90 None
|
||||
OpBranch %91
|
||||
%91 = OpLabel
|
||||
%92 = OpLoad %13 %86
|
||||
%94 = OpSLessThan %36 %92 %93
|
||||
OpBranchConditional %94 %88 %89
|
||||
%88 = OpLabel
|
||||
%95 = OpLoad %13 %15
|
||||
%96 = OpIAdd %13 %95 %35
|
||||
OpStore %15 %96
|
||||
OpBranch %90
|
||||
%90 = OpLabel
|
||||
%97 = OpLoad %13 %86
|
||||
%98 = OpIAdd %13 %97 %35
|
||||
OpStore %86 %98
|
||||
OpBranch %87
|
||||
%89 = OpLabel
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
%99 = OpLoad %13 %78
|
||||
%100 = OpIAdd %13 %99 %35
|
||||
OpStore %78 %100
|
||||
OpBranch %79
|
||||
%81 = OpLabel
|
||||
OpBranch %74
|
||||
%74 = OpLabel
|
||||
%101 = OpLoad %13 %70
|
||||
%102 = OpIAdd %13 %101 %35
|
||||
OpStore %70 %102
|
||||
OpBranch %71
|
||||
%73 = OpLabel
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
%103 = OpLoad %13 %62
|
||||
%104 = OpIAdd %13 %103 %35
|
||||
OpStore %62 %104
|
||||
OpBranch %63
|
||||
%65 = OpLabel
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
%105 = OpLoad %13 %54
|
||||
%106 = OpIAdd %13 %105 %35
|
||||
OpStore %54 %106
|
||||
OpBranch %55
|
||||
%57 = OpLabel
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
%107 = OpLoad %13 %46
|
||||
%108 = OpIAdd %13 %107 %35
|
||||
OpStore %46 %108
|
||||
OpBranch %47
|
||||
%49 = OpLabel
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%109 = OpLoad %13 %38
|
||||
%110 = OpIAdd %13 %109 %35
|
||||
OpStore %38 %110
|
||||
OpBranch %39
|
||||
%41 = OpLabel
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%111 = OpLoad %13 %28
|
||||
%112 = OpIAdd %13 %111 %35
|
||||
OpStore %28 %112
|
||||
OpBranch %29
|
||||
%31 = OpLabel
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%118 = OpAccessChain %117 %114 %116
|
||||
%119 = OpLoad %6 %118
|
||||
%121 = OpFOrdLessThan %36 %119 %120
|
||||
OpBranchConditional %121 %21 %23
|
||||
%23 = OpLabel
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%123 = OpAccessChain %117 %114 %122
|
||||
%124 = OpLoad %6 %123
|
||||
%125 = OpFOrdLessThan %36 %124 %120
|
||||
OpBranchConditional %125 %17 %19
|
||||
%19 = OpLabel
|
||||
%128 = OpLoad %7 %9
|
||||
OpStore %127 %128
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
BIND BUFFER variant_framebuffer AS color LOCATION 0
|
||||
END
|
||||
CLEAR_COLOR variant_pipeline 0 0 0 255
|
||||
|
||||
CLEAR variant_pipeline
|
||||
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,406 @@
|
||||
#!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 a specific branch propability path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_2 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_1 _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_2_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 2.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0 {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_int_values: [2, 0, 1, 3]
|
||||
# layout(set = 0, binding = 1) uniform buf1 {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float sums[2];
|
||||
# sums[_int_0] = - _float_1_0;
|
||||
# sums[_int_1] = - _float_1_0;
|
||||
# for(int a = _int_0; a < _int_2; a ++)
|
||||
# {
|
||||
# for(int b = _int_0; b < _int_3; b ++)
|
||||
# {
|
||||
# for(int c = _int_0; c <= a; c ++)
|
||||
# {
|
||||
# for(int d = _int_0; d < _int_3; d ++)
|
||||
# {
|
||||
# sums[a] = mat2(_int_1)[c][_int_1];
|
||||
# sums[a] += mat2(_int_1)[c][_int_1];
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# if(sums[_int_0] == _float_0_0 && sums[_int_1] == _float_2_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; 8
|
||||
; Bound: 175
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %156
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "sums"
|
||||
OpName %15 "buf1"
|
||||
OpMemberName %15 0 "_GLF_uniform_int_values"
|
||||
OpName %17 ""
|
||||
OpName %25 "buf0"
|
||||
OpMemberName %25 0 "_GLF_uniform_float_values"
|
||||
OpName %27 ""
|
||||
OpName %42 "a"
|
||||
OpName %55 "b"
|
||||
OpName %68 "c"
|
||||
OpName %79 "d"
|
||||
OpName %106 "indexable"
|
||||
OpName %120 "indexable"
|
||||
OpName %156 "_GLF_color"
|
||||
OpDecorate %14 ArrayStride 16
|
||||
OpMemberDecorate %15 0 RelaxedPrecision
|
||||
OpMemberDecorate %15 0 Offset 0
|
||||
OpDecorate %15 Block
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 1
|
||||
OpDecorate %22 RelaxedPrecision
|
||||
OpDecorate %24 ArrayStride 16
|
||||
OpMemberDecorate %25 0 Offset 0
|
||||
OpDecorate %25 Block
|
||||
OpDecorate %27 DescriptorSet 0
|
||||
OpDecorate %27 Binding 0
|
||||
OpDecorate %36 RelaxedPrecision
|
||||
OpDecorate %42 RelaxedPrecision
|
||||
OpDecorate %44 RelaxedPrecision
|
||||
OpDecorate %50 RelaxedPrecision
|
||||
OpDecorate %52 RelaxedPrecision
|
||||
OpDecorate %55 RelaxedPrecision
|
||||
OpDecorate %57 RelaxedPrecision
|
||||
OpDecorate %63 RelaxedPrecision
|
||||
OpDecorate %66 RelaxedPrecision
|
||||
OpDecorate %68 RelaxedPrecision
|
||||
OpDecorate %70 RelaxedPrecision
|
||||
OpDecorate %76 RelaxedPrecision
|
||||
OpDecorate %77 RelaxedPrecision
|
||||
OpDecorate %79 RelaxedPrecision
|
||||
OpDecorate %81 RelaxedPrecision
|
||||
OpDecorate %87 RelaxedPrecision
|
||||
OpDecorate %89 RelaxedPrecision
|
||||
OpDecorate %91 RelaxedPrecision
|
||||
OpDecorate %93 RelaxedPrecision
|
||||
OpDecorate %102 RelaxedPrecision
|
||||
OpDecorate %104 RelaxedPrecision
|
||||
OpDecorate %110 RelaxedPrecision
|
||||
OpDecorate %112 RelaxedPrecision
|
||||
OpDecorate %117 RelaxedPrecision
|
||||
OpDecorate %119 RelaxedPrecision
|
||||
OpDecorate %127 RelaxedPrecision
|
||||
OpDecorate %128 RelaxedPrecision
|
||||
OpDecorate %129 RelaxedPrecision
|
||||
OpDecorate %130 RelaxedPrecision
|
||||
OpDecorate %131 RelaxedPrecision
|
||||
OpDecorate %132 RelaxedPrecision
|
||||
OpDecorate %133 RelaxedPrecision
|
||||
OpDecorate %134 RelaxedPrecision
|
||||
OpDecorate %136 RelaxedPrecision
|
||||
OpDecorate %145 RelaxedPrecision
|
||||
OpDecorate %156 Location 0
|
||||
OpDecorate %158 RelaxedPrecision
|
||||
OpDecorate %161 RelaxedPrecision
|
||||
OpDecorate %164 RelaxedPrecision
|
||||
OpDecorate %167 RelaxedPrecision
|
||||
OpDecorate %172 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 2
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpTypeInt 32 1
|
||||
%13 = OpConstant %7 4
|
||||
%14 = OpTypeArray %12 %13
|
||||
%15 = OpTypeStruct %14
|
||||
%16 = OpTypePointer Uniform %15
|
||||
%17 = OpVariable %16 Uniform
|
||||
%18 = OpConstant %12 0
|
||||
%19 = OpConstant %12 1
|
||||
%20 = OpTypePointer Uniform %12
|
||||
%23 = OpConstant %7 3
|
||||
%24 = OpTypeArray %6 %23
|
||||
%25 = OpTypeStruct %24
|
||||
%26 = OpTypePointer Uniform %25
|
||||
%27 = OpVariable %26 Uniform
|
||||
%28 = OpTypePointer Uniform %6
|
||||
%32 = OpTypePointer Function %6
|
||||
%34 = OpConstant %12 2
|
||||
%41 = OpTypePointer Function %12
|
||||
%53 = OpTypeBool
|
||||
%64 = OpConstant %12 3
|
||||
%95 = OpTypeVector %6 2
|
||||
%96 = OpTypeMatrix %95 2
|
||||
%97 = OpConstant %6 1
|
||||
%98 = OpConstant %6 0
|
||||
%105 = OpTypePointer Function %96
|
||||
%154 = OpTypeVector %6 4
|
||||
%155 = OpTypePointer Output %154
|
||||
%156 = OpVariable %155 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%42 = OpVariable %41 Function
|
||||
%55 = OpVariable %41 Function
|
||||
%68 = OpVariable %41 Function
|
||||
%79 = OpVariable %41 Function
|
||||
%106 = OpVariable %105 Function
|
||||
%120 = OpVariable %105 Function
|
||||
%21 = OpAccessChain %20 %17 %18 %19
|
||||
%22 = OpLoad %12 %21
|
||||
%29 = OpAccessChain %28 %27 %18 %18
|
||||
%30 = OpLoad %6 %29
|
||||
%31 = OpFNegate %6 %30
|
||||
%33 = OpAccessChain %32 %11 %22
|
||||
OpStore %33 %31
|
||||
%35 = OpAccessChain %20 %17 %18 %34
|
||||
%36 = OpLoad %12 %35
|
||||
%37 = OpAccessChain %28 %27 %18 %18
|
||||
%38 = OpLoad %6 %37
|
||||
%39 = OpFNegate %6 %38
|
||||
%40 = OpAccessChain %32 %11 %36
|
||||
OpStore %40 %39
|
||||
%43 = OpAccessChain %20 %17 %18 %19
|
||||
%44 = OpLoad %12 %43
|
||||
OpStore %42 %44
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
OpLoopMerge %47 %48 None
|
||||
OpBranch %49
|
||||
%49 = OpLabel
|
||||
%50 = OpLoad %12 %42
|
||||
%51 = OpAccessChain %20 %17 %18 %18
|
||||
%52 = OpLoad %12 %51
|
||||
%54 = OpSLessThan %53 %50 %52
|
||||
OpBranchConditional %54 %46 %47
|
||||
%46 = OpLabel
|
||||
%56 = OpAccessChain %20 %17 %18 %19
|
||||
%57 = OpLoad %12 %56
|
||||
OpStore %55 %57
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
OpLoopMerge %60 %61 None
|
||||
OpBranch %62
|
||||
%62 = OpLabel
|
||||
%63 = OpLoad %12 %55
|
||||
%65 = OpAccessChain %20 %17 %18 %64
|
||||
%66 = OpLoad %12 %65
|
||||
%67 = OpSLessThan %53 %63 %66
|
||||
OpBranchConditional %67 %59 %60
|
||||
%59 = OpLabel
|
||||
%69 = OpAccessChain %20 %17 %18 %19
|
||||
%70 = OpLoad %12 %69
|
||||
OpStore %68 %70
|
||||
OpBranch %71
|
||||
%71 = OpLabel
|
||||
OpLoopMerge %73 %74 None
|
||||
OpBranch %75
|
||||
%75 = OpLabel
|
||||
%76 = OpLoad %12 %68
|
||||
%77 = OpLoad %12 %42
|
||||
%78 = OpSLessThanEqual %53 %76 %77
|
||||
OpBranchConditional %78 %72 %73
|
||||
%72 = OpLabel
|
||||
%80 = OpAccessChain %20 %17 %18 %19
|
||||
%81 = OpLoad %12 %80
|
||||
OpStore %79 %81
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
OpLoopMerge %84 %85 None
|
||||
OpBranch %86
|
||||
%86 = OpLabel
|
||||
%87 = OpLoad %12 %79
|
||||
%88 = OpAccessChain %20 %17 %18 %64
|
||||
%89 = OpLoad %12 %88
|
||||
%90 = OpSLessThan %53 %87 %89
|
||||
OpBranchConditional %90 %83 %84
|
||||
%83 = OpLabel
|
||||
%91 = OpLoad %12 %42
|
||||
%92 = OpAccessChain %20 %17 %18 %34
|
||||
%93 = OpLoad %12 %92
|
||||
%94 = OpConvertSToF %6 %93
|
||||
%99 = OpCompositeConstruct %95 %94 %98
|
||||
%100 = OpCompositeConstruct %95 %98 %94
|
||||
%101 = OpCompositeConstruct %96 %99 %100
|
||||
%102 = OpLoad %12 %68
|
||||
%103 = OpAccessChain %20 %17 %18 %34
|
||||
%104 = OpLoad %12 %103
|
||||
OpStore %106 %101
|
||||
%107 = OpAccessChain %32 %106 %102 %104
|
||||
%108 = OpLoad %6 %107
|
||||
%109 = OpAccessChain %32 %11 %91
|
||||
OpStore %109 %108
|
||||
%110 = OpLoad %12 %42
|
||||
%111 = OpAccessChain %20 %17 %18 %34
|
||||
%112 = OpLoad %12 %111
|
||||
%113 = OpConvertSToF %6 %112
|
||||
%114 = OpCompositeConstruct %95 %113 %98
|
||||
%115 = OpCompositeConstruct %95 %98 %113
|
||||
%116 = OpCompositeConstruct %96 %114 %115
|
||||
%117 = OpLoad %12 %68
|
||||
%118 = OpAccessChain %20 %17 %18 %34
|
||||
%119 = OpLoad %12 %118
|
||||
OpStore %120 %116
|
||||
%121 = OpAccessChain %32 %120 %117 %119
|
||||
%122 = OpLoad %6 %121
|
||||
%123 = OpAccessChain %32 %11 %110
|
||||
%124 = OpLoad %6 %123
|
||||
%125 = OpFAdd %6 %124 %122
|
||||
%126 = OpAccessChain %32 %11 %110
|
||||
OpStore %126 %125
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
%127 = OpLoad %12 %79
|
||||
%128 = OpIAdd %12 %127 %19
|
||||
OpStore %79 %128
|
||||
OpBranch %82
|
||||
%84 = OpLabel
|
||||
OpBranch %74
|
||||
%74 = OpLabel
|
||||
%129 = OpLoad %12 %68
|
||||
%130 = OpIAdd %12 %129 %19
|
||||
OpStore %68 %130
|
||||
OpBranch %71
|
||||
%73 = OpLabel
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
%131 = OpLoad %12 %55
|
||||
%132 = OpIAdd %12 %131 %19
|
||||
OpStore %55 %132
|
||||
OpBranch %58
|
||||
%60 = OpLabel
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%133 = OpLoad %12 %42
|
||||
%134 = OpIAdd %12 %133 %19
|
||||
OpStore %42 %134
|
||||
OpBranch %45
|
||||
%47 = OpLabel
|
||||
%135 = OpAccessChain %20 %17 %18 %19
|
||||
%136 = OpLoad %12 %135
|
||||
%137 = OpAccessChain %32 %11 %136
|
||||
%138 = OpLoad %6 %137
|
||||
%139 = OpAccessChain %28 %27 %18 %19
|
||||
%140 = OpLoad %6 %139
|
||||
%141 = OpFOrdEqual %53 %138 %140
|
||||
OpSelectionMerge %143 None
|
||||
OpBranchConditional %141 %142 %143
|
||||
%142 = OpLabel
|
||||
%144 = OpAccessChain %20 %17 %18 %34
|
||||
%145 = OpLoad %12 %144
|
||||
%146 = OpAccessChain %32 %11 %145
|
||||
%147 = OpLoad %6 %146
|
||||
%148 = OpAccessChain %28 %27 %18 %34
|
||||
%149 = OpLoad %6 %148
|
||||
%150 = OpFOrdEqual %53 %147 %149
|
||||
OpBranch %143
|
||||
%143 = OpLabel
|
||||
%151 = OpPhi %53 %141 %47 %150 %142
|
||||
OpSelectionMerge %153 None
|
||||
OpBranchConditional %151 %152 %170
|
||||
%152 = OpLabel
|
||||
%157 = OpAccessChain %20 %17 %18 %34
|
||||
%158 = OpLoad %12 %157
|
||||
%159 = OpConvertSToF %6 %158
|
||||
%160 = OpAccessChain %20 %17 %18 %19
|
||||
%161 = OpLoad %12 %160
|
||||
%162 = OpConvertSToF %6 %161
|
||||
%163 = OpAccessChain %20 %17 %18 %19
|
||||
%164 = OpLoad %12 %163
|
||||
%165 = OpConvertSToF %6 %164
|
||||
%166 = OpAccessChain %20 %17 %18 %34
|
||||
%167 = OpLoad %12 %166
|
||||
%168 = OpConvertSToF %6 %167
|
||||
%169 = OpCompositeConstruct %154 %159 %162 %165 %168
|
||||
OpStore %156 %169
|
||||
OpBranch %153
|
||||
%170 = OpLabel
|
||||
%171 = OpAccessChain %20 %17 %18 %19
|
||||
%172 = OpLoad %12 %171
|
||||
%173 = OpConvertSToF %6 %172
|
||||
%174 = OpCompositeConstruct %154 %173 %173 %173 %173
|
||||
OpStore %156 %174
|
||||
OpBranch %153
|
||||
%153 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
2 0 1 3
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 0.0 2.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,157 @@
|
||||
#!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 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_1 _GLF_uniform_int_values[1]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float f = 142.7;
|
||||
#
|
||||
# if(float(int(f)) > 100.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: 49
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %21
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "f"
|
||||
OpName %21 "_GLF_color"
|
||||
OpName %25 "buf0"
|
||||
OpMemberName %25 0 "_GLF_uniform_int_values"
|
||||
OpName %27 ""
|
||||
OpDecorate %21 Location 0
|
||||
OpDecorate %24 ArrayStride 16
|
||||
OpMemberDecorate %25 0 Offset 0
|
||||
OpDecorate %25 Block
|
||||
OpDecorate %27 DescriptorSet 0
|
||||
OpDecorate %27 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 142.699997
|
||||
%11 = OpTypeInt 32 1
|
||||
%14 = OpConstant %6 100
|
||||
%15 = OpTypeBool
|
||||
%19 = OpTypeVector %6 4
|
||||
%20 = OpTypePointer Output %19
|
||||
%21 = OpVariable %20 Output
|
||||
%22 = OpTypeInt 32 0
|
||||
%23 = OpConstant %22 2
|
||||
%24 = OpTypeArray %11 %23
|
||||
%25 = OpTypeStruct %24
|
||||
%26 = OpTypePointer Uniform %25
|
||||
%27 = OpVariable %26 Uniform
|
||||
%28 = OpConstant %11 0
|
||||
%29 = OpConstant %11 1
|
||||
%30 = OpTypePointer Uniform %11
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%10 = OpLoad %6 %8
|
||||
%12 = OpConvertFToS %11 %10
|
||||
%13 = OpConvertSToF %6 %12
|
||||
%16 = OpFOrdGreaterThan %15 %13 %14
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %16 %17 %44
|
||||
%17 = OpLabel
|
||||
%31 = OpAccessChain %30 %27 %28 %29
|
||||
%32 = OpLoad %11 %31
|
||||
%33 = OpConvertSToF %6 %32
|
||||
%34 = OpAccessChain %30 %27 %28 %28
|
||||
%35 = OpLoad %11 %34
|
||||
%36 = OpConvertSToF %6 %35
|
||||
%37 = OpAccessChain %30 %27 %28 %28
|
||||
%38 = OpLoad %11 %37
|
||||
%39 = OpConvertSToF %6 %38
|
||||
%40 = OpAccessChain %30 %27 %28 %29
|
||||
%41 = OpLoad %11 %40
|
||||
%42 = OpConvertSToF %6 %41
|
||||
%43 = OpCompositeConstruct %19 %33 %36 %39 %42
|
||||
OpStore %21 %43
|
||||
OpBranch %18
|
||||
%44 = OpLabel
|
||||
%45 = OpAccessChain %30 %27 %28 %28
|
||||
%46 = OpLoad %11 %45
|
||||
%47 = OpConvertSToF %6 %46
|
||||
%48 = OpCompositeConstruct %19 %47 %47 %47 %47
|
||||
OpStore %21 %48
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
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
|
||||
@@ -0,0 +1,253 @@
|
||||
#!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 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_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_2 _GLF_uniform_int_values[2]
|
||||
# #define _float_1_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_float_values: [1.0, 2.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 2]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float sums[3] = float[3](_float_1_0, _float_1_0, _float_1_0);
|
||||
#
|
||||
# for(int i = 0; i < clamp(_int_1, _int_1, 2); i ++)
|
||||
# {
|
||||
# // Increments by one.
|
||||
# sums[_int_2] += mat2x4(_float_1_0)[i][_int_0];
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(sums[_int_2] == _float_2_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: 103
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %84
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %11 "sums"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "_GLF_uniform_float_values"
|
||||
OpName %16 ""
|
||||
OpName %28 "i"
|
||||
OpName %36 "buf1"
|
||||
OpMemberName %36 0 "_GLF_uniform_int_values"
|
||||
OpName %38 ""
|
||||
OpName %64 "indexable"
|
||||
OpName %84 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpDecorate %35 ArrayStride 16
|
||||
OpMemberDecorate %36 0 Offset 0
|
||||
OpDecorate %36 Block
|
||||
OpDecorate %38 DescriptorSet 0
|
||||
OpDecorate %38 Binding 1
|
||||
OpDecorate %84 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 3
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpConstant %7 2
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%27 = OpTypePointer Function %17
|
||||
%35 = OpTypeArray %17 %8
|
||||
%36 = OpTypeStruct %35
|
||||
%37 = OpTypePointer Uniform %36
|
||||
%38 = OpVariable %37 Uniform
|
||||
%39 = OpTypePointer Uniform %17
|
||||
%44 = OpConstant %17 2
|
||||
%46 = OpTypeBool
|
||||
%52 = OpTypeVector %6 4
|
||||
%53 = OpTypeMatrix %52 2
|
||||
%54 = OpConstant %6 1
|
||||
%55 = OpConstant %6 0
|
||||
%60 = OpConstant %17 1
|
||||
%63 = OpTypePointer Function %53
|
||||
%65 = OpTypePointer Function %6
|
||||
%83 = OpTypePointer Output %52
|
||||
%84 = OpVariable %83 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%28 = OpVariable %27 Function
|
||||
%64 = OpVariable %63 Function
|
||||
%20 = OpAccessChain %19 %16 %18 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%22 = OpAccessChain %19 %16 %18 %18
|
||||
%23 = OpLoad %6 %22
|
||||
%24 = OpAccessChain %19 %16 %18 %18
|
||||
%25 = OpLoad %6 %24
|
||||
%26 = OpCompositeConstruct %9 %21 %23 %25
|
||||
OpStore %11 %26
|
||||
OpStore %28 %18
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpLoad %17 %28
|
||||
%40 = OpAccessChain %39 %38 %18 %18
|
||||
%41 = OpLoad %17 %40
|
||||
%42 = OpAccessChain %39 %38 %18 %18
|
||||
%43 = OpLoad %17 %42
|
||||
%45 = OpExtInst %17 %1 SClamp %41 %43 %44
|
||||
%47 = OpSLessThan %46 %34 %45
|
||||
OpBranchConditional %47 %30 %31
|
||||
%30 = OpLabel
|
||||
%48 = OpAccessChain %39 %38 %18 %44
|
||||
%49 = OpLoad %17 %48
|
||||
%50 = OpAccessChain %19 %16 %18 %18
|
||||
%51 = OpLoad %6 %50
|
||||
%56 = OpCompositeConstruct %52 %51 %55 %55 %55
|
||||
%57 = OpCompositeConstruct %52 %55 %51 %55 %55
|
||||
%58 = OpCompositeConstruct %53 %56 %57
|
||||
%59 = OpLoad %17 %28
|
||||
%61 = OpAccessChain %39 %38 %18 %60
|
||||
%62 = OpLoad %17 %61
|
||||
OpStore %64 %58
|
||||
%66 = OpAccessChain %65 %64 %59 %62
|
||||
%67 = OpLoad %6 %66
|
||||
%68 = OpAccessChain %65 %11 %49
|
||||
%69 = OpLoad %6 %68
|
||||
%70 = OpFAdd %6 %69 %67
|
||||
%71 = OpAccessChain %65 %11 %49
|
||||
OpStore %71 %70
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%72 = OpLoad %17 %28
|
||||
%73 = OpIAdd %17 %72 %60
|
||||
OpStore %28 %73
|
||||
OpBranch %29
|
||||
%31 = OpLabel
|
||||
%74 = OpAccessChain %39 %38 %18 %44
|
||||
%75 = OpLoad %17 %74
|
||||
%76 = OpAccessChain %65 %11 %75
|
||||
%77 = OpLoad %6 %76
|
||||
%78 = OpAccessChain %19 %16 %18 %60
|
||||
%79 = OpLoad %6 %78
|
||||
%80 = OpFOrdEqual %46 %77 %79
|
||||
OpSelectionMerge %82 None
|
||||
OpBranchConditional %80 %81 %98
|
||||
%81 = OpLabel
|
||||
%85 = OpAccessChain %39 %38 %18 %18
|
||||
%86 = OpLoad %17 %85
|
||||
%87 = OpConvertSToF %6 %86
|
||||
%88 = OpAccessChain %39 %38 %18 %60
|
||||
%89 = OpLoad %17 %88
|
||||
%90 = OpConvertSToF %6 %89
|
||||
%91 = OpAccessChain %39 %38 %18 %60
|
||||
%92 = OpLoad %17 %91
|
||||
%93 = OpConvertSToF %6 %92
|
||||
%94 = OpAccessChain %39 %38 %18 %18
|
||||
%95 = OpLoad %17 %94
|
||||
%96 = OpConvertSToF %6 %95
|
||||
%97 = OpCompositeConstruct %52 %87 %90 %93 %96
|
||||
OpStore %84 %97
|
||||
OpBranch %82
|
||||
%98 = OpLabel
|
||||
%99 = OpAccessChain %39 %38 %18 %60
|
||||
%100 = OpLoad %17 %99
|
||||
%101 = OpConvertSToF %6 %100
|
||||
%102 = OpCompositeConstruct %52 %101 %101 %101 %101
|
||||
OpStore %84 %102
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 2
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 2.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,196 @@
|
||||
#!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 BRW 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_1 _GLF_uniform_int_values[1]
|
||||
# #define _float_4_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_25 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [4.0, 0.25]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float a = 1.0;
|
||||
# float b = clamp(_float_0_25, false ? a : 0.0, 1.0);
|
||||
#
|
||||
# // Always true.
|
||||
# if(b == _float_0_25)
|
||||
# {
|
||||
# _GLF_color = vec4(b * _float_4_0, _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: 62
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %37
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %10 "b"
|
||||
OpName %14 "buf1"
|
||||
OpMemberName %14 0 "_GLF_uniform_float_values"
|
||||
OpName %16 ""
|
||||
OpName %37 "_GLF_color"
|
||||
OpName %43 "buf0"
|
||||
OpMemberName %43 0 "_GLF_uniform_int_values"
|
||||
OpName %45 ""
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %37 Location 0
|
||||
OpDecorate %42 ArrayStride 16
|
||||
OpMemberDecorate %43 0 Offset 0
|
||||
OpDecorate %43 Block
|
||||
OpDecorate %45 DescriptorSet 0
|
||||
OpDecorate %45 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 1
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 2
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpConstant %17 1
|
||||
%20 = OpTypePointer Uniform %6
|
||||
%23 = OpTypeBool
|
||||
%24 = OpConstantFalse %23
|
||||
%26 = OpConstant %6 0
|
||||
%35 = OpTypeVector %6 4
|
||||
%36 = OpTypePointer Output %35
|
||||
%37 = OpVariable %36 Output
|
||||
%42 = OpTypeArray %17 %12
|
||||
%43 = OpTypeStruct %42
|
||||
%44 = OpTypePointer Uniform %43
|
||||
%45 = OpVariable %44 Uniform
|
||||
%46 = OpTypePointer Uniform %17
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%21 = OpAccessChain %20 %16 %18 %19
|
||||
%22 = OpLoad %6 %21
|
||||
%25 = OpLoad %6 %8
|
||||
%27 = OpSelect %6 %24 %25 %26
|
||||
%28 = OpExtInst %6 %1 FClamp %22 %27 %9
|
||||
OpStore %10 %28
|
||||
%29 = OpLoad %6 %10
|
||||
%30 = OpAccessChain %20 %16 %18 %19
|
||||
%31 = OpLoad %6 %30
|
||||
%32 = OpFOrdEqual %23 %29 %31
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %57
|
||||
%33 = OpLabel
|
||||
%38 = OpLoad %6 %10
|
||||
%39 = OpAccessChain %20 %16 %18 %18
|
||||
%40 = OpLoad %6 %39
|
||||
%41 = OpFMul %6 %38 %40
|
||||
%47 = OpAccessChain %46 %45 %18 %18
|
||||
%48 = OpLoad %17 %47
|
||||
%49 = OpConvertSToF %6 %48
|
||||
%50 = OpAccessChain %46 %45 %18 %18
|
||||
%51 = OpLoad %17 %50
|
||||
%52 = OpConvertSToF %6 %51
|
||||
%53 = OpAccessChain %46 %45 %18 %19
|
||||
%54 = OpLoad %17 %53
|
||||
%55 = OpConvertSToF %6 %54
|
||||
%56 = OpCompositeConstruct %35 %41 %49 %52 %55
|
||||
OpStore %37 %56
|
||||
OpBranch %34
|
||||
%57 = OpLabel
|
||||
%58 = OpAccessChain %46 %45 %18 %18
|
||||
%59 = OpLoad %17 %58
|
||||
%60 = OpConvertSToF %6 %59
|
||||
%61 = OpCompositeConstruct %35 %60 %60 %60 %60
|
||||
OpStore %37 %61
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
4.0 0.25
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
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
|
||||
@@ -0,0 +1,222 @@
|
||||
#!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.
|
||||
|
||||
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 _float_2_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_5_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [2.0, 5.0, 0.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
#
|
||||
# // Contents of three: 3
|
||||
# layout(set = 0, binding = 2) uniform buf2
|
||||
# {
|
||||
# int three;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // f = clamp(5.0, 0.0, min(bitcount(3), bitcount(3))) = clamp(5.0, 0.0, 2.0) = 2.0
|
||||
# float f = clamp(_float_5_0, _float_0_0, float(min(bitCount(three), bitCount(three))));
|
||||
#
|
||||
# // Always true.
|
||||
# if(f == _float_2_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: 70
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %46
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "f"
|
||||
OpName %12 "buf1"
|
||||
OpMemberName %12 0 "_GLF_uniform_float_values"
|
||||
OpName %14 ""
|
||||
OpName %24 "buf2"
|
||||
OpMemberName %24 0 "three"
|
||||
OpName %26 ""
|
||||
OpName %46 "_GLF_color"
|
||||
OpName %49 "buf0"
|
||||
OpMemberName %49 0 "_GLF_uniform_int_values"
|
||||
OpName %51 ""
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 1
|
||||
OpMemberDecorate %24 0 Offset 0
|
||||
OpDecorate %24 Block
|
||||
OpDecorate %26 DescriptorSet 0
|
||||
OpDecorate %26 Binding 2
|
||||
OpDecorate %34 RelaxedPrecision
|
||||
OpDecorate %46 Location 0
|
||||
OpDecorate %48 ArrayStride 16
|
||||
OpMemberDecorate %49 0 Offset 0
|
||||
OpDecorate %49 Block
|
||||
OpDecorate %51 DescriptorSet 0
|
||||
OpDecorate %51 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 3
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpTypeInt 32 1
|
||||
%16 = OpConstant %15 0
|
||||
%17 = OpConstant %15 1
|
||||
%18 = OpTypePointer Uniform %6
|
||||
%21 = OpConstant %15 2
|
||||
%24 = OpTypeStruct %15
|
||||
%25 = OpTypePointer Uniform %24
|
||||
%26 = OpVariable %25 Uniform
|
||||
%27 = OpTypePointer Uniform %15
|
||||
%40 = OpTypeBool
|
||||
%44 = OpTypeVector %6 4
|
||||
%45 = OpTypePointer Output %44
|
||||
%46 = OpVariable %45 Output
|
||||
%47 = OpConstant %9 2
|
||||
%48 = OpTypeArray %15 %47
|
||||
%49 = OpTypeStruct %48
|
||||
%50 = OpTypePointer Uniform %49
|
||||
%51 = OpVariable %50 Uniform
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%19 = OpAccessChain %18 %14 %16 %17
|
||||
%20 = OpLoad %6 %19
|
||||
%22 = OpAccessChain %18 %14 %16 %21
|
||||
%23 = OpLoad %6 %22
|
||||
%28 = OpAccessChain %27 %26 %16
|
||||
%29 = OpLoad %15 %28
|
||||
%30 = OpBitCount %15 %29
|
||||
%31 = OpAccessChain %27 %26 %16
|
||||
%32 = OpLoad %15 %31
|
||||
%33 = OpBitCount %15 %32
|
||||
%34 = OpExtInst %15 %1 SMin %30 %33
|
||||
%35 = OpConvertSToF %6 %34
|
||||
%36 = OpExtInst %6 %1 FClamp %20 %23 %35
|
||||
OpStore %8 %36
|
||||
%37 = OpLoad %6 %8
|
||||
%38 = OpAccessChain %18 %14 %16 %16
|
||||
%39 = OpLoad %6 %38
|
||||
%41 = OpFOrdEqual %40 %37 %39
|
||||
OpSelectionMerge %43 None
|
||||
OpBranchConditional %41 %42 %65
|
||||
%42 = OpLabel
|
||||
%52 = OpAccessChain %27 %51 %16 %16
|
||||
%53 = OpLoad %15 %52
|
||||
%54 = OpConvertSToF %6 %53
|
||||
%55 = OpAccessChain %27 %51 %16 %17
|
||||
%56 = OpLoad %15 %55
|
||||
%57 = OpConvertSToF %6 %56
|
||||
%58 = OpAccessChain %27 %51 %16 %17
|
||||
%59 = OpLoad %15 %58
|
||||
%60 = OpConvertSToF %6 %59
|
||||
%61 = OpAccessChain %27 %51 %16 %16
|
||||
%62 = OpLoad %15 %61
|
||||
%63 = OpConvertSToF %6 %62
|
||||
%64 = OpCompositeConstruct %44 %54 %57 %60 %63
|
||||
OpStore %46 %64
|
||||
OpBranch %43
|
||||
%65 = OpLabel
|
||||
%66 = OpAccessChain %27 %51 %16 %17
|
||||
%67 = OpLoad %15 %66
|
||||
%68 = OpConvertSToF %6 %67
|
||||
%69 = OpCompositeConstruct %44 %68 %68 %68 %68
|
||||
OpStore %46 %69
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# three
|
||||
BUFFER variant_three DATA_TYPE int32 STD140 DATA
|
||||
3
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
2.0 5.0 0.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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_three 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
|
||||
@@ -0,0 +1,206 @@
|
||||
#!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.
|
||||
|
||||
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 _float_1_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 1.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of resolution: 32.0
|
||||
# layout(push_constant) uniform buf_push
|
||||
# {
|
||||
# float resolution;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always true. Simplifies to clamp(0, 0, 1) < 1 -> 0 < 1.
|
||||
# if(clamp(resolution < _float_1_0 ? 1 : 0, resolution < _float_1_0 ? 1 : 0, 1) < 1)
|
||||
# {
|
||||
# _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: 65
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %40
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %7 "buf_push"
|
||||
OpMemberName %7 0 "resolution"
|
||||
OpName %9 ""
|
||||
OpName %18 "buf0"
|
||||
OpMemberName %18 0 "_GLF_uniform_float_values"
|
||||
OpName %20 ""
|
||||
OpName %40 "_GLF_color"
|
||||
OpName %43 "buf1"
|
||||
OpMemberName %43 0 "_GLF_uniform_int_values"
|
||||
OpName %45 ""
|
||||
OpMemberDecorate %7 0 Offset 0
|
||||
OpDecorate %7 Block
|
||||
OpDecorate %17 ArrayStride 16
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 0
|
||||
OpDecorate %40 Location 0
|
||||
OpDecorate %42 ArrayStride 16
|
||||
OpMemberDecorate %43 0 Offset 0
|
||||
OpDecorate %43 Block
|
||||
OpDecorate %45 DescriptorSet 0
|
||||
OpDecorate %45 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeStruct %6
|
||||
%8 = OpTypePointer PushConstant %7
|
||||
%9 = OpVariable %8 PushConstant
|
||||
%10 = OpTypeInt 32 1
|
||||
%11 = OpConstant %10 0
|
||||
%12 = OpTypePointer PushConstant %6
|
||||
%15 = OpTypeInt 32 0
|
||||
%16 = OpConstant %15 1
|
||||
%17 = OpTypeArray %6 %16
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpTypePointer Uniform %6
|
||||
%24 = OpTypeBool
|
||||
%26 = OpConstant %10 1
|
||||
%38 = OpTypeVector %6 4
|
||||
%39 = OpTypePointer Output %38
|
||||
%40 = OpVariable %39 Output
|
||||
%41 = OpConstant %15 2
|
||||
%42 = OpTypeArray %10 %41
|
||||
%43 = OpTypeStruct %42
|
||||
%44 = OpTypePointer Uniform %43
|
||||
%45 = OpVariable %44 Uniform
|
||||
%46 = OpTypePointer Uniform %10
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpAccessChain %12 %9 %11
|
||||
%14 = OpLoad %6 %13
|
||||
%22 = OpAccessChain %21 %20 %11 %11
|
||||
%23 = OpLoad %6 %22
|
||||
%25 = OpFOrdLessThan %24 %14 %23
|
||||
%27 = OpSelect %10 %25 %26 %11
|
||||
%28 = OpAccessChain %12 %9 %11
|
||||
%29 = OpLoad %6 %28
|
||||
%30 = OpAccessChain %21 %20 %11 %11
|
||||
%31 = OpLoad %6 %30
|
||||
%32 = OpFOrdLessThan %24 %29 %31
|
||||
%33 = OpSelect %10 %32 %26 %11
|
||||
%34 = OpExtInst %10 %1 SClamp %27 %33 %26
|
||||
%35 = OpSLessThan %24 %34 %26
|
||||
OpSelectionMerge %37 None
|
||||
OpBranchConditional %35 %36 %60
|
||||
%36 = OpLabel
|
||||
%47 = OpAccessChain %46 %45 %11 %11
|
||||
%48 = OpLoad %10 %47
|
||||
%49 = OpConvertSToF %6 %48
|
||||
%50 = OpAccessChain %46 %45 %11 %26
|
||||
%51 = OpLoad %10 %50
|
||||
%52 = OpConvertSToF %6 %51
|
||||
%53 = OpAccessChain %46 %45 %11 %26
|
||||
%54 = OpLoad %10 %53
|
||||
%55 = OpConvertSToF %6 %54
|
||||
%56 = OpAccessChain %46 %45 %11 %11
|
||||
%57 = OpLoad %10 %56
|
||||
%58 = OpConvertSToF %6 %57
|
||||
%59 = OpCompositeConstruct %38 %49 %52 %55 %58
|
||||
OpStore %40 %59
|
||||
OpBranch %37
|
||||
%60 = OpLabel
|
||||
%61 = OpAccessChain %46 %45 %11 %26
|
||||
%62 = OpLoad %10 %61
|
||||
%63 = OpConvertSToF %6 %62
|
||||
%64 = OpCompositeConstruct %38 %63 %63 %63 %63
|
||||
OpStore %40 %64
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# resolution
|
||||
BUFFER variant_resolution DATA_TYPE float STD140 DATA
|
||||
32.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0
|
||||
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_resolution AS push_constant
|
||||
BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,294 @@
|
||||
#!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 patch optimization 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_4 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _int_2 _GLF_uniform_int_values[2]
|
||||
# #define _int_3 _GLF_uniform_int_values[3]
|
||||
# #define _int_0 _GLF_uniform_int_values[4]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_int_values: [4, 1, 2, 3, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[5];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 v = vec4(_int_1, _int_2, _int_3, _int_4);
|
||||
#
|
||||
# // Clamps v.y, v.z, and v.z to a range of 0..1.
|
||||
# // After the loop all the components of v has a value of one.
|
||||
# for (int i = _int_0; i < _int_4; i++)
|
||||
# {
|
||||
# if(mat4(v, v, v, v)[0][i] > _float_1_0)
|
||||
# {
|
||||
# v[i] = clamp(v, vec4(_float_0_0), vec4(_float_1_0))[_int_1];
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(v == vec4(_int_1))
|
||||
# {
|
||||
# _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: 138
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %119
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "v"
|
||||
OpName %14 "buf1"
|
||||
OpMemberName %14 0 "_GLF_uniform_int_values"
|
||||
OpName %16 ""
|
||||
OpName %36 "i"
|
||||
OpName %83 "buf0"
|
||||
OpMemberName %83 0 "_GLF_uniform_float_values"
|
||||
OpName %85 ""
|
||||
OpName %119 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %82 ArrayStride 16
|
||||
OpMemberDecorate %83 0 Offset 0
|
||||
OpDecorate %83 Block
|
||||
OpDecorate %85 DescriptorSet 0
|
||||
OpDecorate %85 Binding 0
|
||||
OpDecorate %119 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 1
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 5
|
||||
%13 = OpTypeArray %10 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpConstant %10 0
|
||||
%18 = OpConstant %10 1
|
||||
%19 = OpTypePointer Uniform %10
|
||||
%23 = OpConstant %10 2
|
||||
%27 = OpConstant %10 3
|
||||
%35 = OpTypePointer Function %10
|
||||
%37 = OpConstant %10 4
|
||||
%48 = OpTypeBool
|
||||
%54 = OpTypeMatrix %7 4
|
||||
%55 = OpConstant %6 1
|
||||
%56 = OpConstant %6 0
|
||||
%81 = OpConstant %11 2
|
||||
%82 = OpTypeArray %6 %81
|
||||
%83 = OpTypeStruct %82
|
||||
%84 = OpTypePointer Uniform %83
|
||||
%85 = OpVariable %84 Uniform
|
||||
%86 = OpTypePointer Uniform %6
|
||||
%104 = OpTypePointer Function %6
|
||||
%113 = OpTypeVector %48 4
|
||||
%118 = OpTypePointer Output %7
|
||||
%119 = OpVariable %118 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%36 = OpVariable %35 Function
|
||||
%20 = OpAccessChain %19 %16 %17 %18
|
||||
%21 = OpLoad %10 %20
|
||||
%22 = OpConvertSToF %6 %21
|
||||
%24 = OpAccessChain %19 %16 %17 %23
|
||||
%25 = OpLoad %10 %24
|
||||
%26 = OpConvertSToF %6 %25
|
||||
%28 = OpAccessChain %19 %16 %17 %27
|
||||
%29 = OpLoad %10 %28
|
||||
%30 = OpConvertSToF %6 %29
|
||||
%31 = OpAccessChain %19 %16 %17 %17
|
||||
%32 = OpLoad %10 %31
|
||||
%33 = OpConvertSToF %6 %32
|
||||
%34 = OpCompositeConstruct %7 %22 %26 %30 %33
|
||||
OpStore %9 %34
|
||||
%38 = OpAccessChain %19 %16 %17 %37
|
||||
%39 = OpLoad %10 %38
|
||||
OpStore %36 %39
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
OpLoopMerge %42 %43 None
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
%45 = OpLoad %10 %36
|
||||
%46 = OpAccessChain %19 %16 %17 %17
|
||||
%47 = OpLoad %10 %46
|
||||
%49 = OpSLessThan %48 %45 %47
|
||||
OpBranchConditional %49 %41 %42
|
||||
%41 = OpLabel
|
||||
%50 = OpLoad %7 %9
|
||||
%51 = OpLoad %7 %9
|
||||
%52 = OpLoad %7 %9
|
||||
%53 = OpLoad %7 %9
|
||||
%57 = OpCompositeExtract %6 %50 0
|
||||
%58 = OpCompositeExtract %6 %50 1
|
||||
%59 = OpCompositeExtract %6 %50 2
|
||||
%60 = OpCompositeExtract %6 %50 3
|
||||
%61 = OpCompositeExtract %6 %51 0
|
||||
%62 = OpCompositeExtract %6 %51 1
|
||||
%63 = OpCompositeExtract %6 %51 2
|
||||
%64 = OpCompositeExtract %6 %51 3
|
||||
%65 = OpCompositeExtract %6 %52 0
|
||||
%66 = OpCompositeExtract %6 %52 1
|
||||
%67 = OpCompositeExtract %6 %52 2
|
||||
%68 = OpCompositeExtract %6 %52 3
|
||||
%69 = OpCompositeExtract %6 %53 0
|
||||
%70 = OpCompositeExtract %6 %53 1
|
||||
%71 = OpCompositeExtract %6 %53 2
|
||||
%72 = OpCompositeExtract %6 %53 3
|
||||
%73 = OpCompositeConstruct %7 %57 %58 %59 %60
|
||||
%74 = OpCompositeConstruct %7 %61 %62 %63 %64
|
||||
%75 = OpCompositeConstruct %7 %65 %66 %67 %68
|
||||
%76 = OpCompositeConstruct %7 %69 %70 %71 %72
|
||||
%77 = OpCompositeConstruct %54 %73 %74 %75 %76
|
||||
%78 = OpLoad %10 %36
|
||||
%79 = OpCompositeExtract %7 %77 0
|
||||
%80 = OpVectorExtractDynamic %6 %79 %78
|
||||
%87 = OpAccessChain %86 %85 %17 %17
|
||||
%88 = OpLoad %6 %87
|
||||
%89 = OpFOrdGreaterThan %48 %80 %88
|
||||
OpSelectionMerge %91 None
|
||||
OpBranchConditional %89 %90 %91
|
||||
%90 = OpLabel
|
||||
%92 = OpLoad %10 %36
|
||||
%93 = OpLoad %7 %9
|
||||
%94 = OpAccessChain %86 %85 %17 %18
|
||||
%95 = OpLoad %6 %94
|
||||
%96 = OpCompositeConstruct %7 %95 %95 %95 %95
|
||||
%97 = OpAccessChain %86 %85 %17 %17
|
||||
%98 = OpLoad %6 %97
|
||||
%99 = OpCompositeConstruct %7 %98 %98 %98 %98
|
||||
%100 = OpExtInst %7 %1 FClamp %93 %96 %99
|
||||
%101 = OpAccessChain %19 %16 %17 %18
|
||||
%102 = OpLoad %10 %101
|
||||
%103 = OpVectorExtractDynamic %6 %100 %102
|
||||
%105 = OpAccessChain %104 %9 %92
|
||||
OpStore %105 %103
|
||||
OpBranch %91
|
||||
%91 = OpLabel
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
%106 = OpLoad %10 %36
|
||||
%107 = OpIAdd %10 %106 %18
|
||||
OpStore %36 %107
|
||||
OpBranch %40
|
||||
%42 = OpLabel
|
||||
%108 = OpLoad %7 %9
|
||||
%109 = OpAccessChain %19 %16 %17 %18
|
||||
%110 = OpLoad %10 %109
|
||||
%111 = OpConvertSToF %6 %110
|
||||
%112 = OpCompositeConstruct %7 %111 %111 %111 %111
|
||||
%114 = OpFOrdEqual %113 %108 %112
|
||||
%115 = OpAll %48 %114
|
||||
OpSelectionMerge %117 None
|
||||
OpBranchConditional %115 %116 %133
|
||||
%116 = OpLabel
|
||||
%120 = OpAccessChain %19 %16 %17 %18
|
||||
%121 = OpLoad %10 %120
|
||||
%122 = OpConvertSToF %6 %121
|
||||
%123 = OpAccessChain %19 %16 %17 %37
|
||||
%124 = OpLoad %10 %123
|
||||
%125 = OpConvertSToF %6 %124
|
||||
%126 = OpAccessChain %19 %16 %17 %37
|
||||
%127 = OpLoad %10 %126
|
||||
%128 = OpConvertSToF %6 %127
|
||||
%129 = OpAccessChain %19 %16 %17 %18
|
||||
%130 = OpLoad %10 %129
|
||||
%131 = OpConvertSToF %6 %130
|
||||
%132 = OpCompositeConstruct %7 %122 %125 %128 %131
|
||||
OpStore %119 %132
|
||||
OpBranch %117
|
||||
%133 = OpLabel
|
||||
%134 = OpAccessChain %19 %16 %17 %37
|
||||
%135 = OpLoad %10 %134
|
||||
%136 = OpConvertSToF %6 %135
|
||||
%137 = OpCompositeConstruct %7 %136 %136 %136 %136
|
||||
OpStore %119 %137
|
||||
OpBranch %117
|
||||
%117 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
4 1 2 3 0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 0.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,202 @@
|
||||
#!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 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_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_100_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_float_values: [100.0, 1.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec2 v0 = vec2(_float_1_0, -580.015);
|
||||
# vec2 v1 = clamp(ceil(v0), vec2(-_float_100_0), vec2(100.0));
|
||||
#
|
||||
# if(v1.y == -_float_100_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: 71
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %47
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "v0"
|
||||
OpName %13 "buf1"
|
||||
OpMemberName %13 0 "_GLF_uniform_float_values"
|
||||
OpName %15 ""
|
||||
OpName %24 "v1"
|
||||
OpName %47 "_GLF_color"
|
||||
OpName %49 "buf0"
|
||||
OpMemberName %49 0 "_GLF_uniform_int_values"
|
||||
OpName %51 ""
|
||||
OpDecorate %12 ArrayStride 16
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 1
|
||||
OpDecorate %47 Location 0
|
||||
OpDecorate %48 ArrayStride 16
|
||||
OpMemberDecorate %49 0 Offset 0
|
||||
OpDecorate %49 Block
|
||||
OpDecorate %51 DescriptorSet 0
|
||||
OpDecorate %51 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 2
|
||||
%12 = OpTypeArray %6 %11
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpTypeInt 32 1
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpConstant %16 1
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%22 = OpConstant %6 -580.015015
|
||||
%31 = OpConstant %6 100
|
||||
%32 = OpConstantComposite %7 %31 %31
|
||||
%34 = OpConstant %10 1
|
||||
%35 = OpTypePointer Function %6
|
||||
%41 = OpTypeBool
|
||||
%45 = OpTypeVector %6 4
|
||||
%46 = OpTypePointer Output %45
|
||||
%47 = OpVariable %46 Output
|
||||
%48 = OpTypeArray %16 %11
|
||||
%49 = OpTypeStruct %48
|
||||
%50 = OpTypePointer Uniform %49
|
||||
%51 = OpVariable %50 Uniform
|
||||
%52 = OpTypePointer Uniform %16
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%24 = OpVariable %8 Function
|
||||
%20 = OpAccessChain %19 %15 %17 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpCompositeConstruct %7 %21 %22
|
||||
OpStore %9 %23
|
||||
%25 = OpLoad %7 %9
|
||||
%26 = OpExtInst %7 %1 Ceil %25
|
||||
%27 = OpAccessChain %19 %15 %17 %17
|
||||
%28 = OpLoad %6 %27
|
||||
%29 = OpFNegate %6 %28
|
||||
%30 = OpCompositeConstruct %7 %29 %29
|
||||
%33 = OpExtInst %7 %1 FClamp %26 %30 %32
|
||||
OpStore %24 %33
|
||||
%36 = OpAccessChain %35 %24 %34
|
||||
%37 = OpLoad %6 %36
|
||||
%38 = OpAccessChain %19 %15 %17 %17
|
||||
%39 = OpLoad %6 %38
|
||||
%40 = OpFNegate %6 %39
|
||||
%42 = OpFOrdEqual %41 %37 %40
|
||||
OpSelectionMerge %44 None
|
||||
OpBranchConditional %42 %43 %66
|
||||
%43 = OpLabel
|
||||
%53 = OpAccessChain %52 %51 %17 %17
|
||||
%54 = OpLoad %16 %53
|
||||
%55 = OpConvertSToF %6 %54
|
||||
%56 = OpAccessChain %52 %51 %17 %18
|
||||
%57 = OpLoad %16 %56
|
||||
%58 = OpConvertSToF %6 %57
|
||||
%59 = OpAccessChain %52 %51 %17 %18
|
||||
%60 = OpLoad %16 %59
|
||||
%61 = OpConvertSToF %6 %60
|
||||
%62 = OpAccessChain %52 %51 %17 %17
|
||||
%63 = OpLoad %16 %62
|
||||
%64 = OpConvertSToF %6 %63
|
||||
%65 = OpCompositeConstruct %45 %55 %58 %61 %64
|
||||
OpStore %47 %65
|
||||
OpBranch %44
|
||||
%66 = OpLabel
|
||||
%67 = OpAccessChain %52 %51 %17 %18
|
||||
%68 = OpLoad %16 %67
|
||||
%69 = OpConvertSToF %6 %68
|
||||
%70 = OpCompositeConstruct %45 %69 %69 %69 %69
|
||||
OpStore %47 %70
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
100.0 1.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,209 @@
|
||||
#!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 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_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_2_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [0.0, 2.0, 1.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec2 v0 = vec2(_float_1_0, 3.8);
|
||||
# vec2 v1 = clamp(v0 - 1.0, 0.0, _float_2_0);
|
||||
#
|
||||
# if (v1 == vec2(_float_0_0, _float_2_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: 75
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %50
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "v0"
|
||||
OpName %13 "buf1"
|
||||
OpMemberName %13 0 "_GLF_uniform_float_values"
|
||||
OpName %15 ""
|
||||
OpName %24 "v1"
|
||||
OpName %50 "_GLF_color"
|
||||
OpName %53 "buf0"
|
||||
OpMemberName %53 0 "_GLF_uniform_int_values"
|
||||
OpName %55 ""
|
||||
OpDecorate %12 ArrayStride 16
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 1
|
||||
OpDecorate %50 Location 0
|
||||
OpDecorate %52 ArrayStride 16
|
||||
OpMemberDecorate %53 0 Offset 0
|
||||
OpDecorate %53 Block
|
||||
OpDecorate %55 DescriptorSet 0
|
||||
OpDecorate %55 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 3
|
||||
%12 = OpTypeArray %6 %11
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpTypeInt 32 1
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpConstant %16 2
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%22 = OpConstant %6 3.79999995
|
||||
%26 = OpConstant %6 1
|
||||
%29 = OpConstant %6 0
|
||||
%30 = OpConstant %16 1
|
||||
%42 = OpTypeBool
|
||||
%43 = OpTypeVector %42 2
|
||||
%48 = OpTypeVector %6 4
|
||||
%49 = OpTypePointer Output %48
|
||||
%50 = OpVariable %49 Output
|
||||
%51 = OpConstant %10 2
|
||||
%52 = OpTypeArray %16 %51
|
||||
%53 = OpTypeStruct %52
|
||||
%54 = OpTypePointer Uniform %53
|
||||
%55 = OpVariable %54 Uniform
|
||||
%56 = OpTypePointer Uniform %16
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%24 = OpVariable %8 Function
|
||||
%20 = OpAccessChain %19 %15 %17 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpCompositeConstruct %7 %21 %22
|
||||
OpStore %9 %23
|
||||
%25 = OpLoad %7 %9
|
||||
%27 = OpCompositeConstruct %7 %26 %26
|
||||
%28 = OpFSub %7 %25 %27
|
||||
%31 = OpAccessChain %19 %15 %17 %30
|
||||
%32 = OpLoad %6 %31
|
||||
%33 = OpCompositeConstruct %7 %29 %29
|
||||
%34 = OpCompositeConstruct %7 %32 %32
|
||||
%35 = OpExtInst %7 %1 FClamp %28 %33 %34
|
||||
OpStore %24 %35
|
||||
%36 = OpLoad %7 %24
|
||||
%37 = OpAccessChain %19 %15 %17 %17
|
||||
%38 = OpLoad %6 %37
|
||||
%39 = OpAccessChain %19 %15 %17 %30
|
||||
%40 = OpLoad %6 %39
|
||||
%41 = OpCompositeConstruct %7 %38 %40
|
||||
%44 = OpFOrdEqual %43 %36 %41
|
||||
%45 = OpAll %42 %44
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %45 %46 %70
|
||||
%46 = OpLabel
|
||||
%57 = OpAccessChain %56 %55 %17 %17
|
||||
%58 = OpLoad %16 %57
|
||||
%59 = OpConvertSToF %6 %58
|
||||
%60 = OpAccessChain %56 %55 %17 %30
|
||||
%61 = OpLoad %16 %60
|
||||
%62 = OpConvertSToF %6 %61
|
||||
%63 = OpAccessChain %56 %55 %17 %30
|
||||
%64 = OpLoad %16 %63
|
||||
%65 = OpConvertSToF %6 %64
|
||||
%66 = OpAccessChain %56 %55 %17 %17
|
||||
%67 = OpLoad %16 %66
|
||||
%68 = OpConvertSToF %6 %67
|
||||
%69 = OpCompositeConstruct %48 %59 %62 %65 %68
|
||||
OpStore %50 %69
|
||||
OpBranch %47
|
||||
%70 = OpLabel
|
||||
%71 = OpAccessChain %56 %55 %17 %30
|
||||
%72 = OpLoad %16 %71
|
||||
%73 = OpConvertSToF %6 %72
|
||||
%74 = OpCompositeConstruct %48 %73 %73 %73 %73
|
||||
OpStore %50 %74
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0 2.0 1.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,230 @@
|
||||
#!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.
|
||||
|
||||
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 NIR code paths
|
||||
|
||||
# The test passes because the shader always writes red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--eliminate-dead-branches'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--eliminate-local-single-store'
|
||||
# '--simplify-instructions'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--copy-propagate-arrays'
|
||||
# '--copy-propagate-arrays'
|
||||
# '--eliminate-dead-inserts'
|
||||
# '--vector-dce'
|
||||
# '--vector-dce'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--eliminate-local-single-store'
|
||||
# '--eliminate-local-single-store'
|
||||
# '--simplify-instructions'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--ccp'
|
||||
# '--private-to-local'
|
||||
# '--scalar-replacement=100'
|
||||
# '--eliminate-local-single-block'
|
||||
# '--private-to-local'
|
||||
# '--scalar-replacement=100'
|
||||
# '--simplify-instructions'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# spirv-opt commit hash: a0370efd589be33d5d9a85cfde2f85841b3755af
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 320 es
|
||||
# #define _float_1_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_float_values: [1.0, 2.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# // Contents of zero: 0.0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float zero;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec2 v0 = vec2(_float_1_0);
|
||||
# vec4 v1 = vec4(v0.x);
|
||||
#
|
||||
# // Always true.
|
||||
# if(zero != _float_1_0)
|
||||
# {
|
||||
# // Always false.
|
||||
# if(zero == _float_2_0)
|
||||
# {
|
||||
# return;
|
||||
# }
|
||||
# v1.yz -= _float_1_0;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
#
|
||||
# _GLF_color = v1;
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 62
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %61
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "v0"
|
||||
OpName %13 "buf0"
|
||||
OpMemberName %13 0 "_GLF_uniform_float_values"
|
||||
OpName %15 ""
|
||||
OpName %24 "v1"
|
||||
OpName %30 "buf1"
|
||||
OpMemberName %30 0 "zero"
|
||||
OpName %32 ""
|
||||
OpName %61 "_GLF_color"
|
||||
OpDecorate %12 ArrayStride 16
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpMemberDecorate %30 0 Offset 0
|
||||
OpDecorate %30 Block
|
||||
OpDecorate %32 DescriptorSet 0
|
||||
OpDecorate %32 Binding 1
|
||||
OpDecorate %61 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 2
|
||||
%12 = OpTypeArray %6 %11
|
||||
%13 = OpTypeStruct %12
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpTypeInt 32 1
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpTypePointer Uniform %6
|
||||
%22 = OpTypeVector %6 4
|
||||
%23 = OpTypePointer Function %22
|
||||
%25 = OpConstant %10 0
|
||||
%26 = OpTypePointer Function %6
|
||||
%30 = OpTypeStruct %6
|
||||
%31 = OpTypePointer Uniform %30
|
||||
%32 = OpVariable %31 Uniform
|
||||
%37 = OpTypeBool
|
||||
%43 = OpConstant %16 1
|
||||
%60 = OpTypePointer Output %22
|
||||
%61 = OpVariable %60 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%24 = OpVariable %23 Function
|
||||
%19 = OpAccessChain %18 %15 %17 %17
|
||||
%20 = OpLoad %6 %19
|
||||
%21 = OpCompositeConstruct %7 %20 %20
|
||||
OpStore %9 %21
|
||||
%27 = OpAccessChain %26 %9 %25
|
||||
%28 = OpLoad %6 %27
|
||||
%29 = OpCompositeConstruct %22 %28 %28 %28 %28
|
||||
OpStore %24 %29
|
||||
%33 = OpAccessChain %18 %32 %17
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpAccessChain %18 %15 %17 %17
|
||||
%36 = OpLoad %6 %35
|
||||
%38 = OpFUnordNotEqual %37 %34 %36
|
||||
OpSelectionMerge %40 None
|
||||
OpBranchConditional %38 %39 %58
|
||||
%39 = OpLabel
|
||||
%41 = OpAccessChain %18 %32 %17
|
||||
%42 = OpLoad %6 %41
|
||||
%44 = OpAccessChain %18 %15 %17 %43
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpFOrdEqual %37 %42 %45
|
||||
OpSelectionMerge %48 None
|
||||
OpBranchConditional %46 %47 %48
|
||||
%47 = OpLabel
|
||||
OpReturn
|
||||
%48 = OpLabel
|
||||
%50 = OpAccessChain %18 %15 %17 %17
|
||||
%51 = OpLoad %6 %50
|
||||
%53 = OpVectorShuffle %7 %29 %29 1 2
|
||||
%54 = OpCompositeConstruct %7 %51 %51
|
||||
%55 = OpFSub %7 %53 %54
|
||||
%57 = OpVectorShuffle %22 %29 %55 0 4 5 3
|
||||
OpStore %24 %57
|
||||
OpBranch %40
|
||||
%58 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%40 = OpLabel
|
||||
OpStore %61 %57
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE float STD140 DATA
|
||||
0.0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 2.0
|
||||
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_zero AS uniform DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,413 @@
|
||||
#!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_20 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _int_0 _GLF_uniform_int_values[2]
|
||||
# #define _int_2 _GLF_uniform_int_values[3]
|
||||
# #define _uint_60433 _GLF_uniform_uint_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_1_7 _GLF_uniform_float_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_uint_values: 60433
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# uint _GLF_uniform_uint_values[1];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 1.7]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[3];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_int_values: [20, 1, 0, 2]
|
||||
# layout(set = 0, binding = 2) uniform buf2
|
||||
# {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
# // Contents of three: 3
|
||||
# layout(set = 0, binding = 3) uniform buf3
|
||||
# {
|
||||
# int three;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# // This function does nothing as it backs up _GLF_color and writes it back.
|
||||
# void func0()
|
||||
# {
|
||||
# vec4 tmp;
|
||||
# // Always true.
|
||||
# if(gl_FragCoord.x > _float_0_0)
|
||||
# {
|
||||
# tmp = _GLF_color;
|
||||
# }
|
||||
# _GLF_color = tmp;
|
||||
# }
|
||||
#
|
||||
# // This function always returns 2.
|
||||
# int func1()
|
||||
# {
|
||||
# int a = _int_1;
|
||||
#
|
||||
# while(a < _int_2)
|
||||
# {
|
||||
# // Always true.
|
||||
# if(three > _int_1)
|
||||
# {
|
||||
# func0();
|
||||
# a = _int_2;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# func0();
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# return a;
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always true.
|
||||
# if(gl_FragCoord.x > _float_0_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_float_1_0, _float_0_0, _float_1_0, _float_1_7);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = unpackSnorm4x8(_uint_60433);
|
||||
# }
|
||||
#
|
||||
# int a = _int_0;
|
||||
# for(int i = 0; i < 5; i ++)
|
||||
# {
|
||||
# for(int j = 0; j < 2; j ++)
|
||||
# {
|
||||
# // Executed ten times. Func1 always returns 2, hence a gets incremented by total of 20.
|
||||
# a += func1();
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == _int_20)
|
||||
# {
|
||||
# _GLF_color.z -= _float_1_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: 147
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %15 %38
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %6 "func0("
|
||||
OpName %10 "func1("
|
||||
OpName %15 "gl_FragCoord"
|
||||
OpName %23 "buf1"
|
||||
OpMemberName %23 0 "_GLF_uniform_float_values"
|
||||
OpName %25 ""
|
||||
OpName %36 "tmp"
|
||||
OpName %38 "_GLF_color"
|
||||
OpName %42 "a"
|
||||
OpName %45 "buf2"
|
||||
OpMemberName %45 0 "_GLF_uniform_int_values"
|
||||
OpName %47 ""
|
||||
OpName %61 "buf3"
|
||||
OpMemberName %61 0 "three"
|
||||
OpName %63 ""
|
||||
OpName %99 "buf0"
|
||||
OpMemberName %99 0 "_GLF_uniform_uint_values"
|
||||
OpName %101 ""
|
||||
OpName %106 "a"
|
||||
OpName %109 "i"
|
||||
OpName %118 "j"
|
||||
OpDecorate %15 BuiltIn FragCoord
|
||||
OpDecorate %22 ArrayStride 16
|
||||
OpMemberDecorate %23 0 Offset 0
|
||||
OpDecorate %23 Block
|
||||
OpDecorate %25 DescriptorSet 0
|
||||
OpDecorate %25 Binding 1
|
||||
OpDecorate %38 Location 0
|
||||
OpDecorate %44 ArrayStride 16
|
||||
OpMemberDecorate %45 0 Offset 0
|
||||
OpDecorate %45 Block
|
||||
OpDecorate %47 DescriptorSet 0
|
||||
OpDecorate %47 Binding 2
|
||||
OpMemberDecorate %61 0 Offset 0
|
||||
OpDecorate %61 Block
|
||||
OpDecorate %63 DescriptorSet 0
|
||||
OpDecorate %63 Binding 3
|
||||
OpDecorate %98 ArrayStride 16
|
||||
OpMemberDecorate %99 0 Offset 0
|
||||
OpDecorate %99 Block
|
||||
OpDecorate %101 DescriptorSet 0
|
||||
OpDecorate %101 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%8 = OpTypeInt 32 1
|
||||
%9 = OpTypeFunction %8
|
||||
%12 = OpTypeFloat 32
|
||||
%13 = OpTypeVector %12 4
|
||||
%14 = OpTypePointer Input %13
|
||||
%15 = OpVariable %14 Input
|
||||
%16 = OpTypeInt 32 0
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpTypePointer Input %12
|
||||
%21 = OpConstant %16 3
|
||||
%22 = OpTypeArray %12 %21
|
||||
%23 = OpTypeStruct %22
|
||||
%24 = OpTypePointer Uniform %23
|
||||
%25 = OpVariable %24 Uniform
|
||||
%26 = OpConstant %8 0
|
||||
%27 = OpConstant %8 1
|
||||
%28 = OpTypePointer Uniform %12
|
||||
%31 = OpTypeBool
|
||||
%35 = OpTypePointer Function %13
|
||||
%37 = OpTypePointer Output %13
|
||||
%38 = OpVariable %37 Output
|
||||
%41 = OpTypePointer Function %8
|
||||
%43 = OpConstant %16 4
|
||||
%44 = OpTypeArray %8 %43
|
||||
%45 = OpTypeStruct %44
|
||||
%46 = OpTypePointer Uniform %45
|
||||
%47 = OpVariable %46 Uniform
|
||||
%48 = OpTypePointer Uniform %8
|
||||
%57 = OpConstant %8 3
|
||||
%61 = OpTypeStruct %8
|
||||
%62 = OpTypePointer Uniform %61
|
||||
%63 = OpVariable %62 Uniform
|
||||
%92 = OpConstant %8 2
|
||||
%97 = OpConstant %16 1
|
||||
%98 = OpTypeArray %16 %97
|
||||
%99 = OpTypeStruct %98
|
||||
%100 = OpTypePointer Uniform %99
|
||||
%101 = OpVariable %100 Uniform
|
||||
%102 = OpTypePointer Uniform %16
|
||||
%116 = OpConstant %8 5
|
||||
%141 = OpConstant %16 2
|
||||
%142 = OpTypePointer Output %12
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%106 = OpVariable %41 Function
|
||||
%109 = OpVariable %41 Function
|
||||
%118 = OpVariable %41 Function
|
||||
%79 = OpAccessChain %18 %15 %17
|
||||
%80 = OpLoad %12 %79
|
||||
%81 = OpAccessChain %28 %25 %26 %27
|
||||
%82 = OpLoad %12 %81
|
||||
%83 = OpFOrdGreaterThan %31 %80 %82
|
||||
OpSelectionMerge %85 None
|
||||
OpBranchConditional %83 %84 %96
|
||||
%84 = OpLabel
|
||||
%86 = OpAccessChain %28 %25 %26 %26
|
||||
%87 = OpLoad %12 %86
|
||||
%88 = OpAccessChain %28 %25 %26 %27
|
||||
%89 = OpLoad %12 %88
|
||||
%90 = OpAccessChain %28 %25 %26 %26
|
||||
%91 = OpLoad %12 %90
|
||||
%93 = OpAccessChain %28 %25 %26 %92
|
||||
%94 = OpLoad %12 %93
|
||||
%95 = OpCompositeConstruct %13 %87 %89 %91 %94
|
||||
OpStore %38 %95
|
||||
OpBranch %85
|
||||
%96 = OpLabel
|
||||
%103 = OpAccessChain %102 %101 %26 %26
|
||||
%104 = OpLoad %16 %103
|
||||
%105 = OpExtInst %13 %1 UnpackSnorm4x8 %104
|
||||
OpStore %38 %105
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
%107 = OpAccessChain %48 %47 %26 %92
|
||||
%108 = OpLoad %8 %107
|
||||
OpStore %106 %108
|
||||
OpStore %109 %26
|
||||
OpBranch %110
|
||||
%110 = OpLabel
|
||||
OpLoopMerge %112 %113 None
|
||||
OpBranch %114
|
||||
%114 = OpLabel
|
||||
%115 = OpLoad %8 %109
|
||||
%117 = OpSLessThan %31 %115 %116
|
||||
OpBranchConditional %117 %111 %112
|
||||
%111 = OpLabel
|
||||
OpStore %118 %26
|
||||
OpBranch %119
|
||||
%119 = OpLabel
|
||||
OpLoopMerge %121 %122 None
|
||||
OpBranch %123
|
||||
%123 = OpLabel
|
||||
%124 = OpLoad %8 %118
|
||||
%125 = OpSLessThan %31 %124 %92
|
||||
OpBranchConditional %125 %120 %121
|
||||
%120 = OpLabel
|
||||
%126 = OpFunctionCall %8 %10
|
||||
%127 = OpLoad %8 %106
|
||||
%128 = OpIAdd %8 %127 %126
|
||||
OpStore %106 %128
|
||||
OpBranch %122
|
||||
%122 = OpLabel
|
||||
%129 = OpLoad %8 %118
|
||||
%130 = OpIAdd %8 %129 %27
|
||||
OpStore %118 %130
|
||||
OpBranch %119
|
||||
%121 = OpLabel
|
||||
OpBranch %113
|
||||
%113 = OpLabel
|
||||
%131 = OpLoad %8 %109
|
||||
%132 = OpIAdd %8 %131 %27
|
||||
OpStore %109 %132
|
||||
OpBranch %110
|
||||
%112 = OpLabel
|
||||
%133 = OpLoad %8 %106
|
||||
%134 = OpAccessChain %48 %47 %26 %26
|
||||
%135 = OpLoad %8 %134
|
||||
%136 = OpIEqual %31 %133 %135
|
||||
OpSelectionMerge %138 None
|
||||
OpBranchConditional %136 %137 %138
|
||||
%137 = OpLabel
|
||||
%139 = OpAccessChain %28 %25 %26 %26
|
||||
%140 = OpLoad %12 %139
|
||||
%143 = OpAccessChain %142 %38 %141
|
||||
%144 = OpLoad %12 %143
|
||||
%145 = OpFSub %12 %144 %140
|
||||
%146 = OpAccessChain %142 %38 %141
|
||||
OpStore %146 %145
|
||||
OpBranch %138
|
||||
%138 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%6 = OpFunction %2 None %3
|
||||
%7 = OpLabel
|
||||
%36 = OpVariable %35 Function
|
||||
%19 = OpAccessChain %18 %15 %17
|
||||
%20 = OpLoad %12 %19
|
||||
%29 = OpAccessChain %28 %25 %26 %27
|
||||
%30 = OpLoad %12 %29
|
||||
%32 = OpFOrdGreaterThan %31 %20 %30
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %34
|
||||
%33 = OpLabel
|
||||
%39 = OpLoad %13 %38
|
||||
OpStore %36 %39
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%40 = OpLoad %13 %36
|
||||
OpStore %38 %40
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%10 = OpFunction %8 None %9
|
||||
%11 = OpLabel
|
||||
%42 = OpVariable %41 Function
|
||||
%49 = OpAccessChain %48 %47 %26 %27
|
||||
%50 = OpLoad %8 %49
|
||||
OpStore %42 %50
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
OpLoopMerge %53 %54 None
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
%56 = OpLoad %8 %42
|
||||
%58 = OpAccessChain %48 %47 %26 %57
|
||||
%59 = OpLoad %8 %58
|
||||
%60 = OpSLessThan %31 %56 %59
|
||||
OpBranchConditional %60 %52 %53
|
||||
%52 = OpLabel
|
||||
%64 = OpAccessChain %48 %63 %26
|
||||
%65 = OpLoad %8 %64
|
||||
%66 = OpAccessChain %48 %47 %26 %27
|
||||
%67 = OpLoad %8 %66
|
||||
%68 = OpSGreaterThan %31 %65 %67
|
||||
OpSelectionMerge %70 None
|
||||
OpBranchConditional %68 %69 %74
|
||||
%69 = OpLabel
|
||||
%71 = OpFunctionCall %2 %6
|
||||
%72 = OpAccessChain %48 %47 %26 %57
|
||||
%73 = OpLoad %8 %72
|
||||
OpStore %42 %73
|
||||
OpBranch %70
|
||||
%74 = OpLabel
|
||||
%75 = OpFunctionCall %2 %6
|
||||
OpBranch %70
|
||||
%70 = OpLabel
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
OpBranch %51
|
||||
%53 = OpLabel
|
||||
%76 = OpLoad %8 %42
|
||||
OpReturnValue %76
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# three
|
||||
BUFFER variant_three DATA_TYPE int32 STD140 DATA
|
||||
3
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
20 1 0 2
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0 0.0 1.7
|
||||
END
|
||||
# _GLF_uniform_uint_values
|
||||
BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA
|
||||
60433
|
||||
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_three AS uniform DESCRIPTOR_SET 0 BINDING 3
|
||||
BIND BUFFER variant__GLF_uniform_int_values 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_uint_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
|
||||
@@ -0,0 +1,192 @@
|
||||
#!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 a specific DAG code paths
|
||||
|
||||
# The test passes because the shader always writes red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '-O'
|
||||
# spirv-opt commit hash: a187dd58a0485988841d325a85c8e6063f53500a
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# #define _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_0_1 _GLF_uniform_float_values[2]
|
||||
# #define _float_0_3 _GLF_uniform_float_values[3]
|
||||
# #define _float_0_2 _GLF_uniform_float_values[4]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0, 0.1, 0.3, 0.2]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[5];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // These conditions don't matter since the color
|
||||
# // gets overwritten right after.
|
||||
# if(gl_FragCoord.x > _float_1_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_float_0_1);
|
||||
# if(gl_FragCoord.y > _float_1_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_float_0_2);
|
||||
# }
|
||||
# _GLF_color = vec4(_float_0_3);
|
||||
# }
|
||||
#
|
||||
# _GLF_color = vec4(_float_1_0, _float_0_0, _float_0_0, 10.0);
|
||||
# // Multiplying by an identity matrix doesn't change the vector value.
|
||||
# _GLF_color = mat4(_float_1_0) * _GLF_color;
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 72
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9 %30
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "gl_FragCoord"
|
||||
OpName %17 "buf0"
|
||||
OpMemberName %17 0 "_GLF_uniform_float_values"
|
||||
OpName %19 ""
|
||||
OpName %30 "_GLF_color"
|
||||
OpDecorate %9 BuiltIn FragCoord
|
||||
OpDecorate %16 ArrayStride 16
|
||||
OpMemberDecorate %17 0 Offset 0
|
||||
OpDecorate %17 Block
|
||||
OpDecorate %19 DescriptorSet 0
|
||||
OpDecorate %19 Binding 0
|
||||
OpDecorate %30 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Input %7
|
||||
%9 = OpVariable %8 Input
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 0
|
||||
%12 = OpTypePointer Input %6
|
||||
%15 = OpConstant %10 5
|
||||
%16 = OpTypeArray %6 %15
|
||||
%17 = OpTypeStruct %16
|
||||
%18 = OpTypePointer Uniform %17
|
||||
%19 = OpVariable %18 Uniform
|
||||
%20 = OpTypeInt 32 1
|
||||
%21 = OpConstant %20 0
|
||||
%22 = OpTypePointer Uniform %6
|
||||
%25 = OpTypeBool
|
||||
%29 = OpTypePointer Output %7
|
||||
%30 = OpVariable %29 Output
|
||||
%31 = OpConstant %20 2
|
||||
%35 = OpConstant %10 1
|
||||
%43 = OpConstant %20 4
|
||||
%47 = OpConstant %20 3
|
||||
%53 = OpConstant %20 1
|
||||
%58 = OpConstant %6 10
|
||||
%62 = OpTypeMatrix %7 4
|
||||
%64 = OpConstant %6 0
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpAccessChain %12 %9 %11
|
||||
%14 = OpLoad %6 %13
|
||||
%23 = OpAccessChain %22 %19 %21 %21
|
||||
%24 = OpLoad %6 %23
|
||||
%26 = OpFOrdGreaterThan %25 %14 %24
|
||||
OpSelectionMerge %28 None
|
||||
OpBranchConditional %26 %27 %28
|
||||
%27 = OpLabel
|
||||
%32 = OpAccessChain %22 %19 %21 %31
|
||||
%33 = OpLoad %6 %32
|
||||
%34 = OpCompositeConstruct %7 %33 %33 %33 %33
|
||||
OpStore %30 %34
|
||||
%36 = OpAccessChain %12 %9 %35
|
||||
%37 = OpLoad %6 %36
|
||||
%40 = OpFOrdGreaterThan %25 %37 %24
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %40 %41 %42
|
||||
%41 = OpLabel
|
||||
%44 = OpAccessChain %22 %19 %21 %43
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpCompositeConstruct %7 %45 %45 %45 %45
|
||||
OpStore %30 %46
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%48 = OpAccessChain %22 %19 %21 %47
|
||||
%49 = OpLoad %6 %48
|
||||
%50 = OpCompositeConstruct %7 %49 %49 %49 %49
|
||||
OpStore %30 %50
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
%54 = OpAccessChain %22 %19 %21 %53
|
||||
%55 = OpLoad %6 %54
|
||||
%59 = OpCompositeConstruct %7 %24 %55 %55 %58
|
||||
OpStore %30 %59
|
||||
%65 = OpCompositeConstruct %7 %24 %64 %64 %64
|
||||
%66 = OpCompositeConstruct %7 %64 %24 %64 %64
|
||||
%67 = OpCompositeConstruct %7 %64 %64 %24 %64
|
||||
%68 = OpCompositeConstruct %7 %64 %64 %64 %24
|
||||
%69 = OpCompositeConstruct %62 %65 %66 %67 %68
|
||||
%70 = OpLoad %7 %30
|
||||
%71 = OpMatrixTimesVector %7 %69 %70
|
||||
OpStore %30 %71
|
||||
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 0.1 0.3 0.2
|
||||
END
|
||||
|
||||
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics variant_pipeline
|
||||
ATTACH variant_vertex_shader
|
||||
ATTACH variant_fragment_shader
|
||||
FRAMEBUFFER_SIZE 16 16
|
||||
BIND BUFFER variant_framebuffer AS color LOCATION 0
|
||||
BIND BUFFER variant__GLF_uniform_float_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 16 16
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,215 @@
|
||||
#!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 a specific bitwise operator cobmining code path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of v1: [0.0, 1.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# vec2 v1;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# bool b = true;
|
||||
#
|
||||
# // Always true.
|
||||
# if (v1.x > v1.y)
|
||||
# {
|
||||
# // Always false.
|
||||
# if (v1.x < v1.y)
|
||||
# {
|
||||
# b = false;
|
||||
# }
|
||||
# }
|
||||
# if (b)
|
||||
# {
|
||||
# _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; 8
|
||||
; Bound: 67
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %41
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "b"
|
||||
OpName %12 "buf1"
|
||||
OpMemberName %12 0 "v1"
|
||||
OpName %14 ""
|
||||
OpName %41 "_GLF_color"
|
||||
OpName %44 "buf0"
|
||||
OpMemberName %44 0 "_GLF_uniform_int_values"
|
||||
OpName %46 ""
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 1
|
||||
OpDecorate %41 Location 0
|
||||
OpDecorate %43 ArrayStride 16
|
||||
OpMemberDecorate %44 0 RelaxedPrecision
|
||||
OpMemberDecorate %44 0 Offset 0
|
||||
OpDecorate %44 Block
|
||||
OpDecorate %46 DescriptorSet 0
|
||||
OpDecorate %46 Binding 0
|
||||
OpDecorate %49 RelaxedPrecision
|
||||
OpDecorate %53 RelaxedPrecision
|
||||
OpDecorate %56 RelaxedPrecision
|
||||
OpDecorate %59 RelaxedPrecision
|
||||
OpDecorate %64 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeBool
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstantTrue %6
|
||||
%10 = OpTypeFloat 32
|
||||
%11 = OpTypeVector %10 2
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpTypeInt 32 1
|
||||
%16 = OpConstant %15 0
|
||||
%17 = OpTypeInt 32 0
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpTypePointer Uniform %10
|
||||
%22 = OpConstant %17 1
|
||||
%35 = OpConstantFalse %6
|
||||
%39 = OpTypeVector %10 4
|
||||
%40 = OpTypePointer Output %39
|
||||
%41 = OpVariable %40 Output
|
||||
%42 = OpConstant %17 2
|
||||
%43 = OpTypeArray %15 %42
|
||||
%44 = OpTypeStruct %43
|
||||
%45 = OpTypePointer Uniform %44
|
||||
%46 = OpVariable %45 Uniform
|
||||
%47 = OpTypePointer Uniform %15
|
||||
%51 = OpConstant %15 1
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%20 = OpAccessChain %19 %14 %16 %18
|
||||
%21 = OpLoad %10 %20
|
||||
%23 = OpAccessChain %19 %14 %16 %22
|
||||
%24 = OpLoad %10 %23
|
||||
%25 = OpFOrdGreaterThan %6 %21 %24
|
||||
OpSelectionMerge %27 None
|
||||
OpBranchConditional %25 %26 %27
|
||||
%26 = OpLabel
|
||||
%28 = OpAccessChain %19 %14 %16 %18
|
||||
%29 = OpLoad %10 %28
|
||||
%30 = OpAccessChain %19 %14 %16 %22
|
||||
%31 = OpLoad %10 %30
|
||||
%32 = OpFOrdLessThan %6 %29 %31
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %34
|
||||
%33 = OpLabel
|
||||
OpStore %8 %35
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
%36 = OpLoad %6 %8
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %36 %37 %62
|
||||
%37 = OpLabel
|
||||
%48 = OpAccessChain %47 %46 %16 %16
|
||||
%49 = OpLoad %15 %48
|
||||
%50 = OpConvertSToF %10 %49
|
||||
%52 = OpAccessChain %47 %46 %16 %51
|
||||
%53 = OpLoad %15 %52
|
||||
%54 = OpConvertSToF %10 %53
|
||||
%55 = OpAccessChain %47 %46 %16 %51
|
||||
%56 = OpLoad %15 %55
|
||||
%57 = OpConvertSToF %10 %56
|
||||
%58 = OpAccessChain %47 %46 %16 %16
|
||||
%59 = OpLoad %15 %58
|
||||
%60 = OpConvertSToF %10 %59
|
||||
%61 = OpCompositeConstruct %39 %50 %54 %57 %60
|
||||
OpStore %41 %61
|
||||
OpBranch %38
|
||||
%62 = OpLabel
|
||||
%63 = OpAccessChain %47 %46 %16 %51
|
||||
%64 = OpLoad %15 %63
|
||||
%65 = OpConvertSToF %10 %64
|
||||
%66 = OpCompositeConstruct %39 %65 %65 %65 %65
|
||||
OpStore %41 %66
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# v1
|
||||
BUFFER variant_v1 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
|
||||
1 0
|
||||
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_v1 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
|
||||
@@ -0,0 +1,151 @@
|
||||
#!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]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always true.
|
||||
# if (bitfieldExtract(3, 1, 2) == 1)
|
||||
# {
|
||||
# _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: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %18
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %18 "_GLF_color"
|
||||
OpName %22 "buf0"
|
||||
OpMemberName %22 0 "_GLF_uniform_int_values"
|
||||
OpName %24 ""
|
||||
OpDecorate %18 Location 0
|
||||
OpDecorate %21 ArrayStride 16
|
||||
OpMemberDecorate %22 0 Offset 0
|
||||
OpDecorate %22 Block
|
||||
OpDecorate %24 DescriptorSet 0
|
||||
OpDecorate %24 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpConstant %6 3
|
||||
%8 = OpConstant %6 1
|
||||
%9 = OpConstant %6 2
|
||||
%11 = OpTypeBool
|
||||
%15 = OpTypeFloat 32
|
||||
%16 = OpTypeVector %15 4
|
||||
%17 = OpTypePointer Output %16
|
||||
%18 = OpVariable %17 Output
|
||||
%19 = OpTypeInt 32 0
|
||||
%20 = OpConstant %19 2
|
||||
%21 = OpTypeArray %6 %20
|
||||
%22 = OpTypeStruct %21
|
||||
%23 = OpTypePointer Uniform %22
|
||||
%24 = OpVariable %23 Uniform
|
||||
%25 = OpConstant %6 0
|
||||
%26 = OpTypePointer Uniform %6
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%10 = OpBitFieldSExtract %6 %7 %8 %9
|
||||
%12 = OpIEqual %11 %10 %8
|
||||
OpSelectionMerge %14 None
|
||||
OpBranchConditional %12 %13 %40
|
||||
%13 = OpLabel
|
||||
%27 = OpAccessChain %26 %24 %25 %25
|
||||
%28 = OpLoad %6 %27
|
||||
%29 = OpConvertSToF %15 %28
|
||||
%30 = OpAccessChain %26 %24 %25 %8
|
||||
%31 = OpLoad %6 %30
|
||||
%32 = OpConvertSToF %15 %31
|
||||
%33 = OpAccessChain %26 %24 %25 %8
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpConvertSToF %15 %34
|
||||
%36 = OpAccessChain %26 %24 %25 %25
|
||||
%37 = OpLoad %6 %36
|
||||
%38 = OpConvertSToF %15 %37
|
||||
%39 = OpCompositeConstruct %16 %29 %32 %35 %38
|
||||
OpStore %18 %39
|
||||
OpBranch %14
|
||||
%40 = OpLabel
|
||||
%41 = OpAccessChain %26 %24 %25 %8
|
||||
%42 = OpLoad %6 %41
|
||||
%43 = OpConvertSToF %15 %42
|
||||
%44 = OpCompositeConstruct %16 %43 %43 %43 %43
|
||||
OpStore %18 %44
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,201 @@
|
||||
#!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.
|
||||
|
||||
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 _float_1_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 1.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of two: 2.0
|
||||
# layout(push_constant) uniform buf_push
|
||||
# {
|
||||
# float two;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Always true: regardless of the condition a value of one can never become larger by clamping.
|
||||
# if(clamp(1, _float_1_0 > two ? 1 : 0, 1) <= 1)
|
||||
# {
|
||||
# _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: 59
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %34
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %12 "buf0"
|
||||
OpMemberName %12 0 "_GLF_uniform_float_values"
|
||||
OpName %14 ""
|
||||
OpName %19 "buf_push"
|
||||
OpMemberName %19 0 "two"
|
||||
OpName %21 ""
|
||||
OpName %34 "_GLF_color"
|
||||
OpName %37 "buf1"
|
||||
OpMemberName %37 0 "_GLF_uniform_int_values"
|
||||
OpName %39 ""
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpMemberDecorate %19 0 Offset 0
|
||||
OpDecorate %19 Block
|
||||
OpDecorate %34 Location 0
|
||||
OpDecorate %36 ArrayStride 16
|
||||
OpMemberDecorate %37 0 Offset 0
|
||||
OpDecorate %37 Block
|
||||
OpDecorate %39 DescriptorSet 0
|
||||
OpDecorate %39 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpConstant %6 1
|
||||
%8 = OpTypeFloat 32
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 1
|
||||
%11 = OpTypeArray %8 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpTypePointer Uniform %8
|
||||
%19 = OpTypeStruct %8
|
||||
%20 = OpTypePointer PushConstant %19
|
||||
%21 = OpVariable %20 PushConstant
|
||||
%22 = OpTypePointer PushConstant %8
|
||||
%25 = OpTypeBool
|
||||
%32 = OpTypeVector %8 4
|
||||
%33 = OpTypePointer Output %32
|
||||
%34 = OpVariable %33 Output
|
||||
%35 = OpConstant %9 2
|
||||
%36 = OpTypeArray %6 %35
|
||||
%37 = OpTypeStruct %36
|
||||
%38 = OpTypePointer Uniform %37
|
||||
%39 = OpVariable %38 Uniform
|
||||
%40 = OpTypePointer Uniform %6
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%17 = OpAccessChain %16 %14 %15 %15
|
||||
%18 = OpLoad %8 %17
|
||||
%23 = OpAccessChain %22 %21 %15
|
||||
%24 = OpLoad %8 %23
|
||||
%26 = OpFOrdGreaterThan %25 %18 %24
|
||||
%27 = OpSelect %6 %26 %7 %15
|
||||
%28 = OpExtInst %6 %1 SClamp %7 %27 %7
|
||||
%29 = OpSLessThanEqual %25 %28 %7
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %30 %54
|
||||
%30 = OpLabel
|
||||
%41 = OpAccessChain %40 %39 %15 %15
|
||||
%42 = OpLoad %6 %41
|
||||
%43 = OpConvertSToF %8 %42
|
||||
%44 = OpAccessChain %40 %39 %15 %7
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpConvertSToF %8 %45
|
||||
%47 = OpAccessChain %40 %39 %15 %7
|
||||
%48 = OpLoad %6 %47
|
||||
%49 = OpConvertSToF %8 %48
|
||||
%50 = OpAccessChain %40 %39 %15 %15
|
||||
%51 = OpLoad %6 %50
|
||||
%52 = OpConvertSToF %8 %51
|
||||
%53 = OpCompositeConstruct %32 %43 %46 %49 %52
|
||||
OpStore %34 %53
|
||||
OpBranch %31
|
||||
%54 = OpLabel
|
||||
%55 = OpAccessChain %40 %39 %15 %7
|
||||
%56 = OpLoad %6 %55
|
||||
%57 = OpConvertSToF %8 %56
|
||||
%58 = OpCompositeConstruct %32 %57 %57 %57 %57
|
||||
OpStore %34 %58
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# two
|
||||
BUFFER variant_two DATA_TYPE float STD140 DATA
|
||||
2.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0
|
||||
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_two AS push_constant
|
||||
BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,185 @@
|
||||
#!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]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = 0;
|
||||
#
|
||||
# if(gl_FragCoord.y > 10.0)
|
||||
# {
|
||||
# a++;
|
||||
# }
|
||||
#
|
||||
# // Before division a is either 0 or 1. In both cases integer division results in zero.
|
||||
# a /= 2;
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == 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: 60
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %13 %35
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %13 "gl_FragCoord"
|
||||
OpName %35 "_GLF_color"
|
||||
OpName %38 "buf0"
|
||||
OpMemberName %38 0 "_GLF_uniform_int_values"
|
||||
OpName %40 ""
|
||||
OpDecorate %13 BuiltIn FragCoord
|
||||
OpDecorate %35 Location 0
|
||||
OpDecorate %37 ArrayStride 16
|
||||
OpMemberDecorate %38 0 Offset 0
|
||||
OpDecorate %38 Block
|
||||
OpDecorate %40 DescriptorSet 0
|
||||
OpDecorate %40 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 0
|
||||
%10 = OpTypeFloat 32
|
||||
%11 = OpTypeVector %10 4
|
||||
%12 = OpTypePointer Input %11
|
||||
%13 = OpVariable %12 Input
|
||||
%14 = OpTypeInt 32 0
|
||||
%15 = OpConstant %14 1
|
||||
%16 = OpTypePointer Input %10
|
||||
%19 = OpConstant %10 10
|
||||
%20 = OpTypeBool
|
||||
%25 = OpConstant %6 1
|
||||
%27 = OpConstant %6 2
|
||||
%34 = OpTypePointer Output %11
|
||||
%35 = OpVariable %34 Output
|
||||
%36 = OpConstant %14 2
|
||||
%37 = OpTypeArray %6 %36
|
||||
%38 = OpTypeStruct %37
|
||||
%39 = OpTypePointer Uniform %38
|
||||
%40 = OpVariable %39 Uniform
|
||||
%41 = OpTypePointer Uniform %6
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%17 = OpAccessChain %16 %13 %15
|
||||
%18 = OpLoad %10 %17
|
||||
%21 = OpFOrdGreaterThan %20 %18 %19
|
||||
OpSelectionMerge %23 None
|
||||
OpBranchConditional %21 %22 %23
|
||||
%22 = OpLabel
|
||||
%24 = OpLoad %6 %8
|
||||
%26 = OpIAdd %6 %24 %25
|
||||
OpStore %8 %26
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
%28 = OpLoad %6 %8
|
||||
%29 = OpSDiv %6 %28 %27
|
||||
OpStore %8 %29
|
||||
%30 = OpLoad %6 %8
|
||||
%31 = OpIEqual %20 %30 %9
|
||||
OpSelectionMerge %33 None
|
||||
OpBranchConditional %31 %32 %55
|
||||
%32 = OpLabel
|
||||
%42 = OpAccessChain %41 %40 %9 %9
|
||||
%43 = OpLoad %6 %42
|
||||
%44 = OpConvertSToF %10 %43
|
||||
%45 = OpAccessChain %41 %40 %9 %25
|
||||
%46 = OpLoad %6 %45
|
||||
%47 = OpConvertSToF %10 %46
|
||||
%48 = OpAccessChain %41 %40 %9 %25
|
||||
%49 = OpLoad %6 %48
|
||||
%50 = OpConvertSToF %10 %49
|
||||
%51 = OpAccessChain %41 %40 %9 %9
|
||||
%52 = OpLoad %6 %51
|
||||
%53 = OpConvertSToF %10 %52
|
||||
%54 = OpCompositeConstruct %11 %44 %47 %50 %53
|
||||
OpStore %35 %54
|
||||
OpBranch %33
|
||||
%55 = OpLabel
|
||||
%56 = OpAccessChain %41 %40 %9 %25
|
||||
%57 = OpLoad %6 %56
|
||||
%58 = OpConvertSToF %10 %57
|
||||
%59 = OpCompositeConstruct %11 %58 %58 %58 %58
|
||||
OpStore %35 %59
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,204 @@
|
||||
#!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 BRW 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_50 _GLF_uniform_int_values[2]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 50]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = _int_0;
|
||||
#
|
||||
# for(int i = _int_0; i < _int_50; i++)
|
||||
# {
|
||||
# // Always true.
|
||||
# if ((~i) != 0)
|
||||
# {
|
||||
# a++;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(a == _int_50)
|
||||
# {
|
||||
# _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: 71
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %52
|
||||
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 %20 "i"
|
||||
OpName %52 "_GLF_color"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %52 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 3
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpConstant %6 1
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%29 = OpConstant %6 2
|
||||
%32 = OpTypeBool
|
||||
%49 = OpTypeFloat 32
|
||||
%50 = OpTypeVector %49 4
|
||||
%51 = OpTypePointer Output %50
|
||||
%52 = OpVariable %51 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%20 = OpVariable %7 Function
|
||||
%18 = OpAccessChain %17 %14 %15 %16
|
||||
%19 = OpLoad %6 %18
|
||||
OpStore %8 %19
|
||||
%21 = OpAccessChain %17 %14 %15 %16
|
||||
%22 = OpLoad %6 %21
|
||||
OpStore %20 %22
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
OpLoopMerge %25 %26 None
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
%28 = OpLoad %6 %20
|
||||
%30 = OpAccessChain %17 %14 %15 %29
|
||||
%31 = OpLoad %6 %30
|
||||
%33 = OpSLessThan %32 %28 %31
|
||||
OpBranchConditional %33 %24 %25
|
||||
%24 = OpLabel
|
||||
%34 = OpLoad %6 %20
|
||||
%35 = OpNot %6 %34
|
||||
%36 = OpINotEqual %32 %35 %15
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %36 %37 %38
|
||||
%37 = OpLabel
|
||||
%39 = OpLoad %6 %8
|
||||
%40 = OpIAdd %6 %39 %16
|
||||
OpStore %8 %40
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpBranch %26
|
||||
%26 = OpLabel
|
||||
%41 = OpLoad %6 %20
|
||||
%42 = OpIAdd %6 %41 %16
|
||||
OpStore %20 %42
|
||||
OpBranch %23
|
||||
%25 = OpLabel
|
||||
%43 = OpLoad %6 %8
|
||||
%44 = OpAccessChain %17 %14 %15 %29
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpIEqual %32 %43 %45
|
||||
OpSelectionMerge %48 None
|
||||
OpBranchConditional %46 %47 %66
|
||||
%47 = OpLabel
|
||||
%53 = OpAccessChain %17 %14 %15 %15
|
||||
%54 = OpLoad %6 %53
|
||||
%55 = OpConvertSToF %49 %54
|
||||
%56 = OpAccessChain %17 %14 %15 %16
|
||||
%57 = OpLoad %6 %56
|
||||
%58 = OpConvertSToF %49 %57
|
||||
%59 = OpAccessChain %17 %14 %15 %16
|
||||
%60 = OpLoad %6 %59
|
||||
%61 = OpConvertSToF %49 %60
|
||||
%62 = OpAccessChain %17 %14 %15 %15
|
||||
%63 = OpLoad %6 %62
|
||||
%64 = OpConvertSToF %49 %63
|
||||
%65 = OpCompositeConstruct %50 %55 %58 %61 %64
|
||||
OpStore %52 %65
|
||||
OpBranch %48
|
||||
%66 = OpLabel
|
||||
%67 = OpAccessChain %17 %14 %15 %16
|
||||
%68 = OpLoad %6 %67
|
||||
%69 = OpConvertSToF %49 %68
|
||||
%70 = OpCompositeConstruct %50 %69 %69 %69 %69
|
||||
OpStore %52 %70
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 50
|
||||
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
|
||||
@@ -0,0 +1,208 @@
|
||||
#!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 _float_1_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [1.0, 0.0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# mat3 m = mat3(_float_1_0, _float_1_0, _float_1_0, 0.0, _float_0_0, _float_1_0, _float_0_0, _float_1_0, _float_1_0);
|
||||
#
|
||||
# // Always true.
|
||||
# if(determinant(m) < _float_0_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: 77
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %53
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %10 "m"
|
||||
OpName %14 "buf1"
|
||||
OpMemberName %14 0 "_GLF_uniform_float_values"
|
||||
OpName %16 ""
|
||||
OpName %53 "_GLF_color"
|
||||
OpName %55 "buf0"
|
||||
OpMemberName %55 0 "_GLF_uniform_int_values"
|
||||
OpName %57 ""
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %53 Location 0
|
||||
OpDecorate %54 ArrayStride 16
|
||||
OpMemberDecorate %55 0 Offset 0
|
||||
OpDecorate %55 Block
|
||||
OpDecorate %57 DescriptorSet 0
|
||||
OpDecorate %57 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 3
|
||||
%8 = OpTypeMatrix %7 3
|
||||
%9 = OpTypePointer Function %8
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 2
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%26 = OpConstant %6 0
|
||||
%27 = OpConstant %17 1
|
||||
%38 = OpConstant %6 1
|
||||
%47 = OpTypeBool
|
||||
%51 = OpTypeVector %6 4
|
||||
%52 = OpTypePointer Output %51
|
||||
%53 = OpVariable %52 Output
|
||||
%54 = OpTypeArray %17 %12
|
||||
%55 = OpTypeStruct %54
|
||||
%56 = OpTypePointer Uniform %55
|
||||
%57 = OpVariable %56 Uniform
|
||||
%58 = OpTypePointer Uniform %17
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%10 = OpVariable %9 Function
|
||||
%20 = OpAccessChain %19 %16 %18 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%22 = OpAccessChain %19 %16 %18 %18
|
||||
%23 = OpLoad %6 %22
|
||||
%24 = OpAccessChain %19 %16 %18 %18
|
||||
%25 = OpLoad %6 %24
|
||||
%28 = OpAccessChain %19 %16 %18 %27
|
||||
%29 = OpLoad %6 %28
|
||||
%30 = OpAccessChain %19 %16 %18 %18
|
||||
%31 = OpLoad %6 %30
|
||||
%32 = OpAccessChain %19 %16 %18 %27
|
||||
%33 = OpLoad %6 %32
|
||||
%34 = OpAccessChain %19 %16 %18 %18
|
||||
%35 = OpLoad %6 %34
|
||||
%36 = OpAccessChain %19 %16 %18 %18
|
||||
%37 = OpLoad %6 %36
|
||||
%39 = OpCompositeConstruct %7 %21 %23 %25
|
||||
%40 = OpCompositeConstruct %7 %26 %29 %31
|
||||
%41 = OpCompositeConstruct %7 %33 %35 %37
|
||||
%42 = OpCompositeConstruct %8 %39 %40 %41
|
||||
OpStore %10 %42
|
||||
%43 = OpLoad %8 %10
|
||||
%44 = OpExtInst %6 %1 Determinant %43
|
||||
%45 = OpAccessChain %19 %16 %18 %27
|
||||
%46 = OpLoad %6 %45
|
||||
%48 = OpFOrdLessThan %47 %44 %46
|
||||
OpSelectionMerge %50 None
|
||||
OpBranchConditional %48 %49 %72
|
||||
%49 = OpLabel
|
||||
%59 = OpAccessChain %58 %57 %18 %18
|
||||
%60 = OpLoad %17 %59
|
||||
%61 = OpConvertSToF %6 %60
|
||||
%62 = OpAccessChain %58 %57 %18 %27
|
||||
%63 = OpLoad %17 %62
|
||||
%64 = OpConvertSToF %6 %63
|
||||
%65 = OpAccessChain %58 %57 %18 %27
|
||||
%66 = OpLoad %17 %65
|
||||
%67 = OpConvertSToF %6 %66
|
||||
%68 = OpAccessChain %58 %57 %18 %18
|
||||
%69 = OpLoad %17 %68
|
||||
%70 = OpConvertSToF %6 %69
|
||||
%71 = OpCompositeConstruct %51 %61 %64 %67 %70
|
||||
OpStore %53 %71
|
||||
OpBranch %50
|
||||
%72 = OpLabel
|
||||
%73 = OpAccessChain %58 %57 %18 %27
|
||||
%74 = OpLoad %17 %73
|
||||
%75 = OpConvertSToF %6 %74
|
||||
%76 = OpCompositeConstruct %51 %75 %75 %75 %75
|
||||
OpStore %53 %76
|
||||
OpBranch %50
|
||||
%50 = 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
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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.
|
||||
|
||||
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 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_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_4 _GLF_uniform_int_values[2]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp int;
|
||||
# precision highp float;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 4]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_float_values: 1.0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
# // Contents of injectionSwitch: [0.0, 1.0]
|
||||
# layout(set = 0, binding = 2) uniform buf2
|
||||
# {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = 1;
|
||||
# // The color value cannot be changed later without losing
|
||||
# // the coverage point we are after.
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
#
|
||||
# for(int i = _int_0; i < _int_4; i++)
|
||||
# {
|
||||
# if(a++ > 3)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
#
|
||||
# // Always false.
|
||||
# if(injectionSwitch.x > _float_1_0)
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 77
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %13
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %13 "_GLF_color"
|
||||
OpName %17 "buf0"
|
||||
OpMemberName %17 0 "_GLF_uniform_int_values"
|
||||
OpName %19 ""
|
||||
OpName %35 "i"
|
||||
OpName %57 "buf2"
|
||||
OpMemberName %57 0 "injectionSwitch"
|
||||
OpName %59 ""
|
||||
OpName %66 "buf1"
|
||||
OpMemberName %66 0 "_GLF_uniform_float_values"
|
||||
OpName %68 ""
|
||||
OpDecorate %13 Location 0
|
||||
OpDecorate %16 ArrayStride 16
|
||||
OpMemberDecorate %17 0 Offset 0
|
||||
OpDecorate %17 Block
|
||||
OpDecorate %19 DescriptorSet 0
|
||||
OpDecorate %19 Binding 0
|
||||
OpMemberDecorate %57 0 Offset 0
|
||||
OpDecorate %57 Block
|
||||
OpDecorate %59 DescriptorSet 0
|
||||
OpDecorate %59 Binding 2
|
||||
OpDecorate %65 ArrayStride 16
|
||||
OpMemberDecorate %66 0 Offset 0
|
||||
OpDecorate %66 Block
|
||||
OpDecorate %68 DescriptorSet 0
|
||||
OpDecorate %68 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 1
|
||||
%10 = OpTypeFloat 32
|
||||
%11 = OpTypeVector %10 4
|
||||
%12 = OpTypePointer Output %11
|
||||
%13 = OpVariable %12 Output
|
||||
%14 = OpTypeInt 32 0
|
||||
%15 = OpConstant %14 3
|
||||
%16 = OpTypeArray %6 %15
|
||||
%17 = OpTypeStruct %16
|
||||
%18 = OpTypePointer Uniform %17
|
||||
%19 = OpVariable %18 Uniform
|
||||
%20 = OpConstant %6 0
|
||||
%21 = OpTypePointer Uniform %6
|
||||
%44 = OpConstant %6 2
|
||||
%47 = OpTypeBool
|
||||
%51 = OpConstant %6 3
|
||||
%56 = OpTypeVector %10 2
|
||||
%57 = OpTypeStruct %56
|
||||
%58 = OpTypePointer Uniform %57
|
||||
%59 = OpVariable %58 Uniform
|
||||
%60 = OpConstant %14 0
|
||||
%61 = OpTypePointer Uniform %10
|
||||
%64 = OpConstant %14 1
|
||||
%65 = OpTypeArray %10 %64
|
||||
%66 = OpTypeStruct %65
|
||||
%67 = OpTypePointer Uniform %66
|
||||
%68 = OpVariable %67 Uniform
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%35 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%22 = OpAccessChain %21 %19 %20 %20
|
||||
%23 = OpLoad %6 %22
|
||||
%24 = OpConvertSToF %10 %23
|
||||
%25 = OpAccessChain %21 %19 %20 %9
|
||||
%26 = OpLoad %6 %25
|
||||
%27 = OpConvertSToF %10 %26
|
||||
%28 = OpAccessChain %21 %19 %20 %9
|
||||
%29 = OpLoad %6 %28
|
||||
%30 = OpConvertSToF %10 %29
|
||||
%31 = OpAccessChain %21 %19 %20 %20
|
||||
%32 = OpLoad %6 %31
|
||||
%33 = OpConvertSToF %10 %32
|
||||
%34 = OpCompositeConstruct %11 %24 %27 %30 %33
|
||||
OpStore %13 %34
|
||||
%36 = OpAccessChain %21 %19 %20 %9
|
||||
%37 = OpLoad %6 %36
|
||||
OpStore %35 %37
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpLoopMerge %40 %41 None
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%43 = OpLoad %6 %35
|
||||
%45 = OpAccessChain %21 %19 %20 %44
|
||||
%46 = OpLoad %6 %45
|
||||
%48 = OpSLessThan %47 %43 %46
|
||||
OpBranchConditional %48 %39 %40
|
||||
%39 = OpLabel
|
||||
%49 = OpLoad %6 %8
|
||||
%50 = OpIAdd %6 %49 %9
|
||||
OpStore %8 %50
|
||||
%52 = OpSGreaterThan %47 %49 %51
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %52 %53 %54
|
||||
%53 = OpLabel
|
||||
OpBranch %40
|
||||
%54 = OpLabel
|
||||
%62 = OpAccessChain %61 %59 %20 %60
|
||||
%63 = OpLoad %10 %62
|
||||
%69 = OpAccessChain %61 %68 %20 %20
|
||||
%70 = OpLoad %10 %69
|
||||
%71 = OpFOrdGreaterThan %47 %63 %70
|
||||
OpSelectionMerge %73 None
|
||||
OpBranchConditional %71 %72 %73
|
||||
%72 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%73 = OpLabel
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
%75 = OpLoad %6 %35
|
||||
%76 = OpIAdd %6 %75 %9
|
||||
OpStore %35 %76
|
||||
OpBranch %38
|
||||
%40 = 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
|
||||
1.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 4
|
||||
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_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 256 256
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
#!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.
|
||||
|
||||
# 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_4 _GLF_uniform_int_values[1]
|
||||
# #define _int_1 _GLF_uniform_int_values[2]
|
||||
# #define _int_2 _GLF_uniform_int_values[3]
|
||||
# #define _float_2_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 4, 1, 2]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [2.0, 1.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;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float arr[10] = float[10](_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, _float_1_0);
|
||||
#
|
||||
# // Always false.
|
||||
# if(injectionSwitch.x > injectionSwitch.y)
|
||||
# {
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# // Always false.
|
||||
# if(gl_FragCoord.x < 0.0)
|
||||
# {
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# // Always false.
|
||||
# if(injectionSwitch.x > injectionSwitch.y)
|
||||
# {
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# // arr[1] becomes 2.0.
|
||||
# arr[_int_2 / findLSB(_int_4)] = _float_2_0;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(arr[_int_0] == _float_1_0 && arr[_int_1] == _float_2_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: 133
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %59 %114
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %11 "arr"
|
||||
OpName %14 "buf1"
|
||||
OpMemberName %14 0 "_GLF_uniform_float_values"
|
||||
OpName %16 ""
|
||||
OpName %43 "buf2"
|
||||
OpMemberName %43 0 "injectionSwitch"
|
||||
OpName %45 ""
|
||||
OpName %59 "gl_FragCoord"
|
||||
OpName %78 "buf0"
|
||||
OpMemberName %78 0 "_GLF_uniform_int_values"
|
||||
OpName %80 ""
|
||||
OpName %114 "_GLF_color"
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpMemberDecorate %43 0 Offset 0
|
||||
OpDecorate %43 Block
|
||||
OpDecorate %45 DescriptorSet 0
|
||||
OpDecorate %45 Binding 2
|
||||
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 %114 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 10
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpConstant %7 2
|
||||
%13 = OpTypeArray %6 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpConstant %17 1
|
||||
%20 = OpTypePointer Uniform %6
|
||||
%42 = OpTypeVector %6 2
|
||||
%43 = OpTypeStruct %42
|
||||
%44 = OpTypePointer Uniform %43
|
||||
%45 = OpVariable %44 Uniform
|
||||
%46 = OpConstant %7 0
|
||||
%49 = OpConstant %7 1
|
||||
%52 = OpTypeBool
|
||||
%57 = OpTypeVector %6 4
|
||||
%58 = OpTypePointer Input %57
|
||||
%59 = OpVariable %58 Input
|
||||
%60 = OpTypePointer Input %6
|
||||
%63 = OpConstant %6 0
|
||||
%76 = OpConstant %7 4
|
||||
%77 = OpTypeArray %17 %76
|
||||
%78 = OpTypeStruct %77
|
||||
%79 = OpTypePointer Uniform %78
|
||||
%80 = OpVariable %79 Uniform
|
||||
%81 = OpConstant %17 3
|
||||
%82 = OpTypePointer Uniform %17
|
||||
%91 = OpTypePointer Function %6
|
||||
%102 = OpConstant %17 2
|
||||
%113 = OpTypePointer Output %57
|
||||
%114 = OpVariable %113 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%21 = OpAccessChain %20 %16 %18 %19
|
||||
%22 = OpLoad %6 %21
|
||||
%41 = OpCompositeConstruct %9 %22 %22 %22 %22 %22 %22 %22 %22 %22 %22
|
||||
OpStore %11 %41
|
||||
%47 = OpAccessChain %20 %45 %18 %46
|
||||
%48 = OpLoad %6 %47
|
||||
%50 = OpAccessChain %20 %45 %18 %49
|
||||
%51 = OpLoad %6 %50
|
||||
%53 = OpFOrdGreaterThan %52 %48 %51
|
||||
OpSelectionMerge %55 None
|
||||
OpBranchConditional %53 %54 %56
|
||||
%54 = OpLabel
|
||||
OpBranch %55
|
||||
%56 = OpLabel
|
||||
%61 = OpAccessChain %60 %59 %46
|
||||
%62 = OpLoad %6 %61
|
||||
%64 = OpFOrdLessThan %52 %62 %63
|
||||
OpSelectionMerge %66 None
|
||||
OpBranchConditional %64 %65 %67
|
||||
%65 = OpLabel
|
||||
OpBranch %66
|
||||
%67 = OpLabel
|
||||
OpSelectionMerge %74 None
|
||||
OpBranchConditional %53 %73 %75
|
||||
%73 = OpLabel
|
||||
OpBranch %74
|
||||
%75 = OpLabel
|
||||
%83 = OpAccessChain %82 %80 %18 %81
|
||||
%84 = OpLoad %17 %83
|
||||
%85 = OpAccessChain %82 %80 %18 %19
|
||||
%86 = OpLoad %17 %85
|
||||
%87 = OpExtInst %17 %1 FindILsb %86
|
||||
%88 = OpSDiv %17 %84 %87
|
||||
%89 = OpAccessChain %20 %16 %18 %18
|
||||
%90 = OpLoad %6 %89
|
||||
%92 = OpAccessChain %91 %11 %88
|
||||
OpStore %92 %90
|
||||
OpBranch %74
|
||||
%74 = OpLabel
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
%93 = OpAccessChain %82 %80 %18 %18
|
||||
%94 = OpLoad %17 %93
|
||||
%95 = OpAccessChain %91 %11 %94
|
||||
%96 = OpLoad %6 %95
|
||||
%99 = OpFOrdEqual %52 %96 %22
|
||||
OpSelectionMerge %101 None
|
||||
OpBranchConditional %99 %100 %101
|
||||
%100 = OpLabel
|
||||
%103 = OpAccessChain %82 %80 %18 %102
|
||||
%104 = OpLoad %17 %103
|
||||
%105 = OpAccessChain %91 %11 %104
|
||||
%106 = OpLoad %6 %105
|
||||
%107 = OpAccessChain %20 %16 %18 %18
|
||||
%108 = OpLoad %6 %107
|
||||
%109 = OpFOrdEqual %52 %106 %108
|
||||
OpBranch %101
|
||||
%101 = OpLabel
|
||||
%110 = OpPhi %52 %99 %55 %109 %100
|
||||
OpSelectionMerge %112 None
|
||||
OpBranchConditional %110 %111 %128
|
||||
%111 = OpLabel
|
||||
%115 = OpAccessChain %82 %80 %18 %102
|
||||
%116 = OpLoad %17 %115
|
||||
%117 = OpConvertSToF %6 %116
|
||||
%120 = OpConvertSToF %6 %94
|
||||
%127 = OpCompositeConstruct %57 %117 %120 %120 %117
|
||||
OpStore %114 %127
|
||||
OpBranch %112
|
||||
%128 = OpLabel
|
||||
%131 = OpConvertSToF %6 %94
|
||||
%132 = OpCompositeConstruct %57 %131 %131 %131 %131
|
||||
OpStore %114 %132
|
||||
OpBranch %112
|
||||
%112 = 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
|
||||
2.0 1.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 4 1 2
|
||||
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_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 256 256
|
||||
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,224 @@
|
||||
#!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 a specific const folding path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_10 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _int_1 _GLF_uniform_int_values[2]
|
||||
# #define _float_9_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 9.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [10, 0, 1]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[3];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float arr[10];
|
||||
# for (int i = _int_0; i < _int_10; i++)
|
||||
# {
|
||||
# arr[i] = float(i);
|
||||
# }
|
||||
#
|
||||
# float f = arr[bitfieldInsert(9, 0, 0, 0) / 1];
|
||||
# if (f == _float_9_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, 1);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 78
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %62
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "i"
|
||||
OpName %12 "buf1"
|
||||
OpMemberName %12 0 "_GLF_uniform_int_values"
|
||||
OpName %14 ""
|
||||
OpName %34 "arr"
|
||||
OpName %42 "f"
|
||||
OpName %51 "buf0"
|
||||
OpMemberName %51 0 "_GLF_uniform_float_values"
|
||||
OpName %53 ""
|
||||
OpName %62 "_GLF_color"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 1
|
||||
OpDecorate %50 ArrayStride 16
|
||||
OpMemberDecorate %51 0 Offset 0
|
||||
OpDecorate %51 Block
|
||||
OpDecorate %53 DescriptorSet 0
|
||||
OpDecorate %53 Binding 0
|
||||
OpDecorate %62 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 3
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpConstant %6 1
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%28 = OpTypeBool
|
||||
%30 = OpTypeFloat 32
|
||||
%31 = OpConstant %9 10
|
||||
%32 = OpTypeArray %30 %31
|
||||
%33 = OpTypePointer Function %32
|
||||
%38 = OpTypePointer Function %30
|
||||
%43 = OpConstant %6 9
|
||||
%49 = OpConstant %9 1
|
||||
%50 = OpTypeArray %30 %49
|
||||
%51 = OpTypeStruct %50
|
||||
%52 = OpTypePointer Uniform %51
|
||||
%53 = OpVariable %52 Uniform
|
||||
%54 = OpTypePointer Uniform %30
|
||||
%60 = OpTypeVector %30 4
|
||||
%61 = OpTypePointer Output %60
|
||||
%62 = OpVariable %61 Output
|
||||
%63 = OpConstant %6 2
|
||||
%73 = OpConstant %30 1
|
||||
%76 = OpConstant %30 0
|
||||
%77 = OpConstantComposite %60 %76 %76 %76 %76
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%34 = OpVariable %33 Function
|
||||
%42 = OpVariable %38 Function
|
||||
%18 = OpAccessChain %17 %14 %15 %16
|
||||
%19 = OpLoad %6 %18
|
||||
OpStore %8 %19
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
OpLoopMerge %22 %23 None
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%25 = OpLoad %6 %8
|
||||
%26 = OpAccessChain %17 %14 %15 %15
|
||||
%27 = OpLoad %6 %26
|
||||
%29 = OpSLessThan %28 %25 %27
|
||||
OpBranchConditional %29 %21 %22
|
||||
%21 = OpLabel
|
||||
%35 = OpLoad %6 %8
|
||||
%36 = OpLoad %6 %8
|
||||
%37 = OpConvertSToF %30 %36
|
||||
%39 = OpAccessChain %38 %34 %35
|
||||
OpStore %39 %37
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
%40 = OpLoad %6 %8
|
||||
%41 = OpIAdd %6 %40 %16
|
||||
OpStore %8 %41
|
||||
OpBranch %20
|
||||
%22 = OpLabel
|
||||
%44 = OpBitFieldInsert %6 %43 %15 %15 %15
|
||||
%45 = OpSDiv %6 %44 %16
|
||||
%46 = OpAccessChain %38 %34 %45
|
||||
%47 = OpLoad %30 %46
|
||||
OpStore %42 %47
|
||||
%48 = OpLoad %30 %42
|
||||
%55 = OpAccessChain %54 %53 %15 %15
|
||||
%56 = OpLoad %30 %55
|
||||
%57 = OpFOrdEqual %28 %48 %56
|
||||
OpSelectionMerge %59 None
|
||||
OpBranchConditional %57 %58 %75
|
||||
%58 = OpLabel
|
||||
%64 = OpAccessChain %17 %14 %15 %63
|
||||
%65 = OpLoad %6 %64
|
||||
%66 = OpConvertSToF %30 %65
|
||||
%67 = OpAccessChain %17 %14 %15 %16
|
||||
%68 = OpLoad %6 %67
|
||||
%69 = OpConvertSToF %30 %68
|
||||
%70 = OpAccessChain %17 %14 %15 %16
|
||||
%71 = OpLoad %6 %70
|
||||
%72 = OpConvertSToF %30 %71
|
||||
%74 = OpCompositeConstruct %60 %66 %69 %72 %73
|
||||
OpStore %62 %74
|
||||
OpBranch %59
|
||||
%75 = OpLabel
|
||||
OpStore %62 %77
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
10 0 1
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
9.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,142 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding code path
|
||||
|
||||
# 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 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float quarter;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 v = ceil(vec4(424.113, quarter, 1.3, 19.62));
|
||||
#
|
||||
# if (v == vec4(425.0, 1.0, 2.0, 20.0))
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 41
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %36
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "v"
|
||||
OpName %11 "buf0"
|
||||
OpMemberName %11 0 "quarter"
|
||||
OpName %13 ""
|
||||
OpName %36 "_GLF_color"
|
||||
OpMemberDecorate %11 0 Offset 0
|
||||
OpDecorate %11 Block
|
||||
OpDecorate %13 DescriptorSet 0
|
||||
OpDecorate %13 Binding 0
|
||||
OpDecorate %36 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpConstant %6 424.113007
|
||||
%11 = OpTypeStruct %6
|
||||
%12 = OpTypePointer Uniform %11
|
||||
%13 = OpVariable %12 Uniform
|
||||
%14 = OpTypeInt 32 1
|
||||
%15 = OpConstant %14 0
|
||||
%16 = OpTypePointer Uniform %6
|
||||
%19 = OpConstant %6 1.29999995
|
||||
%20 = OpConstant %6 19.6200008
|
||||
%24 = OpConstant %6 425
|
||||
%25 = OpConstant %6 1
|
||||
%26 = OpConstant %6 2
|
||||
%27 = OpConstant %6 20
|
||||
%28 = OpConstantComposite %7 %24 %25 %26 %27
|
||||
%29 = OpTypeBool
|
||||
%30 = OpTypeVector %29 4
|
||||
%35 = OpTypePointer Output %7
|
||||
%36 = OpVariable %35 Output
|
||||
%37 = OpConstant %6 0
|
||||
%38 = OpConstantComposite %7 %25 %37 %37 %25
|
||||
%40 = OpConstantComposite %7 %37 %37 %37 %37
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%17 = OpAccessChain %16 %13 %15
|
||||
%18 = OpLoad %6 %17
|
||||
%21 = OpCompositeConstruct %7 %10 %18 %19 %20
|
||||
%22 = OpExtInst %7 %1 Ceil %21
|
||||
OpStore %9 %22
|
||||
%23 = OpLoad %7 %9
|
||||
%31 = OpFOrdEqual %30 %23 %28
|
||||
%32 = OpAll %29 %31
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %39
|
||||
%33 = OpLabel
|
||||
OpStore %36 %38
|
||||
OpBranch %34
|
||||
%39 = OpLabel
|
||||
OpStore %36 %40
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# quarter
|
||||
BUFFER variant_quarter DATA_TYPE float DATA
|
||||
0.25
|
||||
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_quarter 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
|
||||
@@ -0,0 +1,142 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding path
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int i = 0, j = 1;
|
||||
#
|
||||
# while(i < clamp(j, 5, 9))
|
||||
# {
|
||||
# i++;
|
||||
# j++;
|
||||
# }
|
||||
#
|
||||
# if (i == 9 && j == 10)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %39
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "i"
|
||||
OpName %10 "j"
|
||||
OpName %39 "_GLF_color"
|
||||
OpDecorate %39 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 0
|
||||
%11 = OpConstant %6 1
|
||||
%19 = OpConstant %6 5
|
||||
%20 = OpConstant %6 9
|
||||
%22 = OpTypeBool
|
||||
%31 = OpConstant %6 10
|
||||
%36 = OpTypeFloat 32
|
||||
%37 = OpTypeVector %36 4
|
||||
%38 = OpTypePointer Output %37
|
||||
%39 = OpVariable %38 Output
|
||||
%40 = OpConstant %36 1
|
||||
%41 = OpConstant %36 0
|
||||
%42 = OpConstantComposite %37 %40 %41 %41 %40
|
||||
%44 = OpConstantComposite %37 %41 %41 %41 %41
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
OpStore %10 %11
|
||||
OpBranch %12
|
||||
%12 = OpLabel
|
||||
OpLoopMerge %14 %15 None
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
%17 = OpLoad %6 %8
|
||||
%18 = OpLoad %6 %10
|
||||
%21 = OpExtInst %6 %1 SClamp %18 %19 %20
|
||||
%23 = OpSLessThan %22 %17 %21
|
||||
OpBranchConditional %23 %13 %14
|
||||
%13 = OpLabel
|
||||
%24 = OpLoad %6 %8
|
||||
%25 = OpIAdd %6 %24 %11
|
||||
OpStore %8 %25
|
||||
%26 = OpLoad %6 %10
|
||||
%27 = OpIAdd %6 %26 %11
|
||||
OpStore %10 %27
|
||||
OpBranch %15
|
||||
%15 = OpLabel
|
||||
OpBranch %12
|
||||
%14 = OpLabel
|
||||
%28 = OpLoad %6 %8
|
||||
%29 = OpIEqual %22 %28 %20
|
||||
%30 = OpLoad %6 %10
|
||||
%32 = OpIEqual %22 %30 %31
|
||||
%33 = OpLogicalAnd %22 %29 %32
|
||||
OpSelectionMerge %35 None
|
||||
OpBranchConditional %33 %34 %43
|
||||
%34 = OpLabel
|
||||
OpStore %39 %42
|
||||
OpBranch %35
|
||||
%43 = OpLabel
|
||||
OpStore %39 %44
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,122 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding rule path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // If condition is always false.
|
||||
# if (
|
||||
# clamp(
|
||||
# vec4(3000.0, 1.0, 8.0, 4.0),
|
||||
# vec4(2.0, 3.0, determinant(mat2(2.0, 0.0, 0.0, 2.0)), 5.0), // min = (2, 3, 4, 5)
|
||||
# vec4(6.0) // max = (6, 6, 6, 6)
|
||||
# ) != vec4(6, 3, 6, 5)
|
||||
# )
|
||||
# _GLF_color = vec4(0);
|
||||
# else
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 39
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %35
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %35 "_GLF_color"
|
||||
OpDecorate %35 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpConstant %6 3000
|
||||
%9 = OpConstant %6 1
|
||||
%10 = OpConstant %6 8
|
||||
%11 = OpConstant %6 4
|
||||
%12 = OpConstantComposite %7 %8 %9 %10 %11
|
||||
%13 = OpConstant %6 2
|
||||
%14 = OpConstant %6 3
|
||||
%15 = OpTypeVector %6 2
|
||||
%16 = OpTypeMatrix %15 2
|
||||
%17 = OpConstant %6 0
|
||||
%18 = OpConstantComposite %15 %13 %17
|
||||
%19 = OpConstantComposite %15 %17 %13
|
||||
%20 = OpConstantComposite %16 %18 %19
|
||||
%22 = OpConstant %6 5
|
||||
%24 = OpConstant %6 6
|
||||
%25 = OpConstantComposite %7 %24 %24 %24 %24
|
||||
%27 = OpConstantComposite %7 %24 %14 %24 %22
|
||||
%28 = OpTypeBool
|
||||
%29 = OpTypeVector %28 4
|
||||
%34 = OpTypePointer Output %7
|
||||
%35 = OpVariable %34 Output
|
||||
%36 = OpConstantComposite %7 %17 %17 %17 %17
|
||||
%38 = OpConstantComposite %7 %9 %17 %17 %9
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpExtInst %6 %1 Determinant %20
|
||||
%23 = OpCompositeConstruct %7 %13 %14 %21 %22
|
||||
%26 = OpExtInst %7 %1 FClamp %12 %23 %25
|
||||
%30 = OpFOrdNotEqual %29 %26 %27
|
||||
%31 = OpAny %28 %30
|
||||
OpSelectionMerge %33 None
|
||||
OpBranchConditional %31 %32 %37
|
||||
%32 = OpLabel
|
||||
OpStore %35 %36
|
||||
OpBranch %33
|
||||
%37 = OpLabel
|
||||
OpStore %35 %38
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,133 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding rule path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float zero;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if (vec4(clamp(2.0, zero, 1.0), clamp(-1.0, 0.0, zero), 0, 1) != vec4(1, 0, 0, 1))
|
||||
# _GLF_color = vec4(0);
|
||||
# else
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 36
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %33
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "buf0"
|
||||
OpMemberName %8 0 "zero"
|
||||
OpName %10 ""
|
||||
OpName %33 "_GLF_color"
|
||||
OpMemberDecorate %8 0 Offset 0
|
||||
OpDecorate %8 Block
|
||||
OpDecorate %10 DescriptorSet 0
|
||||
OpDecorate %10 Binding 0
|
||||
OpDecorate %33 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpConstant %6 2
|
||||
%8 = OpTypeStruct %6
|
||||
%9 = OpTypePointer Uniform %8
|
||||
%10 = OpVariable %9 Uniform
|
||||
%11 = OpTypeInt 32 1
|
||||
%12 = OpConstant %11 0
|
||||
%13 = OpTypePointer Uniform %6
|
||||
%16 = OpConstant %6 1
|
||||
%18 = OpConstant %6 -1
|
||||
%19 = OpConstant %6 0
|
||||
%23 = OpTypeVector %6 4
|
||||
%25 = OpConstantComposite %23 %16 %19 %19 %16
|
||||
%26 = OpTypeBool
|
||||
%27 = OpTypeVector %26 4
|
||||
%32 = OpTypePointer Output %23
|
||||
%33 = OpVariable %32 Output
|
||||
%34 = OpConstantComposite %23 %19 %19 %19 %19
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%14 = OpAccessChain %13 %10 %12
|
||||
%15 = OpLoad %6 %14
|
||||
%17 = OpExtInst %6 %1 FClamp %7 %15 %16
|
||||
%20 = OpAccessChain %13 %10 %12
|
||||
%21 = OpLoad %6 %20
|
||||
%22 = OpExtInst %6 %1 FClamp %18 %19 %21
|
||||
%24 = OpCompositeConstruct %23 %17 %22 %19 %16
|
||||
%28 = OpFOrdNotEqual %27 %24 %25
|
||||
%29 = OpAny %26 %28
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %30 %35
|
||||
%30 = OpLabel
|
||||
OpStore %33 %34
|
||||
OpBranch %31
|
||||
%35 = OpLabel
|
||||
OpStore %33 %25
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE float DATA
|
||||
0.0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,136 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding path
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float one;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(0);
|
||||
#
|
||||
# float f = clamp(one, 1.0, 1.0);
|
||||
#
|
||||
# if (f > one) // Always false.
|
||||
# _GLF_color = vec4(0);
|
||||
# else
|
||||
# _GLF_color = vec4(f, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 34
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "_GLF_color"
|
||||
OpName %13 "f"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "one"
|
||||
OpName %16 ""
|
||||
OpDecorate %9 Location 0
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Output %7
|
||||
%9 = OpVariable %8 Output
|
||||
%10 = OpConstant %6 0
|
||||
%11 = OpConstantComposite %7 %10 %10 %10 %10
|
||||
%12 = OpTypePointer Function %6
|
||||
%14 = OpTypeStruct %6
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpConstant %17 0
|
||||
%19 = OpTypePointer Uniform %6
|
||||
%22 = OpConstant %6 1
|
||||
%27 = OpTypeBool
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpVariable %12 Function
|
||||
OpStore %9 %11
|
||||
%20 = OpAccessChain %19 %16 %18
|
||||
%21 = OpLoad %6 %20
|
||||
%23 = OpExtInst %6 %1 FClamp %21 %22 %22
|
||||
OpStore %13 %23
|
||||
%24 = OpLoad %6 %13
|
||||
%25 = OpAccessChain %19 %16 %18
|
||||
%26 = OpLoad %6 %25
|
||||
%28 = OpFOrdGreaterThan %27 %24 %26
|
||||
OpSelectionMerge %30 None
|
||||
OpBranchConditional %28 %29 %31
|
||||
%29 = OpLabel
|
||||
OpStore %9 %11
|
||||
OpBranch %30
|
||||
%31 = OpLabel
|
||||
%32 = OpLoad %6 %13
|
||||
%33 = OpCompositeConstruct %7 %32 %10 %10 %22
|
||||
OpStore %9 %33
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE float DATA
|
||||
1.0
|
||||
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_one 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
|
||||
@@ -0,0 +1,141 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding rule path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float fourtytwo;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // If condition is always false.
|
||||
# if(clamp(1.0, fourtytwo, fourtytwo) > 42.0
|
||||
# || clamp(1.0, fourtytwo, fourtytwo) < 42.0)
|
||||
# _GLF_color = vec4(0);
|
||||
# else
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
#
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 41
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %36
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "buf0"
|
||||
OpMemberName %9 0 "fourtytwo"
|
||||
OpName %11 ""
|
||||
OpName %36 "_GLF_color"
|
||||
OpMemberDecorate %9 0 Offset 0
|
||||
OpDecorate %9 Block
|
||||
OpDecorate %11 DescriptorSet 0
|
||||
OpDecorate %11 Binding 0
|
||||
OpDecorate %36 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeBool
|
||||
%7 = OpTypeFloat 32
|
||||
%8 = OpConstant %7 1
|
||||
%9 = OpTypeStruct %7
|
||||
%10 = OpTypePointer Uniform %9
|
||||
%11 = OpVariable %10 Uniform
|
||||
%12 = OpTypeInt 32 1
|
||||
%13 = OpConstant %12 0
|
||||
%14 = OpTypePointer Uniform %7
|
||||
%20 = OpConstant %7 42
|
||||
%34 = OpTypeVector %7 4
|
||||
%35 = OpTypePointer Output %34
|
||||
%36 = OpVariable %35 Output
|
||||
%37 = OpConstant %7 0
|
||||
%38 = OpConstantComposite %34 %37 %37 %37 %37
|
||||
%40 = OpConstantComposite %34 %8 %37 %37 %8
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%15 = OpAccessChain %14 %11 %13
|
||||
%16 = OpLoad %7 %15
|
||||
%17 = OpAccessChain %14 %11 %13
|
||||
%18 = OpLoad %7 %17
|
||||
%19 = OpExtInst %7 %1 FClamp %8 %16 %18
|
||||
%21 = OpFOrdGreaterThan %6 %19 %20
|
||||
%22 = OpLogicalNot %6 %21
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %22 %23 %24
|
||||
%23 = OpLabel
|
||||
%25 = OpAccessChain %14 %11 %13
|
||||
%26 = OpLoad %7 %25
|
||||
%27 = OpAccessChain %14 %11 %13
|
||||
%28 = OpLoad %7 %27
|
||||
%29 = OpExtInst %7 %1 FClamp %8 %26 %28
|
||||
%30 = OpFOrdLessThan %6 %29 %20
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%31 = OpPhi %6 %21 %5 %30 %23
|
||||
OpSelectionMerge %33 None
|
||||
OpBranchConditional %31 %32 %39
|
||||
%32 = OpLabel
|
||||
OpStore %36 %38
|
||||
OpBranch %33
|
||||
%39 = OpLabel
|
||||
OpStore %36 %40
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# fourtytwo
|
||||
BUFFER variant_fourtytwo DATA_TYPE float DATA
|
||||
42.0
|
||||
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_fourtytwo 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
|
||||
@@ -0,0 +1,152 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding path
|
||||
|
||||
# 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 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec4 ref;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // f becomes 1.
|
||||
# float f = determinant(mat3(1.0));
|
||||
# vec4 v = vec4(sin(f), cos(f), exp2(f), log(f));
|
||||
#
|
||||
# if (distance(v, ref) < 0.1)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %46
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "f"
|
||||
OpName %20 "v"
|
||||
OpName %31 "buf0"
|
||||
OpMemberName %31 0 "ref"
|
||||
OpName %33 ""
|
||||
OpName %46 "_GLF_color"
|
||||
OpMemberDecorate %31 0 Offset 0
|
||||
OpDecorate %31 Block
|
||||
OpDecorate %33 DescriptorSet 0
|
||||
OpDecorate %33 Binding 0
|
||||
OpDecorate %46 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeVector %6 3
|
||||
%10 = OpTypeMatrix %9 3
|
||||
%11 = OpConstant %6 1
|
||||
%12 = OpConstant %6 0
|
||||
%13 = OpConstantComposite %9 %11 %12 %12
|
||||
%14 = OpConstantComposite %9 %12 %11 %12
|
||||
%15 = OpConstantComposite %9 %12 %12 %11
|
||||
%16 = OpConstantComposite %10 %13 %14 %15
|
||||
%18 = OpTypeVector %6 4
|
||||
%19 = OpTypePointer Function %18
|
||||
%31 = OpTypeStruct %18
|
||||
%32 = OpTypePointer Uniform %31
|
||||
%33 = OpVariable %32 Uniform
|
||||
%34 = OpTypeInt 32 1
|
||||
%35 = OpConstant %34 0
|
||||
%36 = OpTypePointer Uniform %18
|
||||
%40 = OpConstant %6 0.100000001
|
||||
%41 = OpTypeBool
|
||||
%45 = OpTypePointer Output %18
|
||||
%46 = OpVariable %45 Output
|
||||
%47 = OpConstantComposite %18 %11 %12 %12 %11
|
||||
%49 = OpConstantComposite %18 %12 %12 %12 %12
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%20 = OpVariable %19 Function
|
||||
%17 = OpExtInst %6 %1 Determinant %16
|
||||
OpStore %8 %17
|
||||
%21 = OpLoad %6 %8
|
||||
%22 = OpExtInst %6 %1 Sin %21
|
||||
%23 = OpLoad %6 %8
|
||||
%24 = OpExtInst %6 %1 Cos %23
|
||||
%25 = OpLoad %6 %8
|
||||
%26 = OpExtInst %6 %1 Exp2 %25
|
||||
%27 = OpLoad %6 %8
|
||||
%28 = OpExtInst %6 %1 Log %27
|
||||
%29 = OpCompositeConstruct %18 %22 %24 %26 %28
|
||||
OpStore %20 %29
|
||||
%30 = OpLoad %18 %20
|
||||
%37 = OpAccessChain %36 %33 %35
|
||||
%38 = OpLoad %18 %37
|
||||
%39 = OpExtInst %6 %1 Distance %30 %38
|
||||
%42 = OpFOrdLessThan %41 %39 %40
|
||||
OpSelectionMerge %44 None
|
||||
OpBranchConditional %42 %43 %48
|
||||
%43 = OpLabel
|
||||
OpStore %46 %47
|
||||
OpBranch %44
|
||||
%48 = OpLabel
|
||||
OpStore %46 %49
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# ref
|
||||
BUFFER variant_ref DATA_TYPE vec4<float> DATA
|
||||
0.84 0.54 2.0 0.0
|
||||
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_ref 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
|
||||
@@ -0,0 +1,109 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding rule path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float one = 1.0;
|
||||
# // If condition is always false
|
||||
# if(dot(vec2(2.0, 1.0), vec2(1.0, (true ? 0.0 : one))) != 2.0)
|
||||
# _GLF_color = vec4(0);
|
||||
# else
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 29
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %25
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "one"
|
||||
OpName %25 "_GLF_color"
|
||||
OpDecorate %25 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 1
|
||||
%10 = OpTypeVector %6 2
|
||||
%11 = OpConstant %6 2
|
||||
%12 = OpConstantComposite %10 %11 %9
|
||||
%13 = OpTypeBool
|
||||
%14 = OpConstantTrue %13
|
||||
%15 = OpConstant %6 0
|
||||
%23 = OpTypeVector %6 4
|
||||
%24 = OpTypePointer Output %23
|
||||
%25 = OpVariable %24 Output
|
||||
%26 = OpConstantComposite %23 %15 %15 %15 %15
|
||||
%28 = OpConstantComposite %23 %9 %15 %15 %9
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
OpStore %8 %9
|
||||
%16 = OpLoad %6 %8
|
||||
%17 = OpSelect %6 %14 %15 %16
|
||||
%18 = OpCompositeConstruct %10 %9 %17
|
||||
%19 = OpDot %6 %12 %18
|
||||
%20 = OpFOrdNotEqual %13 %19 %11
|
||||
OpSelectionMerge %22 None
|
||||
OpBranchConditional %20 %21 %27
|
||||
%21 = OpLabel
|
||||
OpStore %25 %26
|
||||
OpBranch %22
|
||||
%27 = OpLabel
|
||||
OpStore %25 %28
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,104 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding rule path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if(dot(vec2(determinant(mat2(1)), 0), vec2(0)) == 0.0)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 28
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %24
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %24 "_GLF_color"
|
||||
OpDecorate %24 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypeMatrix %7 2
|
||||
%9 = OpConstant %6 1
|
||||
%10 = OpConstant %6 0
|
||||
%11 = OpConstantComposite %7 %9 %10
|
||||
%12 = OpConstantComposite %7 %10 %9
|
||||
%13 = OpConstantComposite %8 %11 %12
|
||||
%16 = OpConstantComposite %7 %10 %10
|
||||
%18 = OpTypeBool
|
||||
%22 = OpTypeVector %6 4
|
||||
%23 = OpTypePointer Output %22
|
||||
%24 = OpVariable %23 Output
|
||||
%25 = OpConstantComposite %22 %9 %10 %10 %9
|
||||
%27 = OpConstantComposite %22 %10 %10 %10 %10
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%14 = OpExtInst %6 %1 Determinant %13
|
||||
%15 = OpCompositeConstruct %7 %14 %10
|
||||
%17 = OpDot %6 %15 %16
|
||||
%19 = OpFOrdEqual %18 %17 %10
|
||||
OpSelectionMerge %21 None
|
||||
OpBranchConditional %19 %20 %26
|
||||
%20 = OpLabel
|
||||
OpStore %24 %25
|
||||
OpBranch %21
|
||||
%26 = OpLabel
|
||||
OpStore %24 %27
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,134 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding path
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float one;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if(3.0 >= clamp(gl_FragCoord.x, 1.0, 2.0 + one))
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %10 %33
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "gl_FragCoord"
|
||||
OpName %18 "buf0"
|
||||
OpMemberName %18 0 "one"
|
||||
OpName %20 ""
|
||||
OpName %33 "_GLF_color"
|
||||
OpDecorate %10 BuiltIn FragCoord
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 0
|
||||
OpDecorate %33 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpConstant %6 3
|
||||
%8 = OpTypeVector %6 4
|
||||
%9 = OpTypePointer Input %8
|
||||
%10 = OpVariable %9 Input
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 0
|
||||
%13 = OpTypePointer Input %6
|
||||
%16 = OpConstant %6 1
|
||||
%17 = OpConstant %6 2
|
||||
%18 = OpTypeStruct %6
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpTypeInt 32 1
|
||||
%22 = OpConstant %21 0
|
||||
%23 = OpTypePointer Uniform %6
|
||||
%28 = OpTypeBool
|
||||
%32 = OpTypePointer Output %8
|
||||
%33 = OpVariable %32 Output
|
||||
%34 = OpConstant %6 0
|
||||
%35 = OpConstantComposite %8 %16 %34 %34 %16
|
||||
%37 = OpConstantComposite %8 %34 %34 %34 %34
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%14 = OpAccessChain %13 %10 %12
|
||||
%15 = OpLoad %6 %14
|
||||
%24 = OpAccessChain %23 %20 %22
|
||||
%25 = OpLoad %6 %24
|
||||
%26 = OpFAdd %6 %17 %25
|
||||
%27 = OpExtInst %6 %1 FClamp %15 %16 %26
|
||||
%29 = OpFOrdGreaterThanEqual %28 %7 %27
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %30 %36
|
||||
%30 = OpLabel
|
||||
OpStore %33 %35
|
||||
OpBranch %31
|
||||
%36 = OpLabel
|
||||
OpStore %33 %37
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE float DATA
|
||||
1.0
|
||||
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_one 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
|
||||
@@ -0,0 +1,217 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding path
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int zero;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int data[2];
|
||||
# int highSigned = 1;
|
||||
# uint highUnsigned = 2u;
|
||||
#
|
||||
# for(int i = 0; i < min(10, highSigned) + zero; i++)
|
||||
# data[i] = 5;
|
||||
#
|
||||
# for(uint i = 1u; i < min(10u, highUnsigned) + uint(zero); i++)
|
||||
# data[i] = 6;
|
||||
#
|
||||
# if (data[0] == 5 && data[1] == 6)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 83
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %77
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "highSigned"
|
||||
OpName %12 "highUnsigned"
|
||||
OpName %14 "i"
|
||||
OpName %25 "buf0"
|
||||
OpMemberName %25 0 "zero"
|
||||
OpName %27 ""
|
||||
OpName %36 "data"
|
||||
OpName %42 "i"
|
||||
OpName %77 "_GLF_color"
|
||||
OpMemberDecorate %25 0 Offset 0
|
||||
OpDecorate %25 Block
|
||||
OpDecorate %27 DescriptorSet 0
|
||||
OpDecorate %27 Binding 0
|
||||
OpDecorate %77 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 1
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpTypePointer Function %10
|
||||
%13 = OpConstant %10 2
|
||||
%15 = OpConstant %6 0
|
||||
%22 = OpConstant %6 10
|
||||
%25 = OpTypeStruct %6
|
||||
%26 = OpTypePointer Uniform %25
|
||||
%27 = OpVariable %26 Uniform
|
||||
%28 = OpTypePointer Uniform %6
|
||||
%32 = OpTypeBool
|
||||
%34 = OpTypeArray %6 %13
|
||||
%35 = OpTypePointer Function %34
|
||||
%38 = OpConstant %6 5
|
||||
%43 = OpConstant %10 1
|
||||
%50 = OpConstant %10 10
|
||||
%59 = OpConstant %6 6
|
||||
%74 = OpTypeFloat 32
|
||||
%75 = OpTypeVector %74 4
|
||||
%76 = OpTypePointer Output %75
|
||||
%77 = OpVariable %76 Output
|
||||
%78 = OpConstant %74 1
|
||||
%79 = OpConstant %74 0
|
||||
%80 = OpConstantComposite %75 %78 %79 %79 %78
|
||||
%82 = OpConstantComposite %75 %79 %79 %79 %79
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%12 = OpVariable %11 Function
|
||||
%14 = OpVariable %7 Function
|
||||
%36 = OpVariable %35 Function
|
||||
%42 = OpVariable %11 Function
|
||||
OpStore %8 %9
|
||||
OpStore %12 %13
|
||||
OpStore %14 %15
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
OpLoopMerge %18 %19 None
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%21 = OpLoad %6 %14
|
||||
%23 = OpLoad %6 %8
|
||||
%24 = OpExtInst %6 %1 SMin %22 %23
|
||||
%29 = OpAccessChain %28 %27 %15
|
||||
%30 = OpLoad %6 %29
|
||||
%31 = OpIAdd %6 %24 %30
|
||||
%33 = OpSLessThan %32 %21 %31
|
||||
OpBranchConditional %33 %17 %18
|
||||
%17 = OpLabel
|
||||
%37 = OpLoad %6 %14
|
||||
%39 = OpAccessChain %7 %36 %37
|
||||
OpStore %39 %38
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
%40 = OpLoad %6 %14
|
||||
%41 = OpIAdd %6 %40 %9
|
||||
OpStore %14 %41
|
||||
OpBranch %16
|
||||
%18 = OpLabel
|
||||
OpStore %42 %43
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpLoopMerge %46 %47 None
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%49 = OpLoad %10 %42
|
||||
%51 = OpLoad %10 %12
|
||||
%52 = OpExtInst %10 %1 UMin %50 %51
|
||||
%53 = OpAccessChain %28 %27 %15
|
||||
%54 = OpLoad %6 %53
|
||||
%55 = OpBitcast %10 %54
|
||||
%56 = OpIAdd %10 %52 %55
|
||||
%57 = OpULessThan %32 %49 %56
|
||||
OpBranchConditional %57 %45 %46
|
||||
%45 = OpLabel
|
||||
%58 = OpLoad %10 %42
|
||||
%60 = OpAccessChain %7 %36 %58
|
||||
OpStore %60 %59
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%61 = OpLoad %10 %42
|
||||
%62 = OpIAdd %10 %61 %9
|
||||
OpStore %42 %62
|
||||
OpBranch %44
|
||||
%46 = OpLabel
|
||||
%63 = OpAccessChain %7 %36 %15
|
||||
%64 = OpLoad %6 %63
|
||||
%65 = OpIEqual %32 %64 %38
|
||||
OpSelectionMerge %67 None
|
||||
OpBranchConditional %65 %66 %67
|
||||
%66 = OpLabel
|
||||
%68 = OpAccessChain %7 %36 %9
|
||||
%69 = OpLoad %6 %68
|
||||
%70 = OpIEqual %32 %69 %59
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
%71 = OpPhi %32 %65 %46 %70 %66
|
||||
OpSelectionMerge %73 None
|
||||
OpBranchConditional %71 %72 %81
|
||||
%72 = OpLabel
|
||||
OpStore %77 %80
|
||||
OpBranch %73
|
||||
%81 = OpLabel
|
||||
OpStore %77 %82
|
||||
OpBranch %73
|
||||
%73 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE int32 DATA
|
||||
0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,147 @@
|
||||
#!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 a specific const folding path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_0 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [0, 1]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if (mod(1.0, 1.0) <= 0.01)
|
||||
# {
|
||||
# _GLF_color = vec4(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; 8
|
||||
; Bound: 42
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %16
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %16 "_GLF_color"
|
||||
OpName %21 "buf0"
|
||||
OpMemberName %21 0 "_GLF_uniform_int_values"
|
||||
OpName %23 ""
|
||||
OpDecorate %16 Location 0
|
||||
OpDecorate %20 ArrayStride 16
|
||||
OpMemberDecorate %21 0 Offset 0
|
||||
OpDecorate %21 Block
|
||||
OpDecorate %23 DescriptorSet 0
|
||||
OpDecorate %23 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpConstant %6 1
|
||||
%9 = OpConstant %6 0.00999999978
|
||||
%10 = OpTypeBool
|
||||
%14 = OpTypeVector %6 4
|
||||
%15 = OpTypePointer Output %14
|
||||
%16 = OpVariable %15 Output
|
||||
%17 = OpTypeInt 32 1
|
||||
%18 = OpTypeInt 32 0
|
||||
%19 = OpConstant %18 2
|
||||
%20 = OpTypeArray %17 %19
|
||||
%21 = OpTypeStruct %20
|
||||
%22 = OpTypePointer Uniform %21
|
||||
%23 = OpVariable %22 Uniform
|
||||
%24 = OpConstant %17 0
|
||||
%25 = OpTypePointer Uniform %17
|
||||
%32 = OpConstant %17 1
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpFMod %6 %7 %7
|
||||
%11 = OpFOrdLessThanEqual %10 %8 %9
|
||||
OpSelectionMerge %13 None
|
||||
OpBranchConditional %11 %12 %37
|
||||
%12 = OpLabel
|
||||
%26 = OpAccessChain %25 %23 %24 %24
|
||||
%27 = OpLoad %17 %26
|
||||
%28 = OpConvertSToF %6 %27
|
||||
%29 = OpAccessChain %25 %23 %24 %24
|
||||
%30 = OpLoad %17 %29
|
||||
%31 = OpConvertSToF %6 %30
|
||||
%33 = OpAccessChain %25 %23 %24 %32
|
||||
%34 = OpLoad %17 %33
|
||||
%35 = OpConvertSToF %6 %34
|
||||
%36 = OpCompositeConstruct %14 %7 %28 %31 %35
|
||||
OpStore %16 %36
|
||||
OpBranch %13
|
||||
%37 = OpLabel
|
||||
%38 = OpAccessChain %25 %23 %24 %24
|
||||
%39 = OpLoad %17 %38
|
||||
%40 = OpConvertSToF %6 %39
|
||||
%41 = OpCompositeConstruct %14 %40 %40 %40 %40
|
||||
OpStore %16 %41
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0 1
|
||||
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
|
||||
@@ -0,0 +1,200 @@
|
||||
#!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 a specific const folding path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 0.0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // This results in an undefined value, but not in undefined behavior.
|
||||
# float f = pow(40.33, ldexp(1.0, 98980));
|
||||
#
|
||||
# if (_int_1 == (_int_1 + _int_0) || f > _float_0_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; 8
|
||||
; Bound: 70
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %51
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "f"
|
||||
OpName %19 "buf0"
|
||||
OpMemberName %19 0 "_GLF_uniform_int_values"
|
||||
OpName %21 ""
|
||||
OpName %39 "buf1"
|
||||
OpMemberName %39 0 "_GLF_uniform_float_values"
|
||||
OpName %41 ""
|
||||
OpName %51 "_GLF_color"
|
||||
OpDecorate %18 ArrayStride 16
|
||||
OpMemberDecorate %19 0 Offset 0
|
||||
OpDecorate %19 Block
|
||||
OpDecorate %21 DescriptorSet 0
|
||||
OpDecorate %21 Binding 0
|
||||
OpDecorate %38 ArrayStride 16
|
||||
OpMemberDecorate %39 0 Offset 0
|
||||
OpDecorate %39 Block
|
||||
OpDecorate %41 DescriptorSet 0
|
||||
OpDecorate %41 Binding 1
|
||||
OpDecorate %51 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 40.3300018
|
||||
%10 = OpConstant %6 1
|
||||
%11 = OpTypeInt 32 1
|
||||
%12 = OpConstant %11 98980
|
||||
%15 = OpTypeBool
|
||||
%16 = OpTypeInt 32 0
|
||||
%17 = OpConstant %16 2
|
||||
%18 = OpTypeArray %11 %17
|
||||
%19 = OpTypeStruct %18
|
||||
%20 = OpTypePointer Uniform %19
|
||||
%21 = OpVariable %20 Uniform
|
||||
%22 = OpConstant %11 0
|
||||
%23 = OpTypePointer Uniform %11
|
||||
%28 = OpConstant %11 1
|
||||
%37 = OpConstant %16 1
|
||||
%38 = OpTypeArray %6 %37
|
||||
%39 = OpTypeStruct %38
|
||||
%40 = OpTypePointer Uniform %39
|
||||
%41 = OpVariable %40 Uniform
|
||||
%42 = OpTypePointer Uniform %6
|
||||
%49 = OpTypeVector %6 4
|
||||
%50 = OpTypePointer Output %49
|
||||
%51 = OpVariable %50 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%13 = OpExtInst %6 %1 Ldexp %10 %12
|
||||
%14 = OpExtInst %6 %1 Pow %9 %13
|
||||
OpStore %8 %14
|
||||
%24 = OpAccessChain %23 %21 %22 %22
|
||||
%25 = OpLoad %11 %24
|
||||
%26 = OpAccessChain %23 %21 %22 %22
|
||||
%27 = OpLoad %11 %26
|
||||
%29 = OpAccessChain %23 %21 %22 %28
|
||||
%30 = OpLoad %11 %29
|
||||
%31 = OpIAdd %11 %27 %30
|
||||
%32 = OpIEqual %15 %25 %31
|
||||
%33 = OpLogicalNot %15 %32
|
||||
OpSelectionMerge %35 None
|
||||
OpBranchConditional %33 %34 %35
|
||||
%34 = OpLabel
|
||||
%36 = OpLoad %6 %8
|
||||
%43 = OpAccessChain %42 %41 %22 %22
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpFOrdGreaterThan %15 %36 %44
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
%46 = OpPhi %15 %32 %5 %45 %34
|
||||
OpSelectionMerge %48 None
|
||||
OpBranchConditional %46 %47 %65
|
||||
%47 = OpLabel
|
||||
%52 = OpAccessChain %23 %21 %22 %22
|
||||
%53 = OpLoad %11 %52
|
||||
%54 = OpConvertSToF %6 %53
|
||||
%55 = OpAccessChain %23 %21 %22 %28
|
||||
%56 = OpLoad %11 %55
|
||||
%57 = OpConvertSToF %6 %56
|
||||
%58 = OpAccessChain %23 %21 %22 %28
|
||||
%59 = OpLoad %11 %58
|
||||
%60 = OpConvertSToF %6 %59
|
||||
%61 = OpAccessChain %23 %21 %22 %22
|
||||
%62 = OpLoad %11 %61
|
||||
%63 = OpConvertSToF %6 %62
|
||||
%64 = OpCompositeConstruct %49 %54 %57 %60 %63
|
||||
OpStore %51 %64
|
||||
OpBranch %48
|
||||
%65 = OpLabel
|
||||
%66 = OpAccessChain %23 %21 %22 %28
|
||||
%67 = OpLoad %11 %66
|
||||
%68 = OpConvertSToF %6 %67
|
||||
%69 = OpCompositeConstruct %49 %68 %68 %68 %68
|
||||
OpStore %51 %69
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0
|
||||
END
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
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
|
||||
@@ -0,0 +1,173 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding code path
|
||||
|
||||
# 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 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float one;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(0);
|
||||
#
|
||||
# // Always false.
|
||||
# if(one < 0.0 || one < 1.0)
|
||||
# return;
|
||||
#
|
||||
# // Always false.
|
||||
# if(one < 0.0)
|
||||
# {
|
||||
# while (one < 0.0)
|
||||
# {
|
||||
# _GLF_color = vec4(1);
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "_GLF_color"
|
||||
OpName %13 "buf0"
|
||||
OpMemberName %13 0 "one"
|
||||
OpName %15 ""
|
||||
OpDecorate %9 Location 0
|
||||
OpMemberDecorate %13 0 Offset 0
|
||||
OpDecorate %13 Block
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Output %7
|
||||
%9 = OpVariable %8 Output
|
||||
%10 = OpConstant %6 0
|
||||
%11 = OpConstantComposite %7 %10 %10 %10 %10
|
||||
%12 = OpTypeBool
|
||||
%13 = OpTypeStruct %6
|
||||
%14 = OpTypePointer Uniform %13
|
||||
%15 = OpVariable %14 Uniform
|
||||
%16 = OpTypeInt 32 1
|
||||
%17 = OpConstant %16 0
|
||||
%18 = OpTypePointer Uniform %6
|
||||
%27 = OpConstant %6 1
|
||||
%46 = OpConstantComposite %7 %27 %27 %27 %27
|
||||
%49 = OpConstantComposite %7 %27 %10 %10 %27
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
OpStore %9 %11
|
||||
%19 = OpAccessChain %18 %15 %17
|
||||
%20 = OpLoad %6 %19
|
||||
%21 = OpFOrdLessThan %12 %20 %10
|
||||
%22 = OpLogicalNot %12 %21
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %22 %23 %24
|
||||
%23 = OpLabel
|
||||
%25 = OpAccessChain %18 %15 %17
|
||||
%26 = OpLoad %6 %25
|
||||
%28 = OpFOrdLessThan %12 %26 %27
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%29 = OpPhi %12 %21 %5 %28 %23
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %30 %31
|
||||
%30 = OpLabel
|
||||
OpReturn
|
||||
%31 = OpLabel
|
||||
%33 = OpAccessChain %18 %15 %17
|
||||
%34 = OpLoad %6 %33
|
||||
%35 = OpFOrdLessThan %12 %34 %10
|
||||
OpSelectionMerge %37 None
|
||||
OpBranchConditional %35 %36 %48
|
||||
%36 = OpLabel
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpLoopMerge %40 %41 None
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%43 = OpAccessChain %18 %15 %17
|
||||
%44 = OpLoad %6 %43
|
||||
%45 = OpFOrdLessThan %12 %44 %10
|
||||
OpBranchConditional %45 %39 %40
|
||||
%39 = OpLabel
|
||||
OpStore %9 %46
|
||||
OpBranch %40
|
||||
%41 = OpLabel
|
||||
OpBranch %38
|
||||
%40 = OpLabel
|
||||
OpBranch %37
|
||||
%48 = OpLabel
|
||||
OpStore %9 %49
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE float DATA
|
||||
1.0
|
||||
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_one 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
|
||||
@@ -0,0 +1,147 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding path
|
||||
|
||||
# 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 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0 {
|
||||
# vec2 injectionSwitch;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float f = sinh(724.322);
|
||||
#
|
||||
# // Always true.
|
||||
# // injectionSwitch.x == 0.0.
|
||||
# // injectionSwitch.y == 1.0.
|
||||
# if (isinf(f) || injectionSwitch.x < injectionSwitch.y)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 43
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %37
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "f"
|
||||
OpName %18 "buf0"
|
||||
OpMemberName %18 0 "injectionSwitch"
|
||||
OpName %20 ""
|
||||
OpName %37 "_GLF_color"
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 0
|
||||
OpDecorate %37 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 724.322021
|
||||
%11 = OpTypeBool
|
||||
%17 = OpTypeVector %6 2
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpTypeInt 32 1
|
||||
%22 = OpConstant %21 0
|
||||
%23 = OpTypeInt 32 0
|
||||
%24 = OpConstant %23 0
|
||||
%25 = OpTypePointer Uniform %6
|
||||
%28 = OpConstant %23 1
|
||||
%35 = OpTypeVector %6 4
|
||||
%36 = OpTypePointer Output %35
|
||||
%37 = OpVariable %36 Output
|
||||
%38 = OpConstant %6 1
|
||||
%39 = OpConstant %6 0
|
||||
%40 = OpConstantComposite %35 %38 %39 %39 %38
|
||||
%42 = OpConstantComposite %35 %39 %39 %39 %39
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpExtInst %6 %1 Sinh %9
|
||||
OpStore %8 %10
|
||||
%12 = OpLoad %6 %8
|
||||
%13 = OpIsInf %11 %12
|
||||
%14 = OpLogicalNot %11 %13
|
||||
OpSelectionMerge %16 None
|
||||
OpBranchConditional %14 %15 %16
|
||||
%15 = OpLabel
|
||||
%26 = OpAccessChain %25 %20 %22 %24
|
||||
%27 = OpLoad %6 %26
|
||||
%29 = OpAccessChain %25 %20 %22 %28
|
||||
%30 = OpLoad %6 %29
|
||||
%31 = OpFOrdLessThan %11 %27 %30
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
%32 = OpPhi %11 %13 %5 %31 %15
|
||||
OpSelectionMerge %34 None
|
||||
OpBranchConditional %32 %33 %41
|
||||
%33 = OpLabel
|
||||
OpStore %37 %40
|
||||
OpBranch %34
|
||||
%41 = OpLabel
|
||||
OpStore %37 %42
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
|
||||
0.0 1.0
|
||||
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_injectionSwitch 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
|
||||
@@ -0,0 +1,145 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific const folding rule path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '-O'
|
||||
# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec2 v;
|
||||
#
|
||||
# for(int i = 2; i < 3; i++)
|
||||
# {
|
||||
# vec4 tmp = vec4(0);
|
||||
# tmp.xy = vec2(1.0, float(i));
|
||||
# v = tmp.xy;
|
||||
# }
|
||||
#
|
||||
# // If condition is always false.
|
||||
# if (v.x != 1.0 || v.y != 2.0)
|
||||
# _GLF_color = vec4(0);
|
||||
# else
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 69
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %57
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %57 "_GLF_color"
|
||||
OpDecorate %38 RelaxedPrecision
|
||||
OpDecorate %57 Location 0
|
||||
OpDecorate %62 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%9 = OpConstant %6 2
|
||||
%16 = OpConstant %6 3
|
||||
%17 = OpTypeBool
|
||||
%19 = OpTypeFloat 32
|
||||
%20 = OpTypeVector %19 4
|
||||
%23 = OpConstant %19 0
|
||||
%24 = OpConstantComposite %20 %23 %23 %23 %23
|
||||
%25 = OpConstant %19 1
|
||||
%28 = OpTypeVector %19 2
|
||||
%37 = OpConstant %6 1
|
||||
%51 = OpConstant %19 2
|
||||
%56 = OpTypePointer Output %20
|
||||
%57 = OpVariable %56 Output
|
||||
%59 = OpConstantComposite %20 %25 %23 %23 %25
|
||||
%64 = OpUndef %28
|
||||
%68 = OpConstantNull %20
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
%63 = OpPhi %28 %64 %5 %35 %11
|
||||
%62 = OpPhi %6 %9 %5 %38 %11
|
||||
%18 = OpSLessThan %17 %62 %16
|
||||
OpLoopMerge %12 %11 None
|
||||
OpBranchConditional %18 %11 %12
|
||||
%11 = OpLabel
|
||||
%27 = OpConvertSToF %19 %62
|
||||
%29 = OpCompositeConstruct %28 %25 %27
|
||||
%35 = OpVectorShuffle %28 %29 %68 0 1
|
||||
%38 = OpIAdd %6 %62 %37
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
%43 = OpCompositeExtract %19 %63 0
|
||||
%44 = OpFOrdNotEqual %17 %43 %25
|
||||
%45 = OpLogicalNot %17 %44
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %45 %46 %47
|
||||
%46 = OpLabel
|
||||
%50 = OpCompositeExtract %19 %63 1
|
||||
%52 = OpFOrdNotEqual %17 %50 %51
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%53 = OpPhi %17 %44 %12 %52 %46
|
||||
OpSelectionMerge %55 None
|
||||
OpBranchConditional %53 %54 %58
|
||||
%54 = OpLabel
|
||||
OpStore %57 %24
|
||||
OpBranch %55
|
||||
%58 = OpLabel
|
||||
OpStore %57 %59
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,109 @@
|
||||
#!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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant folding code path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float f = atan(1.0, tanh(1.0));
|
||||
#
|
||||
# if (f > 0.91 && f < 0.93)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 29
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %24
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "f"
|
||||
OpName %24 "_GLF_color"
|
||||
OpDecorate %24 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 1
|
||||
%13 = OpConstant %6 0.910000026
|
||||
%14 = OpTypeBool
|
||||
%17 = OpConstant %6 0.930000007
|
||||
%22 = OpTypeVector %6 4
|
||||
%23 = OpTypePointer Output %22
|
||||
%24 = OpVariable %23 Output
|
||||
%25 = OpConstant %6 0
|
||||
%26 = OpConstantComposite %22 %9 %25 %25 %9
|
||||
%28 = OpConstantComposite %22 %25 %25 %25 %25
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpExtInst %6 %1 Tanh %9
|
||||
%11 = OpExtInst %6 %1 Atan2 %9 %10
|
||||
OpStore %8 %11
|
||||
%12 = OpLoad %6 %8
|
||||
%15 = OpFOrdGreaterThan %14 %12 %13
|
||||
%16 = OpLoad %6 %8
|
||||
%18 = OpFOrdLessThan %14 %16 %17
|
||||
%19 = OpLogicalAnd %14 %15 %18
|
||||
OpSelectionMerge %21 None
|
||||
OpBranchConditional %19 %20 %27
|
||||
%20 = OpLabel
|
||||
OpStore %24 %26
|
||||
OpBranch %21
|
||||
%27 = OpLabel
|
||||
OpStore %24 %28
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,265 @@
|
||||
#!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 a specific constants and add/sub combining path
|
||||
|
||||
# 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 310 es
|
||||
# #define _int_7 _GLF_uniform_int_values[0]
|
||||
# #define _int_1 _GLF_uniform_int_values[1]
|
||||
# #define _int_0 _GLF_uniform_int_values[2]
|
||||
# #define _int_5 _GLF_uniform_int_values[3]
|
||||
# #define _int_10 _GLF_uniform_int_values[4]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [7, 1, 0, 5, 10]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[5];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# int func(float f)
|
||||
# {
|
||||
# int a = _int_1;
|
||||
# int b = _int_0;
|
||||
# for (int i = _int_0; i < _int_10; i++)
|
||||
# {
|
||||
# if (a > _int_5)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
#
|
||||
# // Simplifies to a = i.
|
||||
# a = int(f) -_int_1 / 2 + i;
|
||||
#
|
||||
# b++;
|
||||
# }
|
||||
# if (b == _int_7)
|
||||
# {
|
||||
# return _int_1;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# return _int_0;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# if (func(-9.3 + 10.0) == _int_1)
|
||||
# {
|
||||
# _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; 8
|
||||
; Bound: 107
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %88
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "func(f1;"
|
||||
OpName %10 "f"
|
||||
OpName %14 "a"
|
||||
OpName %18 "buf0"
|
||||
OpMemberName %18 0 "_GLF_uniform_int_values"
|
||||
OpName %20 ""
|
||||
OpName %26 "b"
|
||||
OpName %30 "i"
|
||||
OpName %79 "param"
|
||||
OpName %88 "_GLF_color"
|
||||
OpDecorate %17 ArrayStride 16
|
||||
OpMemberDecorate %18 0 Offset 0
|
||||
OpDecorate %18 Block
|
||||
OpDecorate %20 DescriptorSet 0
|
||||
OpDecorate %20 Binding 0
|
||||
OpDecorate %88 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypePointer Function %6
|
||||
%8 = OpTypeInt 32 1
|
||||
%9 = OpTypeFunction %8 %7
|
||||
%13 = OpTypePointer Function %8
|
||||
%15 = OpTypeInt 32 0
|
||||
%16 = OpConstant %15 5
|
||||
%17 = OpTypeArray %8 %16
|
||||
%18 = OpTypeStruct %17
|
||||
%19 = OpTypePointer Uniform %18
|
||||
%20 = OpVariable %19 Uniform
|
||||
%21 = OpConstant %8 0
|
||||
%22 = OpConstant %8 1
|
||||
%23 = OpTypePointer Uniform %8
|
||||
%27 = OpConstant %8 2
|
||||
%39 = OpConstant %8 4
|
||||
%42 = OpTypeBool
|
||||
%45 = OpConstant %8 3
|
||||
%78 = OpConstant %6 0.699999988
|
||||
%86 = OpTypeVector %6 4
|
||||
%87 = OpTypePointer Output %86
|
||||
%88 = OpVariable %87 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%79 = OpVariable %7 Function
|
||||
OpStore %79 %78
|
||||
%80 = OpFunctionCall %8 %11 %79
|
||||
%81 = OpAccessChain %23 %20 %21 %22
|
||||
%82 = OpLoad %8 %81
|
||||
%83 = OpIEqual %42 %80 %82
|
||||
OpSelectionMerge %85 None
|
||||
OpBranchConditional %83 %84 %102
|
||||
%84 = OpLabel
|
||||
%89 = OpAccessChain %23 %20 %21 %22
|
||||
%90 = OpLoad %8 %89
|
||||
%91 = OpConvertSToF %6 %90
|
||||
%92 = OpAccessChain %23 %20 %21 %27
|
||||
%93 = OpLoad %8 %92
|
||||
%94 = OpConvertSToF %6 %93
|
||||
%95 = OpAccessChain %23 %20 %21 %27
|
||||
%96 = OpLoad %8 %95
|
||||
%97 = OpConvertSToF %6 %96
|
||||
%98 = OpAccessChain %23 %20 %21 %22
|
||||
%99 = OpLoad %8 %98
|
||||
%100 = OpConvertSToF %6 %99
|
||||
%101 = OpCompositeConstruct %86 %91 %94 %97 %100
|
||||
OpStore %88 %101
|
||||
OpBranch %85
|
||||
%102 = OpLabel
|
||||
%103 = OpAccessChain %23 %20 %21 %27
|
||||
%104 = OpLoad %8 %103
|
||||
%105 = OpConvertSToF %6 %104
|
||||
%106 = OpCompositeConstruct %86 %105 %105 %105 %105
|
||||
OpStore %88 %106
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %8 None %9
|
||||
%10 = OpFunctionParameter %7
|
||||
%12 = OpLabel
|
||||
%14 = OpVariable %13 Function
|
||||
%26 = OpVariable %13 Function
|
||||
%30 = OpVariable %13 Function
|
||||
%24 = OpAccessChain %23 %20 %21 %22
|
||||
%25 = OpLoad %8 %24
|
||||
OpStore %14 %25
|
||||
%28 = OpAccessChain %23 %20 %21 %27
|
||||
%29 = OpLoad %8 %28
|
||||
OpStore %26 %29
|
||||
%31 = OpAccessChain %23 %20 %21 %27
|
||||
%32 = OpLoad %8 %31
|
||||
OpStore %30 %32
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%38 = OpLoad %8 %30
|
||||
%40 = OpAccessChain %23 %20 %21 %39
|
||||
%41 = OpLoad %8 %40
|
||||
%43 = OpSLessThan %42 %38 %41
|
||||
OpBranchConditional %43 %34 %35
|
||||
%34 = OpLabel
|
||||
%44 = OpLoad %8 %14
|
||||
%46 = OpAccessChain %23 %20 %21 %45
|
||||
%47 = OpLoad %8 %46
|
||||
%48 = OpSGreaterThan %42 %44 %47
|
||||
OpSelectionMerge %50 None
|
||||
OpBranchConditional %48 %49 %50
|
||||
%49 = OpLabel
|
||||
OpBranch %35
|
||||
%50 = OpLabel
|
||||
%52 = OpLoad %6 %10
|
||||
%53 = OpConvertFToS %8 %52
|
||||
%54 = OpAccessChain %23 %20 %21 %22
|
||||
%55 = OpLoad %8 %54
|
||||
%56 = OpSDiv %8 %55 %27
|
||||
%57 = OpISub %8 %53 %56
|
||||
%58 = OpLoad %8 %30
|
||||
%59 = OpIAdd %8 %57 %58
|
||||
OpStore %14 %59
|
||||
%60 = OpLoad %8 %26
|
||||
%61 = OpIAdd %8 %60 %22
|
||||
OpStore %26 %61
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%62 = OpLoad %8 %30
|
||||
%63 = OpIAdd %8 %62 %22
|
||||
OpStore %30 %63
|
||||
OpBranch %33
|
||||
%35 = OpLabel
|
||||
%64 = OpLoad %8 %26
|
||||
%65 = OpAccessChain %23 %20 %21 %21
|
||||
%66 = OpLoad %8 %65
|
||||
%67 = OpIEqual %42 %64 %66
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %67 %68 %73
|
||||
%68 = OpLabel
|
||||
%70 = OpAccessChain %23 %20 %21 %22
|
||||
%71 = OpLoad %8 %70
|
||||
OpReturnValue %71
|
||||
%73 = OpLabel
|
||||
%74 = OpAccessChain %23 %20 %21 %27
|
||||
%75 = OpLoad %8 %74
|
||||
OpReturnValue %75
|
||||
%69 = OpLabel
|
||||
OpUnreachable
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
7 1 0 5 10
|
||||
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
|
||||
@@ -0,0 +1,142 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific constant handling path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# vec2 one;
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Mixing (1, 1) and (1, 1) is still (1, 1).
|
||||
# vec2 mixed = mix(vec2(1), one, 0.5);
|
||||
#
|
||||
# // If condition is always true.
|
||||
# if (mixed == vec2(1))
|
||||
# _GLF_color = vec4(mixed.x, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 42
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %32
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %9 "mixed"
|
||||
OpName %12 "buf0"
|
||||
OpMemberName %12 0 "one"
|
||||
OpName %14 ""
|
||||
OpName %32 "_GLF_color"
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %32 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 2
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpConstant %6 1
|
||||
%11 = OpConstantComposite %7 %10 %10
|
||||
%12 = OpTypeStruct %7
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpTypeInt 32 1
|
||||
%16 = OpConstant %15 0
|
||||
%17 = OpTypePointer Uniform %7
|
||||
%20 = OpConstant %6 0.5
|
||||
%24 = OpTypeBool
|
||||
%25 = OpTypeVector %24 2
|
||||
%30 = OpTypeVector %6 4
|
||||
%31 = OpTypePointer Output %30
|
||||
%32 = OpVariable %31 Output
|
||||
%33 = OpTypeInt 32 0
|
||||
%34 = OpConstant %33 0
|
||||
%35 = OpTypePointer Function %6
|
||||
%38 = OpConstant %6 0
|
||||
%41 = OpConstantComposite %30 %38 %38 %38 %38
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%18 = OpAccessChain %17 %14 %16
|
||||
%19 = OpLoad %7 %18
|
||||
%21 = OpCompositeConstruct %7 %20 %20
|
||||
%22 = OpExtInst %7 %1 FMix %11 %19 %21
|
||||
OpStore %9 %22
|
||||
%23 = OpLoad %7 %9
|
||||
%26 = OpFOrdEqual %25 %23 %11
|
||||
%27 = OpAll %24 %26
|
||||
OpSelectionMerge %29 None
|
||||
OpBranchConditional %27 %28 %40
|
||||
%28 = OpLabel
|
||||
%36 = OpAccessChain %35 %9 %34
|
||||
%37 = OpLoad %6 %36
|
||||
%39 = OpCompositeConstruct %30 %37 %38 %38 %10
|
||||
OpStore %32 %39
|
||||
OpBranch %29
|
||||
%40 = OpLabel
|
||||
OpStore %32 %41
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# one
|
||||
BUFFER variant_one DATA_TYPE vec2<float> DATA
|
||||
1.0 1.0
|
||||
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_one 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
|
||||
@@ -0,0 +1,226 @@
|
||||
#!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.
|
||||
|
||||
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 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_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]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // 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 zero: 0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int zero;
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
#
|
||||
# do
|
||||
# {
|
||||
# // Always false.
|
||||
# if(zero == _int_1)
|
||||
# {
|
||||
# continue;
|
||||
# }
|
||||
#
|
||||
# // Always false.
|
||||
# if(zero == _int_2)
|
||||
# {
|
||||
# break;
|
||||
# }
|
||||
#
|
||||
# // Always false.
|
||||
# if(zero == _int_3)
|
||||
# {
|
||||
# discard;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# while(false);
|
||||
#
|
||||
# // This should never be hit.
|
||||
# _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: 73
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "_GLF_color"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "_GLF_uniform_int_values"
|
||||
OpName %16 ""
|
||||
OpName %37 "buf1"
|
||||
OpMemberName %37 0 "zero"
|
||||
OpName %39 ""
|
||||
OpDecorate %9 Location 0
|
||||
OpDecorate %13 ArrayStride 16
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpMemberDecorate %37 0 Offset 0
|
||||
OpDecorate %37 Block
|
||||
OpDecorate %39 DescriptorSet 0
|
||||
OpDecorate %39 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Output %7
|
||||
%9 = OpVariable %8 Output
|
||||
%10 = OpTypeInt 32 1
|
||||
%11 = OpTypeInt 32 0
|
||||
%12 = OpConstant %11 4
|
||||
%13 = OpTypeArray %10 %12
|
||||
%14 = OpTypeStruct %13
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpConstant %10 0
|
||||
%18 = OpTypePointer Uniform %10
|
||||
%22 = OpConstant %10 1
|
||||
%37 = OpTypeStruct %10
|
||||
%38 = OpTypePointer Uniform %37
|
||||
%39 = OpVariable %38 Uniform
|
||||
%44 = OpTypeBool
|
||||
%51 = OpConstant %10 2
|
||||
%60 = OpConstant %10 3
|
||||
%68 = OpConstantFalse %44
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%19 = OpAccessChain %18 %16 %17 %17
|
||||
%20 = OpLoad %10 %19
|
||||
%21 = OpConvertSToF %6 %20
|
||||
%23 = OpAccessChain %18 %16 %17 %22
|
||||
%24 = OpLoad %10 %23
|
||||
%25 = OpConvertSToF %6 %24
|
||||
%26 = OpAccessChain %18 %16 %17 %22
|
||||
%27 = OpLoad %10 %26
|
||||
%28 = OpConvertSToF %6 %27
|
||||
%29 = OpAccessChain %18 %16 %17 %17
|
||||
%30 = OpLoad %10 %29
|
||||
%31 = OpConvertSToF %6 %30
|
||||
%32 = OpCompositeConstruct %7 %21 %25 %28 %31
|
||||
OpStore %9 %32
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%40 = OpAccessChain %18 %39 %17
|
||||
%41 = OpLoad %10 %40
|
||||
%42 = OpAccessChain %18 %16 %17 %17
|
||||
%43 = OpLoad %10 %42
|
||||
%45 = OpIEqual %44 %41 %43
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %45 %46 %47
|
||||
%46 = OpLabel
|
||||
OpBranch %36
|
||||
%47 = OpLabel
|
||||
%49 = OpAccessChain %18 %39 %17
|
||||
%50 = OpLoad %10 %49
|
||||
%52 = OpAccessChain %18 %16 %17 %51
|
||||
%53 = OpLoad %10 %52
|
||||
%54 = OpIEqual %44 %50 %53
|
||||
OpSelectionMerge %56 None
|
||||
OpBranchConditional %54 %55 %56
|
||||
%55 = OpLabel
|
||||
OpBranch %35
|
||||
%56 = OpLabel
|
||||
%58 = OpAccessChain %18 %39 %17
|
||||
%59 = OpLoad %10 %58
|
||||
%61 = OpAccessChain %18 %16 %17 %60
|
||||
%62 = OpLoad %10 %61
|
||||
%63 = OpIEqual %44 %59 %62
|
||||
OpSelectionMerge %65 None
|
||||
OpBranchConditional %63 %64 %65
|
||||
%64 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%65 = OpLabel
|
||||
OpReturn
|
||||
%36 = OpLabel
|
||||
OpBranchConditional %68 %33 %35
|
||||
%35 = OpLabel
|
||||
%69 = OpAccessChain %18 %16 %17 %22
|
||||
%70 = OpLoad %10 %69
|
||||
%71 = OpConvertSToF %6 %70
|
||||
%72 = OpCompositeConstruct %7 %71 %71 %71 %71
|
||||
OpStore %9 %72
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE int32 STD140 DATA
|
||||
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_zero 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
|
||||
+361
@@ -0,0 +1,361 @@
|
||||
#!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.
|
||||
|
||||
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_10 _GLF_uniform_int_values[2]
|
||||
# #define _int_2 _GLF_uniform_int_values[3]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0, 10, 2]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[4];
|
||||
# };
|
||||
#
|
||||
# const int _GLF_global_loop_bound = 15;
|
||||
# int _GLF_global_loop_count = 0;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# int arr0[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0), arr1[10] = int[10](1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // Sets arr[1..9] to zero.
|
||||
# for(int j = _int_1; j < _int_10; j++)
|
||||
# {
|
||||
# _GLF_global_loop_count++;
|
||||
# arr1[j] = arr0[j];
|
||||
# }
|
||||
#
|
||||
# // Iterates once.
|
||||
# for(int i0 = _int_1; _GLF_global_loop_count < _GLF_global_loop_bound; i0 *= _int_2)
|
||||
# {
|
||||
# _GLF_global_loop_count++;
|
||||
# // Iterates four times.
|
||||
# for(int i1 = 1; i1 < 10 && _GLF_global_loop_count < _GLF_global_loop_bound; i1 += i0)
|
||||
# {
|
||||
# _GLF_global_loop_count ++;
|
||||
# // Iterates once.
|
||||
# for(int i2 = i1; i2 <= 1 && _GLF_global_loop_count < _GLF_global_loop_bound; i2++)
|
||||
# {
|
||||
# _GLF_global_loop_count++;
|
||||
# // i2 can only be one, and both arr0[1] and arr1[1] are already zero.
|
||||
# arr0[i2] = arr1[i2];
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# // Always true.
|
||||
# if(arr0[_int_0] == _int_0 && arr1[_int_0] == _int_1 && arr0[_int_1] == _int_0 && arr1[_int_1] == _int_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: 166
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %147
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "_GLF_global_loop_count"
|
||||
OpName %14 "arr0"
|
||||
OpName %16 "arr1"
|
||||
OpName %20 "j"
|
||||
OpName %23 "buf0"
|
||||
OpMemberName %23 0 "_GLF_uniform_int_values"
|
||||
OpName %25 ""
|
||||
OpName %49 "i0"
|
||||
OpName %62 "i1"
|
||||
OpName %76 "i2"
|
||||
OpName %147 "_GLF_color"
|
||||
OpDecorate %22 ArrayStride 16
|
||||
OpMemberDecorate %23 0 Offset 0
|
||||
OpDecorate %23 Block
|
||||
OpDecorate %25 DescriptorSet 0
|
||||
OpDecorate %25 Binding 0
|
||||
OpDecorate %147 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Private %6
|
||||
%8 = OpVariable %7 Private
|
||||
%9 = OpConstant %6 0
|
||||
%10 = OpTypeInt 32 0
|
||||
%11 = OpConstant %10 10
|
||||
%12 = OpTypeArray %6 %11
|
||||
%13 = OpTypePointer Private %12
|
||||
%14 = OpVariable %13 Private
|
||||
%15 = OpConstantComposite %12 %9 %9 %9 %9 %9 %9 %9 %9 %9 %9
|
||||
%16 = OpVariable %13 Private
|
||||
%17 = OpConstant %6 1
|
||||
%18 = OpConstantComposite %12 %17 %17 %17 %17 %17 %17 %17 %17 %17 %17
|
||||
%19 = OpTypePointer Function %6
|
||||
%21 = OpConstant %10 4
|
||||
%22 = OpTypeArray %6 %21
|
||||
%23 = OpTypeStruct %22
|
||||
%24 = OpTypePointer Uniform %23
|
||||
%25 = OpVariable %24 Uniform
|
||||
%26 = OpTypePointer Uniform %6
|
||||
%35 = OpConstant %6 2
|
||||
%38 = OpTypeBool
|
||||
%58 = OpConstant %6 15
|
||||
%69 = OpConstant %6 10
|
||||
%100 = OpConstant %6 3
|
||||
%144 = OpTypeFloat 32
|
||||
%145 = OpTypeVector %144 4
|
||||
%146 = OpTypePointer Output %145
|
||||
%147 = OpVariable %146 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%20 = OpVariable %19 Function
|
||||
%49 = OpVariable %19 Function
|
||||
%62 = OpVariable %19 Function
|
||||
%76 = OpVariable %19 Function
|
||||
OpStore %8 %9
|
||||
OpStore %14 %15
|
||||
OpStore %16 %18
|
||||
%27 = OpAccessChain %26 %25 %9 %9
|
||||
%28 = OpLoad %6 %27
|
||||
OpStore %20 %28
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpLoad %6 %20
|
||||
%36 = OpAccessChain %26 %25 %9 %35
|
||||
%37 = OpLoad %6 %36
|
||||
%39 = OpSLessThan %38 %34 %37
|
||||
OpBranchConditional %39 %30 %31
|
||||
%30 = OpLabel
|
||||
%40 = OpLoad %6 %8
|
||||
%41 = OpIAdd %6 %40 %17
|
||||
OpStore %8 %41
|
||||
%42 = OpLoad %6 %20
|
||||
%43 = OpLoad %6 %20
|
||||
%44 = OpAccessChain %7 %14 %43
|
||||
%45 = OpLoad %6 %44
|
||||
%46 = OpAccessChain %7 %16 %42
|
||||
OpStore %46 %45
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%47 = OpLoad %6 %20
|
||||
%48 = OpIAdd %6 %47 %17
|
||||
OpStore %20 %48
|
||||
OpBranch %29
|
||||
%31 = OpLabel
|
||||
%50 = OpAccessChain %26 %25 %9 %9
|
||||
%51 = OpLoad %6 %50
|
||||
OpStore %49 %51
|
||||
OpBranch %52
|
||||
%52 = OpLabel
|
||||
OpLoopMerge %54 %55 None
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
%57 = OpLoad %6 %8
|
||||
%59 = OpSLessThan %38 %57 %58
|
||||
OpBranchConditional %59 %53 %54
|
||||
%53 = OpLabel
|
||||
%60 = OpLoad %6 %8
|
||||
%61 = OpIAdd %6 %60 %17
|
||||
OpStore %8 %61
|
||||
OpStore %62 %17
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
OpLoopMerge %65 %66 None
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
%68 = OpLoad %6 %62
|
||||
%70 = OpSLessThan %38 %68 %69
|
||||
%71 = OpLoad %6 %8
|
||||
%72 = OpSLessThan %38 %71 %58
|
||||
%73 = OpLogicalAnd %38 %70 %72
|
||||
OpBranchConditional %73 %64 %65
|
||||
%64 = OpLabel
|
||||
%74 = OpLoad %6 %8
|
||||
%75 = OpIAdd %6 %74 %17
|
||||
OpStore %8 %75
|
||||
%77 = OpLoad %6 %62
|
||||
OpStore %76 %77
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
OpLoopMerge %80 %81 None
|
||||
OpBranch %82
|
||||
%82 = OpLabel
|
||||
%83 = OpLoad %6 %76
|
||||
%84 = OpSLessThanEqual %38 %83 %17
|
||||
%85 = OpLoad %6 %8
|
||||
%86 = OpSLessThan %38 %85 %58
|
||||
%87 = OpLogicalAnd %38 %84 %86
|
||||
OpBranchConditional %87 %79 %80
|
||||
%79 = OpLabel
|
||||
%88 = OpLoad %6 %8
|
||||
%89 = OpIAdd %6 %88 %17
|
||||
OpStore %8 %89
|
||||
%90 = OpLoad %6 %76
|
||||
%91 = OpLoad %6 %76
|
||||
%92 = OpAccessChain %7 %16 %91
|
||||
%93 = OpLoad %6 %92
|
||||
%94 = OpAccessChain %7 %14 %90
|
||||
OpStore %94 %93
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
%95 = OpLoad %6 %76
|
||||
%96 = OpIAdd %6 %95 %17
|
||||
OpStore %76 %96
|
||||
OpBranch %78
|
||||
%80 = OpLabel
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
%97 = OpLoad %6 %49
|
||||
%98 = OpLoad %6 %62
|
||||
%99 = OpIAdd %6 %98 %97
|
||||
OpStore %62 %99
|
||||
OpBranch %63
|
||||
%65 = OpLabel
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
%101 = OpAccessChain %26 %25 %9 %100
|
||||
%102 = OpLoad %6 %101
|
||||
%103 = OpLoad %6 %49
|
||||
%104 = OpIMul %6 %103 %102
|
||||
OpStore %49 %104
|
||||
OpBranch %52
|
||||
%54 = OpLabel
|
||||
%105 = OpAccessChain %26 %25 %9 %17
|
||||
%106 = OpLoad %6 %105
|
||||
%107 = OpAccessChain %7 %14 %106
|
||||
%108 = OpLoad %6 %107
|
||||
%109 = OpAccessChain %26 %25 %9 %17
|
||||
%110 = OpLoad %6 %109
|
||||
%111 = OpIEqual %38 %108 %110
|
||||
OpSelectionMerge %113 None
|
||||
OpBranchConditional %111 %112 %113
|
||||
%112 = OpLabel
|
||||
%114 = OpAccessChain %26 %25 %9 %17
|
||||
%115 = OpLoad %6 %114
|
||||
%116 = OpAccessChain %7 %16 %115
|
||||
%117 = OpLoad %6 %116
|
||||
%118 = OpAccessChain %26 %25 %9 %9
|
||||
%119 = OpLoad %6 %118
|
||||
%120 = OpIEqual %38 %117 %119
|
||||
OpBranch %113
|
||||
%113 = OpLabel
|
||||
%121 = OpPhi %38 %111 %54 %120 %112
|
||||
OpSelectionMerge %123 None
|
||||
OpBranchConditional %121 %122 %123
|
||||
%122 = OpLabel
|
||||
%124 = OpAccessChain %26 %25 %9 %9
|
||||
%125 = OpLoad %6 %124
|
||||
%126 = OpAccessChain %7 %14 %125
|
||||
%127 = OpLoad %6 %126
|
||||
%128 = OpAccessChain %26 %25 %9 %17
|
||||
%129 = OpLoad %6 %128
|
||||
%130 = OpIEqual %38 %127 %129
|
||||
OpBranch %123
|
||||
%123 = OpLabel
|
||||
%131 = OpPhi %38 %121 %113 %130 %122
|
||||
OpSelectionMerge %133 None
|
||||
OpBranchConditional %131 %132 %133
|
||||
%132 = OpLabel
|
||||
%134 = OpAccessChain %26 %25 %9 %9
|
||||
%135 = OpLoad %6 %134
|
||||
%136 = OpAccessChain %7 %16 %135
|
||||
%137 = OpLoad %6 %136
|
||||
%138 = OpAccessChain %26 %25 %9 %17
|
||||
%139 = OpLoad %6 %138
|
||||
%140 = OpIEqual %38 %137 %139
|
||||
OpBranch %133
|
||||
%133 = OpLabel
|
||||
%141 = OpPhi %38 %131 %123 %140 %132
|
||||
OpSelectionMerge %143 None
|
||||
OpBranchConditional %141 %142 %161
|
||||
%142 = OpLabel
|
||||
%148 = OpAccessChain %26 %25 %9 %9
|
||||
%149 = OpLoad %6 %148
|
||||
%150 = OpConvertSToF %144 %149
|
||||
%151 = OpAccessChain %26 %25 %9 %17
|
||||
%152 = OpLoad %6 %151
|
||||
%153 = OpConvertSToF %144 %152
|
||||
%154 = OpAccessChain %26 %25 %9 %17
|
||||
%155 = OpLoad %6 %154
|
||||
%156 = OpConvertSToF %144 %155
|
||||
%157 = OpAccessChain %26 %25 %9 %9
|
||||
%158 = OpLoad %6 %157
|
||||
%159 = OpConvertSToF %144 %158
|
||||
%160 = OpCompositeConstruct %145 %150 %153 %156 %159
|
||||
OpStore %147 %160
|
||||
OpBranch %143
|
||||
%161 = OpLabel
|
||||
%162 = OpAccessChain %26 %25 %9 %17
|
||||
%163 = OpLoad %6 %162
|
||||
%164 = OpConvertSToF %144 %163
|
||||
%165 = OpCompositeConstruct %145 %164 %164 %164 %164
|
||||
OpStore %147 %165
|
||||
OpBranch %143
|
||||
%143 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0 10 2
|
||||
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__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
|
||||
@@ -0,0 +1,153 @@
|
||||
#!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]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: 1
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int _GLF_uniform_int_values[1];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int i = _int_1;
|
||||
# _GLF_color = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
#
|
||||
# vec4 v = _GLF_color;
|
||||
# v[i - _int_1] = v[i];
|
||||
# v[i] = v[i + _int_1];
|
||||
# _GLF_color = v;
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 47
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %22
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "i"
|
||||
OpName %12 "buf0"
|
||||
OpMemberName %12 0 "_GLF_uniform_int_values"
|
||||
OpName %14 ""
|
||||
OpName %22 "_GLF_color"
|
||||
OpName %27 "v"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %22 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 1
|
||||
%11 = OpTypeArray %6 %10
|
||||
%12 = OpTypeStruct %11
|
||||
%13 = OpTypePointer Uniform %12
|
||||
%14 = OpVariable %13 Uniform
|
||||
%15 = OpConstant %6 0
|
||||
%16 = OpTypePointer Uniform %6
|
||||
%19 = OpTypeFloat 32
|
||||
%20 = OpTypeVector %19 4
|
||||
%21 = OpTypePointer Output %20
|
||||
%22 = OpVariable %21 Output
|
||||
%23 = OpConstant %19 0
|
||||
%24 = OpConstant %19 1
|
||||
%25 = OpConstantComposite %20 %23 %24 %23 %24
|
||||
%26 = OpTypePointer Function %20
|
||||
%34 = OpTypePointer Function %19
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%27 = OpVariable %26 Function
|
||||
%17 = OpAccessChain %16 %14 %15 %15
|
||||
%18 = OpLoad %6 %17
|
||||
OpStore %8 %18
|
||||
OpStore %22 %25
|
||||
%28 = OpLoad %20 %22
|
||||
OpStore %27 %28
|
||||
%29 = OpLoad %6 %8
|
||||
%30 = OpAccessChain %16 %14 %15 %15
|
||||
%31 = OpLoad %6 %30
|
||||
%32 = OpISub %6 %29 %31
|
||||
%33 = OpLoad %6 %8
|
||||
%35 = OpAccessChain %34 %27 %33
|
||||
%36 = OpLoad %19 %35
|
||||
%37 = OpAccessChain %34 %27 %32
|
||||
OpStore %37 %36
|
||||
%38 = OpLoad %6 %8
|
||||
%39 = OpLoad %6 %8
|
||||
%40 = OpAccessChain %16 %14 %15 %15
|
||||
%41 = OpLoad %6 %40
|
||||
%42 = OpIAdd %6 %39 %41
|
||||
%43 = OpAccessChain %34 %27 %42
|
||||
%44 = OpLoad %19 %43
|
||||
%45 = OpAccessChain %34 %27 %38
|
||||
OpStore %45 %44
|
||||
%46 = OpLoad %20 %27
|
||||
OpStore %22 %46
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1
|
||||
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
|
||||
@@ -0,0 +1,158 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific propagate array copy path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int zero;
|
||||
# };
|
||||
#
|
||||
# struct Array {
|
||||
# int values[2];
|
||||
# };
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# Array a;
|
||||
# a.values[zero] = 1;
|
||||
# Array b = a;
|
||||
# float one = 0.0;
|
||||
# // If condition is always true
|
||||
# if(b.values[zero] == 1)
|
||||
# one = 1.0;
|
||||
# _GLF_color = vec4(one, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 43
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %40
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "Array"
|
||||
OpMemberName %10 0 "values"
|
||||
OpName %12 "a"
|
||||
OpName %14 "buf0"
|
||||
OpMemberName %14 0 "zero"
|
||||
OpName %16 ""
|
||||
OpName %23 "b"
|
||||
OpName %27 "one"
|
||||
OpName %40 "_GLF_color"
|
||||
OpMemberDecorate %10 0 RelaxedPrecision
|
||||
OpMemberDecorate %14 0 RelaxedPrecision
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpDecorate %14 Block
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 0
|
||||
OpDecorate %19 RelaxedPrecision
|
||||
OpDecorate %30 RelaxedPrecision
|
||||
OpDecorate %32 RelaxedPrecision
|
||||
OpDecorate %40 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 2
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypeStruct %9
|
||||
%11 = OpTypePointer Function %10
|
||||
%13 = OpConstant %6 0
|
||||
%14 = OpTypeStruct %6
|
||||
%15 = OpTypePointer Uniform %14
|
||||
%16 = OpVariable %15 Uniform
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%20 = OpConstant %6 1
|
||||
%21 = OpTypePointer Function %6
|
||||
%25 = OpTypeFloat 32
|
||||
%26 = OpTypePointer Function %25
|
||||
%28 = OpConstant %25 0
|
||||
%33 = OpTypeBool
|
||||
%37 = OpConstant %25 1
|
||||
%38 = OpTypeVector %25 4
|
||||
%39 = OpTypePointer Output %38
|
||||
%40 = OpVariable %39 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpVariable %11 Function
|
||||
%23 = OpVariable %11 Function
|
||||
%27 = OpVariable %26 Function
|
||||
%18 = OpAccessChain %17 %16 %13
|
||||
%19 = OpLoad %6 %18
|
||||
%22 = OpAccessChain %21 %12 %13 %19
|
||||
OpStore %22 %20
|
||||
%24 = OpLoad %10 %12
|
||||
OpStore %23 %24
|
||||
OpStore %27 %28
|
||||
%29 = OpAccessChain %17 %16 %13
|
||||
%30 = OpLoad %6 %29
|
||||
%31 = OpAccessChain %21 %23 %13 %30
|
||||
%32 = OpLoad %6 %31
|
||||
%34 = OpIEqual %33 %32 %20
|
||||
OpSelectionMerge %36 None
|
||||
OpBranchConditional %34 %35 %36
|
||||
%35 = OpLabel
|
||||
OpStore %27 %37
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%41 = OpLoad %25 %27
|
||||
%42 = OpCompositeConstruct %38 %41 %28 %28 %37
|
||||
OpStore %40 %42
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE int32 DATA
|
||||
0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,299 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2019 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 GraphicsFuzz.
|
||||
|
||||
# Short description: A fragment shader that covers a specific propagate array copy path.
|
||||
|
||||
# The test passes because shader always writes red.
|
||||
|
||||
# Optimized using spirv-opt with the following arguments:
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--reduce-load-size'
|
||||
# '--if-conversion'
|
||||
# '--private-to-local'
|
||||
# '--if-conversion'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--eliminate-local-multi-store'
|
||||
# '--scalar-replacement=100'
|
||||
# '--vector-dce'
|
||||
# '--inline-entry-points-exhaustive'
|
||||
# '--eliminate-local-single-store'
|
||||
# '--convert-local-access-chains'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-return'
|
||||
# '--reduce-load-size'
|
||||
# '--eliminate-dead-branches'
|
||||
# '--merge-blocks'
|
||||
# '--redundancy-elimination'
|
||||
# '--eliminate-dead-branches'
|
||||
# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87
|
||||
|
||||
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# int zero;
|
||||
# };
|
||||
#
|
||||
# struct Array
|
||||
# {
|
||||
# int values[2];
|
||||
# };
|
||||
#
|
||||
# // Function always returns 1
|
||||
# int func(Array a)
|
||||
# {
|
||||
# while(true)
|
||||
# {
|
||||
# if(a.values[zero] == 0)
|
||||
# return 42;
|
||||
#
|
||||
# break;
|
||||
# }
|
||||
# return 42;
|
||||
# }
|
||||
# void main()
|
||||
# {
|
||||
# Array a;
|
||||
# a.values[0] = zero;
|
||||
# // If condition is always true
|
||||
# if (func(a) == 42)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# else
|
||||
# _GLF_color = vec4(0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 112
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %54
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %10 "Array"
|
||||
OpMemberName %10 0 "values"
|
||||
OpName %14 "func(struct-Array-i1[2]1;"
|
||||
OpName %13 "a"
|
||||
OpName %24 "buf0"
|
||||
OpMemberName %24 0 "zero"
|
||||
OpName %26 ""
|
||||
OpName %45 "param"
|
||||
OpName %54 "_GLF_color"
|
||||
OpMemberDecorate %10 0 RelaxedPrecision
|
||||
OpDecorate %14 RelaxedPrecision
|
||||
OpMemberDecorate %24 0 RelaxedPrecision
|
||||
OpMemberDecorate %24 0 Offset 0
|
||||
OpDecorate %24 Block
|
||||
OpDecorate %26 DescriptorSet 0
|
||||
OpDecorate %26 Binding 0
|
||||
OpDecorate %29 RelaxedPrecision
|
||||
OpDecorate %32 RelaxedPrecision
|
||||
OpDecorate %43 RelaxedPrecision
|
||||
OpDecorate %54 Location 0
|
||||
OpDecorate %61 RelaxedPrecision
|
||||
OpDecorate %75 RelaxedPrecision
|
||||
OpDecorate %74 RelaxedPrecision
|
||||
OpDecorate %81 RelaxedPrecision
|
||||
OpDecorate %86 RelaxedPrecision
|
||||
OpDecorate %87 RelaxedPrecision
|
||||
OpDecorate %102 RelaxedPrecision
|
||||
OpDecorate %106 RelaxedPrecision
|
||||
OpDecorate %109 RelaxedPrecision
|
||||
OpDecorate %110 RelaxedPrecision
|
||||
OpDecorate %111 RelaxedPrecision
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 2
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypeStruct %9
|
||||
%11 = OpTypePointer Function %10
|
||||
%12 = OpTypeFunction %6 %11
|
||||
%21 = OpTypeBool
|
||||
%22 = OpConstantTrue %21
|
||||
%23 = OpConstant %6 0
|
||||
%24 = OpTypeStruct %6
|
||||
%25 = OpTypePointer Uniform %24
|
||||
%26 = OpVariable %25 Uniform
|
||||
%27 = OpTypePointer Uniform %6
|
||||
%30 = OpTypePointer Function %6
|
||||
%36 = OpConstant %6 42
|
||||
%51 = OpTypeFloat 32
|
||||
%52 = OpTypeVector %51 4
|
||||
%53 = OpTypePointer Output %52
|
||||
%54 = OpVariable %53 Output
|
||||
%55 = OpConstant %51 1
|
||||
%56 = OpConstant %51 0
|
||||
%57 = OpConstantComposite %52 %55 %56 %56 %55
|
||||
%59 = OpConstantComposite %52 %56 %56 %56 %56
|
||||
%66 = OpConstantFalse %21
|
||||
%67 = OpTypePointer Function %21
|
||||
%78 = OpUndef %6
|
||||
%79 = OpUndef %21
|
||||
%80 = OpTypePointer Function %9
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%85 = OpVariable %67 Function %66
|
||||
%86 = OpVariable %30 Function
|
||||
%87 = OpVariable %30 Function
|
||||
%81 = OpVariable %80 Function
|
||||
%45 = OpVariable %11 Function
|
||||
%42 = OpAccessChain %27 %26 %23
|
||||
%43 = OpLoad %6 %42
|
||||
%110 = OpLoad %9 %81
|
||||
%111 = OpCompositeInsert %9 %43 %110 0
|
||||
OpStore %81 %111
|
||||
%83 = OpLoad %9 %81
|
||||
%84 = OpCompositeConstruct %10 %83
|
||||
OpStore %45 %84
|
||||
OpStore %85 %66
|
||||
OpBranch %88
|
||||
%88 = OpLabel
|
||||
OpLoopMerge %91 %89 None
|
||||
OpBranch %93
|
||||
%93 = OpLabel
|
||||
OpLoopMerge %96 %94 None
|
||||
OpBranch %98
|
||||
%98 = OpLabel
|
||||
%101 = OpAccessChain %30 %45 %23 %43
|
||||
%102 = OpLoad %6 %101
|
||||
%103 = OpIEqual %21 %102 %23
|
||||
OpSelectionMerge %104 None
|
||||
OpBranchConditional %103 %105 %104
|
||||
%105 = OpLabel
|
||||
OpStore %85 %22
|
||||
OpStore %86 %36
|
||||
OpBranch %96
|
||||
%104 = OpLabel
|
||||
OpBranch %96
|
||||
%94 = OpLabel
|
||||
OpBranch %93
|
||||
%96 = OpLabel
|
||||
%106 = OpPhi %6 %36 %105 %78 %104
|
||||
%107 = OpPhi %21 %22 %105 %66 %104
|
||||
OpSelectionMerge %108 None
|
||||
OpBranchConditional %107 %91 %108
|
||||
%108 = OpLabel
|
||||
OpStore %85 %22
|
||||
OpStore %86 %36
|
||||
OpBranch %91
|
||||
%89 = OpLabel
|
||||
OpBranch %88
|
||||
%91 = OpLabel
|
||||
%109 = OpPhi %6 %106 %96 %36 %108
|
||||
OpStore %87 %109
|
||||
%48 = OpIEqual %21 %109 %36
|
||||
OpSelectionMerge %50 None
|
||||
OpBranchConditional %48 %49 %58
|
||||
%58 = OpLabel
|
||||
OpStore %54 %59
|
||||
OpBranch %50
|
||||
%49 = OpLabel
|
||||
OpStore %54 %57
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%14 = OpFunction %6 None %12
|
||||
%13 = OpFunctionParameter %11
|
||||
%15 = OpLabel
|
||||
%68 = OpVariable %67 Function %66
|
||||
%61 = OpVariable %30 Function
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
%73 = OpPhi %21 %66 %15 %79 %65
|
||||
OpLoopMerge %60 %65 None
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
%72 = OpPhi %21 %73 %64 %79 %19
|
||||
OpLoopMerge %18 %19 None
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
OpBranch %17
|
||||
%17 = OpLabel
|
||||
%28 = OpAccessChain %27 %26 %23
|
||||
%29 = OpLoad %6 %28
|
||||
%31 = OpAccessChain %30 %13 %23 %29
|
||||
%32 = OpLoad %6 %31
|
||||
%33 = OpIEqual %21 %32 %23
|
||||
OpSelectionMerge %35 None
|
||||
OpBranchConditional %33 %34 %35
|
||||
%34 = OpLabel
|
||||
OpStore %68 %22
|
||||
OpStore %61 %36
|
||||
OpBranch %18
|
||||
%35 = OpLabel
|
||||
OpBranch %18
|
||||
%19 = OpLabel
|
||||
OpBranch %16
|
||||
%18 = OpLabel
|
||||
%75 = OpPhi %6 %36 %34 %78 %35
|
||||
%71 = OpPhi %21 %22 %34 %72 %35
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %71 %60 %69
|
||||
%69 = OpLabel
|
||||
OpStore %68 %22
|
||||
OpStore %61 %36
|
||||
OpBranch %60
|
||||
%65 = OpLabel
|
||||
OpBranch %63
|
||||
%60 = OpLabel
|
||||
%74 = OpPhi %6 %75 %18 %36 %69
|
||||
OpReturnValue %74
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# zero
|
||||
BUFFER variant_zero DATA_TYPE int32 DATA
|
||||
0
|
||||
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_zero 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
|
||||
@@ -0,0 +1,162 @@
|
||||
#!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 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 _float_1_0 _GLF_uniform_float_values[0]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: 1.0
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[1];
|
||||
# };
|
||||
# // Contents of _GLF_uniform_int_values: 0
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[1];
|
||||
# };
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# vec4 v = clamp(cosh(vec4(1.0)), _float_1_0, 1.0);
|
||||
# _GLF_color = vec4(v.x, _int_0, _int_0, v.z);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 48
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %28
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %9 "v"
|
||||
OpName %16 "buf0"
|
||||
OpMemberName %16 0 "_GLF_uniform_float_values"
|
||||
OpName %18 ""
|
||||
OpName %28 "_GLF_color"
|
||||
OpName %34 "buf1"
|
||||
OpMemberName %34 0 "_GLF_uniform_int_values"
|
||||
OpName %36 ""
|
||||
OpDecorate %15 ArrayStride 16
|
||||
OpMemberDecorate %16 0 Offset 0
|
||||
OpDecorate %16 Block
|
||||
OpDecorate %18 DescriptorSet 0
|
||||
OpDecorate %18 Binding 0
|
||||
OpDecorate %28 Location 0
|
||||
OpDecorate %33 ArrayStride 16
|
||||
OpMemberDecorate %34 0 Offset 0
|
||||
OpDecorate %34 Block
|
||||
OpDecorate %36 DescriptorSet 0
|
||||
OpDecorate %36 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Function %7
|
||||
%10 = OpConstant %6 1
|
||||
%11 = OpConstantComposite %7 %10 %10 %10 %10
|
||||
%13 = OpTypeInt 32 0
|
||||
%14 = OpConstant %13 1
|
||||
%15 = OpTypeArray %6 %14
|
||||
%16 = OpTypeStruct %15
|
||||
%17 = OpTypePointer Uniform %16
|
||||
%18 = OpVariable %17 Uniform
|
||||
%19 = OpTypeInt 32 1
|
||||
%20 = OpConstant %19 0
|
||||
%21 = OpTypePointer Uniform %6
|
||||
%27 = OpTypePointer Output %7
|
||||
%28 = OpVariable %27 Output
|
||||
%29 = OpConstant %13 0
|
||||
%30 = OpTypePointer Function %6
|
||||
%33 = OpTypeArray %19 %14
|
||||
%34 = OpTypeStruct %33
|
||||
%35 = OpTypePointer Uniform %34
|
||||
%36 = OpVariable %35 Uniform
|
||||
%37 = OpTypePointer Uniform %19
|
||||
%44 = OpConstant %13 2
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%9 = OpVariable %8 Function
|
||||
%12 = OpExtInst %7 %1 Cosh %11
|
||||
%22 = OpAccessChain %21 %18 %20 %20
|
||||
%23 = OpLoad %6 %22
|
||||
%24 = OpCompositeConstruct %7 %23 %23 %23 %23
|
||||
%25 = OpCompositeConstruct %7 %10 %10 %10 %10
|
||||
%26 = OpExtInst %7 %1 FClamp %12 %24 %25
|
||||
OpStore %9 %26
|
||||
%31 = OpAccessChain %30 %9 %29
|
||||
%32 = OpLoad %6 %31
|
||||
%38 = OpAccessChain %37 %36 %20 %20
|
||||
%39 = OpLoad %19 %38
|
||||
%40 = OpConvertSToF %6 %39
|
||||
%41 = OpAccessChain %37 %36 %20 %20
|
||||
%42 = OpLoad %19 %41
|
||||
%43 = OpConvertSToF %6 %42
|
||||
%45 = OpAccessChain %30 %9 %44
|
||||
%46 = OpLoad %6 %45
|
||||
%47 = OpCompositeConstruct %7 %32 %40 %43 %46
|
||||
OpStore %28 %47
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
1.0
|
||||
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 1
|
||||
BIND BUFFER variant__GLF_uniform_float_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
|
||||
@@ -0,0 +1,483 @@
|
||||
#!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_10 _GLF_uniform_int_values[0]
|
||||
# #define _int_28 _GLF_uniform_int_values[1]
|
||||
# #define _int_0 _GLF_uniform_int_values[2]
|
||||
# #define _int_1 _GLF_uniform_int_values[3]
|
||||
# #define _int_2 _GLF_uniform_int_values[4]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [10, 28, 0, 1, 2]
|
||||
# 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;
|
||||
# _GLF_color = vec4(_int_0);
|
||||
#
|
||||
# for(int i = _int_0; i < _int_10; i++)
|
||||
# {
|
||||
# if(i > _int_1)
|
||||
# {
|
||||
# a++;
|
||||
#
|
||||
# if(false)
|
||||
# for(int i = _int_0; i < _int_10; i++)
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# for(int i = _int_0; i < _int_10; i++)
|
||||
# {
|
||||
# a += int[2](_int_1, _int_2)[b];
|
||||
# }
|
||||
#
|
||||
# if(a == _int_28)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 122
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %27
|
||||
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 %20 "b"
|
||||
OpName %27 "_GLF_color"
|
||||
OpName %32 "i"
|
||||
OpName %57 "i"
|
||||
OpName %74 "i"
|
||||
OpName %96 "indexable"
|
||||
OpDecorate %11 ArrayStride 16
|
||||
OpMemberDecorate %12 0 Offset 0
|
||||
OpDecorate %12 Block
|
||||
OpDecorate %14 DescriptorSet 0
|
||||
OpDecorate %14 Binding 0
|
||||
OpDecorate %27 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 = OpConstant %6 2
|
||||
%17 = OpTypePointer Uniform %6
|
||||
%21 = OpConstant %6 3
|
||||
%24 = OpTypeFloat 32
|
||||
%25 = OpTypeVector %24 4
|
||||
%26 = OpTypePointer Output %25
|
||||
%27 = OpVariable %26 Output
|
||||
%43 = OpTypeBool
|
||||
%52 = OpConstant %6 1
|
||||
%54 = OpConstantFalse %43
|
||||
%88 = OpConstant %6 4
|
||||
%91 = OpConstant %9 2
|
||||
%92 = OpTypeArray %6 %91
|
||||
%95 = OpTypePointer Function %92
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%20 = OpVariable %7 Function
|
||||
%32 = OpVariable %7 Function
|
||||
%57 = OpVariable %7 Function
|
||||
%74 = OpVariable %7 Function
|
||||
%96 = OpVariable %95 Function
|
||||
%18 = OpAccessChain %17 %14 %15 %16
|
||||
%19 = OpLoad %6 %18
|
||||
OpStore %8 %19
|
||||
%22 = OpAccessChain %17 %14 %15 %21
|
||||
%23 = OpLoad %6 %22
|
||||
OpStore %20 %23
|
||||
%28 = OpAccessChain %17 %14 %15 %16
|
||||
%29 = OpLoad %6 %28
|
||||
%30 = OpConvertSToF %24 %29
|
||||
%31 = OpCompositeConstruct %25 %30 %30 %30 %30
|
||||
OpStore %27 %31
|
||||
%33 = OpAccessChain %17 %14 %15 %16
|
||||
%34 = OpLoad %6 %33
|
||||
OpStore %32 %34
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
OpLoopMerge %37 %38 None
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%40 = OpLoad %6 %32
|
||||
%41 = OpAccessChain %17 %14 %15 %15
|
||||
%42 = OpLoad %6 %41
|
||||
%44 = OpSLessThan %43 %40 %42
|
||||
OpBranchConditional %44 %36 %37
|
||||
%36 = OpLabel
|
||||
%45 = OpLoad %6 %32
|
||||
%46 = OpAccessChain %17 %14 %15 %21
|
||||
%47 = OpLoad %6 %46
|
||||
%48 = OpSGreaterThan %43 %45 %47
|
||||
OpSelectionMerge %50 None
|
||||
OpBranchConditional %48 %49 %50
|
||||
%49 = OpLabel
|
||||
%51 = OpLoad %6 %8
|
||||
%53 = OpIAdd %6 %51 %52
|
||||
OpStore %8 %53
|
||||
OpSelectionMerge %56 None
|
||||
OpBranchConditional %54 %55 %56
|
||||
%55 = OpLabel
|
||||
%58 = OpAccessChain %17 %14 %15 %16
|
||||
%59 = OpLoad %6 %58
|
||||
OpStore %57 %59
|
||||
OpBranch %60
|
||||
%60 = OpLabel
|
||||
OpLoopMerge %62 %63 None
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
%65 = OpLoad %6 %57
|
||||
%66 = OpAccessChain %17 %14 %15 %15
|
||||
%67 = OpLoad %6 %66
|
||||
%68 = OpSLessThan %43 %65 %67
|
||||
OpBranchConditional %68 %61 %62
|
||||
%61 = OpLabel
|
||||
OpReturn
|
||||
%63 = OpLabel
|
||||
OpBranch %60
|
||||
%62 = OpLabel
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%72 = OpLoad %6 %32
|
||||
%73 = OpIAdd %6 %72 %52
|
||||
OpStore %32 %73
|
||||
OpBranch %35
|
||||
%37 = OpLabel
|
||||
%75 = OpAccessChain %17 %14 %15 %16
|
||||
%76 = OpLoad %6 %75
|
||||
OpStore %74 %76
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
OpLoopMerge %79 %80 None
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
%82 = OpLoad %6 %74
|
||||
%83 = OpAccessChain %17 %14 %15 %15
|
||||
%84 = OpLoad %6 %83
|
||||
%85 = OpSLessThan %43 %82 %84
|
||||
OpBranchConditional %85 %78 %79
|
||||
%78 = OpLabel
|
||||
%86 = OpAccessChain %17 %14 %15 %21
|
||||
%87 = OpLoad %6 %86
|
||||
%89 = OpAccessChain %17 %14 %15 %88
|
||||
%90 = OpLoad %6 %89
|
||||
%93 = OpCompositeConstruct %92 %87 %90
|
||||
%94 = OpLoad %6 %20
|
||||
OpStore %96 %93
|
||||
%97 = OpAccessChain %7 %96 %94
|
||||
%98 = OpLoad %6 %97
|
||||
%99 = OpLoad %6 %8
|
||||
%100 = OpIAdd %6 %99 %98
|
||||
OpStore %8 %100
|
||||
OpBranch %80
|
||||
%80 = OpLabel
|
||||
%101 = OpLoad %6 %74
|
||||
%102 = OpIAdd %6 %101 %52
|
||||
OpStore %74 %102
|
||||
OpBranch %77
|
||||
%79 = OpLabel
|
||||
%103 = OpLoad %6 %8
|
||||
%104 = OpAccessChain %17 %14 %15 %52
|
||||
%105 = OpLoad %6 %104
|
||||
%106 = OpIEqual %43 %103 %105
|
||||
OpSelectionMerge %108 None
|
||||
OpBranchConditional %106 %107 %108
|
||||
%107 = OpLabel
|
||||
%109 = OpAccessChain %17 %14 %15 %21
|
||||
%110 = OpLoad %6 %109
|
||||
%111 = OpConvertSToF %24 %110
|
||||
%112 = OpAccessChain %17 %14 %15 %16
|
||||
%113 = OpLoad %6 %112
|
||||
%114 = OpConvertSToF %24 %113
|
||||
%115 = OpAccessChain %17 %14 %15 %16
|
||||
%116 = OpLoad %6 %115
|
||||
%117 = OpConvertSToF %24 %116
|
||||
%118 = OpAccessChain %17 %14 %15 %21
|
||||
%119 = OpLoad %6 %118
|
||||
%120 = OpConvertSToF %24 %119
|
||||
%121 = OpCompositeConstruct %25 %111 %114 %117 %120
|
||||
OpStore %27 %121
|
||||
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
|
||||
10 28 0 1 2
|
||||
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_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 256 256
|
||||
|
||||
|
||||
SHADER vertex variant__vertex_shader PASSTHROUGH
|
||||
|
||||
# variant__fragment_shader is derived from the following GLSL:
|
||||
# #version 320 es
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# int a = 0;
|
||||
# int b = 1;
|
||||
# _GLF_color = vec4(0);
|
||||
#
|
||||
# for(int i = 0; i < 10; i++)
|
||||
# {
|
||||
# if (i > 1)
|
||||
# {
|
||||
# a++;
|
||||
#
|
||||
# if (false)
|
||||
# for(int i = 0; i < 10; i++)
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# for(int i = 0; i < 10; i++)
|
||||
# a += int[2](1, 2)[b];
|
||||
#
|
||||
# if (a == 28)
|
||||
# _GLF_color = vec4(1, 0, 0, 1);
|
||||
# }
|
||||
SHADER fragment variant__fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 79
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %15
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %10 "b"
|
||||
OpName %15 "_GLF_color"
|
||||
OpName %18 "i"
|
||||
OpName %37 "i"
|
||||
OpName %50 "i"
|
||||
OpName %65 "indexable"
|
||||
OpDecorate %15 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpConstant %6 0
|
||||
%11 = OpConstant %6 1
|
||||
%12 = OpTypeFloat 32
|
||||
%13 = OpTypeVector %12 4
|
||||
%14 = OpTypePointer Output %13
|
||||
%15 = OpVariable %14 Output
|
||||
%16 = OpConstant %12 0
|
||||
%17 = OpConstantComposite %13 %16 %16 %16 %16
|
||||
%25 = OpConstant %6 10
|
||||
%26 = OpTypeBool
|
||||
%34 = OpConstantFalse %26
|
||||
%58 = OpTypeInt 32 0
|
||||
%59 = OpConstant %58 2
|
||||
%60 = OpTypeArray %6 %59
|
||||
%61 = OpConstant %6 2
|
||||
%62 = OpConstantComposite %60 %11 %61
|
||||
%64 = OpTypePointer Function %60
|
||||
%73 = OpConstant %6 28
|
||||
%77 = OpConstant %12 1
|
||||
%78 = OpConstantComposite %13 %77 %16 %16 %77
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%10 = OpVariable %7 Function
|
||||
%18 = OpVariable %7 Function
|
||||
%37 = OpVariable %7 Function
|
||||
%50 = OpVariable %7 Function
|
||||
%65 = OpVariable %64 Function
|
||||
OpStore %8 %9
|
||||
OpStore %10 %11
|
||||
OpStore %15 %17
|
||||
OpStore %18 %9
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %21 %22 None
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
%24 = OpLoad %6 %18
|
||||
%27 = OpSLessThan %26 %24 %25
|
||||
OpBranchConditional %27 %20 %21
|
||||
%20 = OpLabel
|
||||
%28 = OpLoad %6 %18
|
||||
%29 = OpSGreaterThan %26 %28 %11
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %30 %31
|
||||
%30 = OpLabel
|
||||
%32 = OpLoad %6 %8
|
||||
%33 = OpIAdd %6 %32 %11
|
||||
OpStore %8 %33
|
||||
OpSelectionMerge %36 None
|
||||
OpBranchConditional %34 %35 %36
|
||||
%35 = OpLabel
|
||||
OpStore %37 %9
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
OpLoopMerge %40 %41 None
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
%43 = OpLoad %6 %37
|
||||
%44 = OpSLessThan %26 %43 %25
|
||||
OpBranchConditional %44 %39 %40
|
||||
%39 = OpLabel
|
||||
OpReturn
|
||||
%41 = OpLabel
|
||||
OpBranch %38
|
||||
%40 = OpLabel
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%48 = OpLoad %6 %18
|
||||
%49 = OpIAdd %6 %48 %11
|
||||
OpStore %18 %49
|
||||
OpBranch %19
|
||||
%21 = OpLabel
|
||||
OpStore %50 %9
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
OpLoopMerge %53 %54 None
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
%56 = OpLoad %6 %50
|
||||
%57 = OpSLessThan %26 %56 %25
|
||||
OpBranchConditional %57 %52 %53
|
||||
%52 = OpLabel
|
||||
%63 = OpLoad %6 %10
|
||||
OpStore %65 %62
|
||||
%66 = OpAccessChain %7 %65 %63
|
||||
%67 = OpLoad %6 %66
|
||||
%68 = OpLoad %6 %8
|
||||
%69 = OpIAdd %6 %68 %67
|
||||
OpStore %8 %69
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%70 = OpLoad %6 %50
|
||||
%71 = OpIAdd %6 %70 %11
|
||||
OpStore %50 %71
|
||||
OpBranch %51
|
||||
%53 = OpLabel
|
||||
%72 = OpLoad %6 %8
|
||||
%74 = OpIEqual %26 %72 %73
|
||||
OpSelectionMerge %76 None
|
||||
OpBranchConditional %74 %75 %76
|
||||
%75 = OpLabel
|
||||
OpStore %15 %78
|
||||
OpBranch %76
|
||||
%76 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant_
|
||||
|
||||
# injectionSwitch
|
||||
BUFFER variant__injectionSwitch DATA_TYPE vec2<float> STD140 DATA
|
||||
0.0 1.0
|
||||
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__injectionSwitch 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 EQ_HISTOGRAM_EMD_BUFFER variant__framebuffer TOLERANCE 0.005
|
||||
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user