dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
authorVenni Ihanakangas <venni.ihanakangas@siru.fi>
Tue, 17 Sep 2019 11:01:29 +0000 (14:01 +0300)
committerVenni Ihanakangas <venni.ihanakangas@siru.fi>
Thu, 31 Oct 2019 06:55:54 +0000 (08:55 +0200)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard

Change-Id: I10f80a5b5640b209c9dfb0b612ab232735cda7e2

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.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 5bea6ae..d4e3e62 100644 (file)
@@ -520919,6 +520919,7 @@ dEQP-VK.graphicsfuzz.two-loops-matrix
 dEQP-VK.graphicsfuzz.two-loops-set-struct
 dEQP-VK.graphicsfuzz.two-loops-with-break
 dEQP-VK.graphicsfuzz.two-nested-do-whiles
+dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
 dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops
 dEQP-VK.graphicsfuzz.unreachable-continue-statement
 dEQP-VK.graphicsfuzz.unreachable-discard-statement
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/two-nested-infinite-loops-discard.amber
new file mode 100644 (file)
index 0000000..4ce3c46
--- /dev/null
@@ -0,0 +1,207 @@
+#!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 function
+
+# The test passes because main always writes the color red. (Additionally the discard statement is never reached).
+
+# Optimized using spirv-opt with the following arguments:
+# '--eliminate-local-single-block'
+# '--reduce-load-size'
+# '--combine-access-chains'
+# '--eliminate-local-multi-store'
+# '--reduce-load-size'
+# '--convert-local-access-chains'
+# '--eliminate-dead-branches'
+# '--eliminate-dead-branches'
+# '--merge-return'
+# '--copy-propagate-arrays'
+# '--copy-propagate-arrays'
+# '--eliminate-dead-inserts'
+# '--merge-blocks'
+# '--copy-propagate-arrays'
+# '--combine-access-chains'
+# '--simplify-instructions'
+# '--convert-local-access-chains'
+# spirv-opt commit hash: 4a00a80c40484a6f6f72f48c9d34943cf8f180d4
+
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+# variant_fragment_shader is derived from the following GLSL:
+# #version 310 es
+#
+# // END OF GENERATED HEADER
+# precision highp float;
+#
+# layout(location = 0) out vec4 _GLF_color;
+# layout(set = 0, binding = 0) uniform buf0
+# {
+#     vec2 injectionSwitch;
+# };
+#
+# vec3 mand()
+# {
+#     for (
+#         int k = 0;
+#         k < 1000;
+#         1)
+#     {
+#         discard;
+#     }
+#     return vec3(1.0);
+# }
+# void main()
+# {
+#     if (injectionSwitch.x > injectionSwitch.y)
+#     {
+#         for (
+#             int j = 0;
+#             j < 4;
+#             1)
+#         {
+#             mand();
+#         }
+#     }
+#
+#     _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: 64
+; 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 %9 "mand("
+               OpName %13 "k"
+               OpName %31 "buf0"
+               OpMemberName %31 0 "injectionSwitch"
+               OpName %33 ""
+               OpName %45 "j"
+               OpName %57 "_GLF_color"
+               OpDecorate %13 RelaxedPrecision
+               OpMemberDecorate %31 0 Offset 0
+               OpDecorate %31 Block
+               OpDecorate %33 DescriptorSet 0
+               OpDecorate %33 Binding 0
+               OpDecorate %45 RelaxedPrecision
+               OpDecorate %57 Location 0
+               OpDecorate %14 RelaxedPrecision
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 3
+          %8 = OpTypeFunction %7
+         %11 = OpTypeInt 32 1
+         %12 = OpTypePointer Function %11
+         %14 = OpConstant %11 0
+         %21 = OpConstant %11 1000
+         %22 = OpTypeBool
+         %25 = OpConstant %11 1
+         %26 = OpConstant %6 1
+         %27 = OpConstantComposite %7 %26 %26 %26
+         %30 = OpTypeVector %6 2
+         %31 = OpTypeStruct %30
+         %32 = OpTypePointer Uniform %31
+         %33 = OpVariable %32 Uniform
+         %34 = OpTypeInt 32 0
+         %35 = OpConstant %34 0
+         %36 = OpTypePointer Uniform %6
+         %39 = OpConstant %34 1
+         %52 = OpConstant %11 4
+         %55 = OpTypeVector %6 4
+         %56 = OpTypePointer Output %55
+         %57 = OpVariable %56 Output
+         %58 = OpConstant %6 0
+         %59 = OpConstantComposite %55 %26 %58 %58 %26
+         %62 = OpUndef %11
+         %63 = OpConstantTrue %22
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %45 = OpVariable %12 Function
+         %37 = OpAccessChain %36 %33 %14 %35
+         %38 = OpLoad %6 %37
+         %40 = OpAccessChain %36 %33 %14 %39
+         %41 = OpLoad %6 %40
+         %42 = OpFOrdGreaterThan %22 %38 %41
+               OpSelectionMerge %44 None
+               OpBranchConditional %42 %43 %44
+         %43 = OpLabel
+               OpStore %45 %14
+               OpBranch %46
+         %46 = OpLabel
+               OpLoopMerge %48 %47 None
+               OpBranchConditional %63 %47 %48
+         %47 = OpLabel
+         %54 = OpFunctionCall %7 %9
+               OpBranch %46
+         %48 = OpLabel
+               OpBranch %44
+         %44 = OpLabel
+               OpStore %57 %59
+               OpReturn
+               OpFunctionEnd
+          %9 = OpFunction %7 None %8
+         %10 = OpLabel
+         %13 = OpVariable %12 Function
+               OpStore %13 %14
+               OpBranch %15
+         %15 = OpLabel
+               OpLoopMerge %17 %18 None
+               OpBranchConditional %63 %16 %17
+         %16 = OpLabel
+               OpKill
+         %18 = OpLabel
+               OpBranch %15
+         %17 = 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
index 21f31bb..f7b5672 100644 (file)
@@ -91,6 +91,7 @@ void createAmberTests (tcu::TestCaseGroup* group)
                {       "two-loops-set-struct.amber",                                   "two-loops-set-struct",                                 "A fragment shader with two loops that write to a struct"                                                               },
                {       "two-loops-with-break.amber",                                   "two-loops-with-break",                                 "A fragment shader with two loops with breaks"                                                                                  },
                {       "two-nested-do-whiles.amber",                                   "two-nested-do-whiles",                                 "A fragment shader with nested do while"                                                                                                },
+               {       "two-nested-infinite-loops-discard.amber",              "two-nested-infinite-loops-discard",    "A fragment shader with an always false if function"                                                                    },
                {       "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.amber",                  "unreachable-discard-statement",                "A fragment shader with unreachable discard statement"                                                                  },
index 413f88f..4c8ffc2 100644 (file)
@@ -523262,6 +523262,7 @@ dEQP-VK.graphicsfuzz.two-loops-matrix
 dEQP-VK.graphicsfuzz.two-loops-set-struct
 dEQP-VK.graphicsfuzz.two-loops-with-break
 dEQP-VK.graphicsfuzz.two-nested-do-whiles
+dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
 dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops
 dEQP-VK.graphicsfuzz.unreachable-continue-statement
 dEQP-VK.graphicsfuzz.unreachable-discard-statement
index 42b991f..e591d55 100644 (file)
@@ -523109,6 +523109,7 @@ dEQP-VK.graphicsfuzz.two-loops-matrix
 dEQP-VK.graphicsfuzz.two-loops-set-struct
 dEQP-VK.graphicsfuzz.two-loops-with-break
 dEQP-VK.graphicsfuzz.two-nested-do-whiles
+dEQP-VK.graphicsfuzz.two-nested-infinite-loops-discard
 dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops
 dEQP-VK.graphicsfuzz.unreachable-continue-statement
 dEQP-VK.graphicsfuzz.unreachable-discard-statement