dEQP-VK.graphicsfuzz.discard-in-loop
authorAlastair Donaldson <afdx@google.com>
Fri, 1 Nov 2019 11:26:48 +0000 (11:26 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 6 Dec 2019 10:52:47 +0000 (05:52 -0500)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.discard-in-loop

Change-Id: I7ff8a88209bba73932f86fbf397b721e994c4c18

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/discard-in-loop.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt
external/vulkancts/mustpass/master/vk-default-no-waivers.txt
external/vulkancts/mustpass/master/vk-default.txt

index f003be5..25d590d 100644 (file)
@@ -559361,6 +559361,7 @@ dEQP-VK.graphicsfuzz.dead-struct-init
 dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop
 dEQP-VK.graphicsfuzz.discard-continue-return
 dEQP-VK.graphicsfuzz.discard-in-array-manipulating-loop
+dEQP-VK.graphicsfuzz.discard-in-loop
 dEQP-VK.graphicsfuzz.discard-in-loop-in-function
 dEQP-VK.graphicsfuzz.discards-in-control-flow
 dEQP-VK.graphicsfuzz.do-while-loop-in-conditionals
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/discard-in-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/discard-in-loop.amber
new file mode 100644 (file)
index 0000000..a0abd62
--- /dev/null
@@ -0,0 +1,160 @@
+#!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 a discard in a loop
+
+# The test passes because the discard is always reached, so the background colour will remain black.
+
+# Optimized using spirv-opt with the following arguments:
+# '-O'
+# 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;
+#
+# precision highp int;
+#
+# layout(location = 0) out vec4 _GLF_color;
+#
+# void main()
+# {
+#  for(int i = 0; i < 10; i++)
+#   {
+#    if(gl_FragCoord.y < 0.0)
+#     {
+#      if(gl_FragCoord.x < 0.0)
+#       {
+#        break;
+#       }
+#      continue;
+#     }
+#    discard;
+#   }
+#   _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" %22 %45
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %22 "gl_FragCoord"
+               OpName %45 "_GLF_color"
+               OpDecorate %22 BuiltIn FragCoord
+               OpDecorate %45 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeInt 32 1
+          %9 = OpConstant %6 0
+         %16 = OpConstant %6 10
+         %17 = OpTypeBool
+         %19 = OpTypeFloat 32
+         %20 = OpTypeVector %19 4
+         %21 = OpTypePointer Input %20
+         %22 = OpVariable %21 Input
+         %23 = OpTypeInt 32 0
+         %24 = OpConstant %23 1
+         %25 = OpTypePointer Input %19
+         %28 = OpConstant %19 0
+         %32 = OpConstant %23 0
+         %42 = OpConstant %6 1
+         %44 = OpTypePointer Output %20
+         %45 = OpVariable %44 Output
+         %46 = OpConstant %19 1
+         %47 = OpConstantComposite %20 %46 %28 %28 %46
+         %55 = OpConstantFalse %17
+         %58 = OpConstantTrue %17
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+               OpBranch %52
+         %52 = OpLabel
+               OpLoopMerge %51 %54 None
+               OpBranch %10
+         %10 = OpLabel
+         %61 = OpPhi %6 %9 %52 %43 %37
+         %18 = OpSLessThan %17 %61 %16
+               OpLoopMerge %12 %37 None
+               OpBranchConditional %18 %11 %12
+         %11 = OpLabel
+         %26 = OpAccessChain %25 %22 %24
+         %27 = OpLoad %19 %26
+         %29 = OpFOrdLessThan %17 %27 %28
+               OpSelectionMerge %31 None
+               OpBranchConditional %29 %30 %31
+         %30 = OpLabel
+         %33 = OpAccessChain %25 %22 %32
+         %34 = OpLoad %19 %33
+         %35 = OpFOrdLessThan %17 %34 %28
+               OpSelectionMerge %63 None
+               OpBranchConditional %35 %36 %37
+         %36 = OpLabel
+               OpBranch %12
+         %63 = OpLabel
+               OpBranch %37
+         %37 = OpLabel
+         %43 = OpIAdd %6 %61 %42
+               OpBranch %10
+         %31 = OpLabel
+         %50 = OpFunctionCall %2 %48
+               OpBranch %12
+         %12 = OpLabel
+         %62 = OpPhi %17 %55 %10 %55 %36 %58 %31
+               OpSelectionMerge %59 None
+               OpBranchConditional %62 %51 %59
+         %59 = OpLabel
+               OpStore %45 %47
+               OpBranch %51
+         %54 = OpLabel
+               OpBranch %52
+         %51 = OpLabel
+               OpReturn
+               OpFunctionEnd
+         %48 = OpFunction %2 None %3
+         %49 = OpLabel
+               OpKill
+               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 0 0 0 255
index c476d88..cb2b724 100644 (file)
@@ -14,6 +14,7 @@
 {      "disc-and-add-in-func-in-loop.amber",                   "disc-and-add-in-func-in-loop",                 "A fragment shader with discard and add in function in loop"                                                    },
 {      "discard-continue-return.amber",                                "discard-continue-return",                              "A fragment shader with a discard, continue, and return"                                                                },
 {      "discard-in-array-manipulating-loop.amber",             "discard-in-array-manipulating-loop",   "An array-manipulating fragment shader with a discard"                                                                  },
+{      "discard-in-loop.amber",                                                "discard-in-loop",                                              "A shader with a discard in a loop"                                                                                                             },
 {      "discard-in-loop-in-function.amber",                    "discard-in-loop-in-function",                  "A shader with a discard nested in a loop in a function"                                                                },
 {      "discards-in-control-flow.amber",                               "discards-in-control-flow",                             "A fragment shader with discards in loops and conditionals"                                                             },
 {      "do-while-loop-in-conditionals.amber",                  "do-while-loop-in-conditionals",                "A fragment shader with do-while loop in conditional nest"                                                              },
index 4f433c5..b9d7a84 100644 (file)
@@ -561704,6 +561704,7 @@ dEQP-VK.graphicsfuzz.dead-struct-init
 dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop
 dEQP-VK.graphicsfuzz.discard-continue-return
 dEQP-VK.graphicsfuzz.discard-in-array-manipulating-loop
+dEQP-VK.graphicsfuzz.discard-in-loop
 dEQP-VK.graphicsfuzz.discard-in-loop-in-function
 dEQP-VK.graphicsfuzz.discards-in-control-flow
 dEQP-VK.graphicsfuzz.do-while-loop-in-conditionals
index eece2b9..843d66a 100644 (file)
@@ -561551,6 +561551,7 @@ dEQP-VK.graphicsfuzz.dead-struct-init
 dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop
 dEQP-VK.graphicsfuzz.discard-continue-return
 dEQP-VK.graphicsfuzz.discard-in-array-manipulating-loop
+dEQP-VK.graphicsfuzz.discard-in-loop
 dEQP-VK.graphicsfuzz.discard-in-loop-in-function
 dEQP-VK.graphicsfuzz.discards-in-control-flow
 dEQP-VK.graphicsfuzz.do-while-loop-in-conditionals