dEQP-VK.graphicsfuzz.returned-boolean-in-vector
authorVenni Ihanakangas <venni.ihanakangas@siru.fi>
Thu, 31 Oct 2019 10:11:05 +0000 (12:11 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 31 Oct 2019 12:36:12 +0000 (08:36 -0400)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.returned-boolean-in-vector

Change-Id: I6976dd7e81ee6056cd28ed8cc23846bac2a35ebe

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber [new file with mode: 0644]
external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp
external/vulkancts/mustpass/master/vk-default-no-waivers.txt
external/vulkancts/mustpass/master/vk-default.txt

index 895b2df..067e863 100644 (file)
@@ -520911,6 +520911,7 @@ dEQP-VK.graphicsfuzz.nested-loops-switch
 dEQP-VK.graphicsfuzz.pow-vec4
 dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
 dEQP-VK.graphicsfuzz.return-in-loop-in-function
+dEQP-VK.graphicsfuzz.returned-boolean-in-vector
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.struct-used-as-temporary
 dEQP-VK.graphicsfuzz.switch-if-discard
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/returned-boolean-in-vector.amber
new file mode 100644 (file)
index 0000000..09c6913
--- /dev/null
@@ -0,0 +1,231 @@
+#!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 returned boolean in vector
+
+# The test passes because the shader always writes the color red.
+
+# Optimized using spirv-opt with the following arguments:
+# '--eliminate-dead-branches'
+# '--merge-return'
+# '--inline-entry-points-exhaustive'
+# '--vector-dce'
+# '--simplify-instructions'
+# '--eliminate-dead-branches'
+# '--vector-dce'
+# '--eliminate-dead-code-aggressive'
+# '--scalar-replacement=100'
+# '--eliminate-dead-branches'
+# '--reduce-load-size'
+# '--eliminate-local-multi-store'
+# '--ccp'
+# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0
+
+
+
+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;
+# };
+#
+# bool puzzlelize()
+# {
+#   for (int i = 0; i < 1; i++)
+#   {
+#     return true;
+#   }
+# }
+# void main()
+# {
+#   vec2 uv;
+#   vec3 color;
+#
+#   do
+#   {
+#     if (injectionSwitch.y < 0.0)
+#     {
+#       color = vec3(1.0);
+#     }
+#   } while (false);
+#   _GLF_color = vec4(color, 1.0) + vec4(puzzlelize());
+#
+#   _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
+# }
+SHADER fragment variant_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 108
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %53
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %33 "buf0"
+               OpMemberName %33 0 "injectionSwitch"
+               OpName %35 ""
+               OpName %47 "color"
+               OpName %53 "_GLF_color"
+               OpMemberDecorate %33 0 Offset 0
+               OpDecorate %33 Block
+               OpDecorate %35 DescriptorSet 0
+               OpDecorate %35 Binding 0
+               OpDecorate %53 Location 0
+               OpDecorate %76 RelaxedPrecision
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeBool
+         %10 = OpTypeInt 32 1
+         %11 = OpTypePointer Function %10
+         %13 = OpConstant %10 0
+         %20 = OpConstant %10 1
+         %22 = OpConstantTrue %6
+         %31 = OpTypeFloat 32
+         %32 = OpTypeVector %31 2
+         %33 = OpTypeStruct %32
+         %34 = OpTypePointer Uniform %33
+         %35 = OpVariable %34 Uniform
+         %36 = OpTypeInt 32 0
+         %37 = OpConstant %36 1
+         %38 = OpTypePointer Uniform %31
+         %41 = OpConstant %31 0
+         %45 = OpTypeVector %31 3
+         %46 = OpTypePointer Function %45
+         %48 = OpConstant %31 1
+         %49 = OpConstantComposite %45 %48 %48 %48
+         %50 = OpConstantFalse %6
+         %51 = OpTypeVector %31 4
+         %52 = OpTypePointer Output %51
+         %53 = OpVariable %52 Output
+         %63 = OpConstantComposite %51 %48 %41 %41 %48
+         %65 = OpTypePointer Function %6
+         %95 = OpUndef %45
+        %106 = OpUndef %6
+        %107 = OpUndef %10
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %74 = OpVariable %65 Function %50
+         %75 = OpVariable %65 Function
+         %76 = OpVariable %11 Function
+         %77 = OpVariable %65 Function
+         %47 = OpVariable %46 Function
+               OpBranch %27
+         %27 = OpLabel
+        %105 = OpPhi %6 %106 %5 %105 %30
+         %94 = OpPhi %45 %95 %5 %93 %30
+               OpLoopMerge %29 %30 None
+               OpBranch %28
+         %28 = OpLabel
+         %39 = OpAccessChain %38 %35 %13 %37
+         %40 = OpLoad %31 %39
+         %42 = OpFOrdLessThan %6 %40 %41
+               OpSelectionMerge %44 None
+               OpBranchConditional %42 %43 %44
+         %43 = OpLabel
+               OpStore %47 %49
+               OpBranch %44
+         %44 = OpLabel
+         %93 = OpPhi %45 %94 %28 %49 %43
+               OpBranch %30
+         %30 = OpLabel
+               OpBranchConditional %50 %27 %29
+         %29 = OpLabel
+         %55 = OpCompositeExtract %31 %93 0
+         %56 = OpCompositeExtract %31 %93 1
+         %57 = OpCompositeExtract %31 %93 2
+         %58 = OpCompositeConstruct %51 %55 %56 %57 %48
+               OpStore %74 %50
+               OpBranch %78
+         %78 = OpLabel
+        %103 = OpPhi %6 %105 %29 %106 %80
+         %99 = OpPhi %6 %50 %29 %106 %80
+               OpLoopMerge %79 %80 None
+               OpBranch %81
+         %81 = OpLabel
+               OpStore %76 %13
+               OpBranch %82
+         %82 = OpLabel
+        %102 = OpPhi %6 %103 %81 %106 %84
+         %98 = OpPhi %6 %50 %81 %106 %84
+         %96 = OpPhi %10 %13 %81 %107 %84
+               OpLoopMerge %83 %84 None
+               OpBranch %85
+         %85 = OpLabel
+         %87 = OpSLessThan %6 %13 %20
+               OpBranchConditional %22 %88 %83
+         %88 = OpLabel
+               OpStore %74 %22
+               OpStore %75 %22
+               OpBranch %83
+         %84 = OpLabel
+               OpBranch %82
+         %83 = OpLabel
+        %101 = OpPhi %6 %102 %85 %22 %88
+         %97 = OpPhi %6 %50 %85 %22 %88
+               OpSelectionMerge %90 None
+               OpBranchConditional %22 %79 %90
+         %90 = OpLabel
+               OpStore %74 %22
+               OpBranch %79
+         %80 = OpLabel
+               OpBranch %78
+         %79 = OpLabel
+               OpStore %77 %22
+         %60 = OpSelect %31 %22 %48 %41
+         %61 = OpCompositeConstruct %51 %60 %60 %60 %60
+         %62 = OpFAdd %51 %58 %61
+               OpStore %53 %62
+               OpStore %53 %63
+               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
index 8be5a54..d38dd2c 100644 (file)
@@ -83,6 +83,7 @@ void createAmberTests (tcu::TestCaseGroup* group)
                {       "pow-vec4.amber",                                                               "pow-vec4",                                                             "A fragment shader that uses pow"                                                                                                               },
                {       "return-before-writing-wrong-color.amber",              "return-before-writing-wrong-color",    "A fragment shader with return before writing wrong color"                                                              },
                {       "return-in-loop-in-function.amber",                             "return-in-loop-in-function",                   "A fragment shader with early return from loop in function"                                                             },
+               {       "returned-boolean-in-vector.amber",                             "returned-boolean-in-vector",                   "A fragment shader with returned boolean in vector"                                                                             },
                {       "similar-nested-ifs.amber",                                             "similar-nested-ifs",                                   "A fragment shader with similar nested ifs and loops"                                                                   },
                {       "struct-used-as-temporary.amber",                               "struct-used-as-temporary",                             "A fragment shader that uses a temporary struct variable"                                                               },
                {       "switch-if-discard.amber",                                              "switch-if-discard",                                    "A fragment shader with a switch, if, and discard"                                                                              },
index 8afcf1d..0f885a4 100644 (file)
@@ -523254,6 +523254,7 @@ dEQP-VK.graphicsfuzz.nested-loops-switch
 dEQP-VK.graphicsfuzz.pow-vec4
 dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
 dEQP-VK.graphicsfuzz.return-in-loop-in-function
+dEQP-VK.graphicsfuzz.returned-boolean-in-vector
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.struct-used-as-temporary
 dEQP-VK.graphicsfuzz.switch-if-discard
index 90f2228..fdeda82 100644 (file)
@@ -523101,6 +523101,7 @@ dEQP-VK.graphicsfuzz.nested-loops-switch
 dEQP-VK.graphicsfuzz.pow-vec4
 dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
 dEQP-VK.graphicsfuzz.return-in-loop-in-function
+dEQP-VK.graphicsfuzz.returned-boolean-in-vector
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.struct-used-as-temporary
 dEQP-VK.graphicsfuzz.switch-if-discard