dEQP-VK.graphicsfuzz.unreachable-discard-statement-in-if
authorVenni Ihanakangas <venni.ihanakangas@siru.fi>
Thu, 19 Sep 2019 09:39:21 +0000 (12:39 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 31 Oct 2019 14:26:07 +0000 (10:26 -0400)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.unreachable-discard-statement-in-if

Change-Id: I88cf495fffb65b5288143b352628a737c621b933

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.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 950d3d1..52c1963 100644 (file)
@@ -520927,6 +520927,7 @@ dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
 dEQP-VK.graphicsfuzz.uninitialized-var-decrement-and-add
 dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops
 dEQP-VK.graphicsfuzz.unreachable-continue-statement
+dEQP-VK.graphicsfuzz.unreachable-discard-statement-in-if
 dEQP-VK.graphicsfuzz.unreachable-discard-statement
 dEQP-VK.graphicsfuzz.unreachable-loops
 dEQP-VK.graphicsfuzz.unreachable-loops-in-switch
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement-in-if.amber
new file mode 100644 (file)
index 0000000..a8eca58
--- /dev/null
@@ -0,0 +1,187 @@
+#!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 discard keyword and a return
+
+# The test passes because main always writes the color red; the discard statement is unreachable.
+
+# Optimized using spirv-opt with the following arguments:
+# '--eliminate-dead-branches'
+# '--merge-return'
+# '--eliminate-dead-branches'
+# '--merge-blocks'
+# spirv-opt commit hash: 230c9e437146e48ec58adb4433890403c23c98fa
+
+
+
+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 computePoint()
+# {
+#     if (injectionSwitch.x > injectionSwitch.y) // always false
+#     {
+#     discard;
+#     return vec3(1.0);
+#     }
+# }
+# void main()
+# {
+#
+#     computePoint();
+#     if (false)
+#     {
+#     }
+#     if (gl_FragCoord.x < 0.0)
+#     {
+#         return;
+#     }
+#     computePoint();
+#
+#     _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: 60
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %40 %51
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %9 "computePoint("
+               OpName %12 "buf0"
+               OpMemberName %12 0 "injectionSwitch"
+               OpName %14 ""
+               OpName %40 "gl_FragCoord"
+               OpName %51 "_GLF_color"
+               OpMemberDecorate %12 0 Offset 0
+               OpDecorate %12 Block
+               OpDecorate %14 DescriptorSet 0
+               OpDecorate %14 Binding 0
+               OpDecorate %40 BuiltIn FragCoord
+               OpDecorate %51 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 3
+          %8 = OpTypeFunction %7
+         %11 = OpTypeVector %6 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 %6
+         %22 = OpConstant %17 1
+         %25 = OpTypeBool
+         %30 = OpConstant %6 1
+         %31 = OpConstantComposite %7 %30 %30 %30
+         %35 = OpConstantFalse %25
+         %38 = OpTypeVector %6 4
+         %39 = OpTypePointer Input %38
+         %40 = OpVariable %39 Input
+         %41 = OpTypePointer Input %6
+         %44 = OpConstant %6 0
+         %50 = OpTypePointer Output %38
+         %51 = OpVariable %50 Output
+         %52 = OpConstantComposite %38 %30 %44 %44 %30
+         %57 = OpTypePointer Function %25
+         %59 = OpConstantTrue %25
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %58 = OpVariable %57 Function %35
+               OpBranch %54
+         %54 = OpLabel
+         %34 = OpFunctionCall %7 %9
+               OpLoopMerge %53 %56 None
+               OpBranch %37
+         %37 = OpLabel
+         %42 = OpAccessChain %41 %40 %18
+         %43 = OpLoad %6 %42
+         %45 = OpFOrdLessThan %25 %43 %44
+               OpSelectionMerge %47 None
+               OpBranchConditional %45 %46 %47
+         %46 = OpLabel
+               OpStore %58 %59
+               OpBranch %53
+         %47 = OpLabel
+         %49 = OpFunctionCall %7 %9
+               OpStore %51 %52
+               OpStore %58 %59
+               OpBranch %53
+         %56 = OpLabel
+               OpBranch %54
+         %53 = OpLabel
+               OpReturn
+               OpFunctionEnd
+          %9 = OpFunction %7 None %8
+         %10 = OpLabel
+         %20 = OpAccessChain %19 %14 %16 %18
+         %21 = OpLoad %6 %20
+         %23 = OpAccessChain %19 %14 %16 %22
+         %24 = OpLoad %6 %23
+         %26 = OpFOrdGreaterThan %25 %21 %24
+               OpSelectionMerge %28 None
+               OpBranchConditional %26 %27 %28
+         %27 = OpLabel
+               OpKill
+         %28 = OpLabel
+         %33 = OpUndef %7
+               OpReturnValue %33
+               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 814519d..e318b3e 100644 (file)
@@ -99,6 +99,7 @@ void createAmberTests (tcu::TestCaseGroup* group)
                {       "uninitialized-var-decrement-and-add.amber",    "uninitialized-var-decrement-and-add",  "A fragment shader that uses an uninitialized variable"                                                                 },
                {       "unreachable-barrier-in-loops.amber",                   "unreachable-barrier-in-loops",                 "A compute shader with an unreachable barrier in a loop nest"                                                   },
                {       "unreachable-continue-statement.amber",                 "unreachable-continue-statement",               "A fragment shader with unreachable continue statement"                                                                 },
+               {       "unreachable-discard-statement-in-if.amber",    "unreachable-discard-statement-in-if",  "A fragment shader with discard keyword and a return"                                                                   },
                {       "unreachable-discard-statement.amber",                  "unreachable-discard-statement",                "A fragment shader with unreachable discard statement"                                                                  },
                {       "unreachable-loops.amber",                                              "unreachable-loops",                                    "Fragment shader that writes red despite unreachable loops"                                                             },
                {       "unreachable-loops-in-switch.amber",                    "unreachable-loops-in-switch",                  "A fragment shader with unreachable loops in a switch"                                                                  },
index fdc6105..8235631 100644 (file)
@@ -523270,6 +523270,7 @@ dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
 dEQP-VK.graphicsfuzz.uninitialized-var-decrement-and-add
 dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops
 dEQP-VK.graphicsfuzz.unreachable-continue-statement
+dEQP-VK.graphicsfuzz.unreachable-discard-statement-in-if
 dEQP-VK.graphicsfuzz.unreachable-discard-statement
 dEQP-VK.graphicsfuzz.unreachable-loops
 dEQP-VK.graphicsfuzz.unreachable-loops-in-switch
index d863ba7..58e5d7f 100644 (file)
@@ -523117,6 +523117,7 @@ dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
 dEQP-VK.graphicsfuzz.uninitialized-var-decrement-and-add
 dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops
 dEQP-VK.graphicsfuzz.unreachable-continue-statement
+dEQP-VK.graphicsfuzz.unreachable-discard-statement-in-if
 dEQP-VK.graphicsfuzz.unreachable-discard-statement
 dEQP-VK.graphicsfuzz.unreachable-loops
 dEQP-VK.graphicsfuzz.unreachable-loops-in-switch