dEQP-VK.graphicsfuzz.do-while-with-always-true-if
authorVenni Ihanakangas <venni.ihanakangas@siru.fi>
Thu, 26 Sep 2019 12:25:45 +0000 (15:25 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 25 Oct 2019 14:54:00 +0000 (10:54 -0400)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.do-while-with-always-true-if

Change-Id: Ibb8f3aeac2ca2bb328ad406bbe4cea7c67aee065

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-with-always-true-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 bc81b70..c73a5e8 100644 (file)
@@ -519508,6 +519508,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.do-while-loop-in-conditionals
+dEQP-VK.graphicsfuzz.do-while-with-always-true-if
 dEQP-VK.graphicsfuzz.early-return-and-barrier
 dEQP-VK.graphicsfuzz.for-condition-always-false
 dEQP-VK.graphicsfuzz.for-with-ifs-and-return
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-with-always-true-if.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-with-always-true-if.amber
new file mode 100644 (file)
index 0000000..23d640d
--- /dev/null
@@ -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 fragment shader with a do while that always returns
+
+# The test passes because the shader always writes the color red. The do while returns on first iteration.
+
+# Optimized using spirv-opt with the following arguments:
+# '--redundancy-elimination'
+# '--reduce-load-size'
+# '--combine-access-chains'
+# '--eliminate-dead-code-aggressive'
+# '--eliminate-dead-branches'
+# 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;
+#
+# struct _GLF_struct_12
+# {
+#   int count;
+# };
+#
+# bool puzzlelize(vec2 pos)
+# {
+#   return true;
+# }
+#
+# void main()
+# {
+#   _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
+#
+#   vec2 grid;
+#   _GLF_struct_12 _GLF_struct_replacement_12;
+#
+#   do
+#   {
+#     if (gl_FragCoord.y > -1.0) // Always true
+#     {
+#       return;
+#     }
+#   } while (_GLF_struct_replacement_12.count != 1);
+#
+#   grid += vec2(1, _GLF_struct_replacement_12.count);
+#   vec2 position;
+#   position = grid;
+#   vec4(puzzlelize(position));
+#
+#   _GLF_color = vec4(1.0, 1.0, 1.0, 1.0); // This should not be reached
+# }
+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" %19 %28
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %12 "puzzlelize(vf2;"
+               OpName %11 "pos"
+               OpName %19 "_GLF_color"
+               OpName %28 "gl_FragCoord"
+               OpName %40 "_GLF_struct_12"
+               OpMemberName %40 0 "count"
+               OpName %42 "_GLF_struct_replacement_12"
+               OpName %49 "grid"
+               OpName %56 "position"
+               OpName %58 "param"
+               OpDecorate %19 Location 0
+               OpDecorate %28 BuiltIn FragCoord
+               OpMemberDecorate %40 0 RelaxedPrecision
+               OpDecorate %46 RelaxedPrecision
+               OpDecorate %51 RelaxedPrecision
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+          %9 = OpTypeBool
+         %10 = OpTypeFunction %9 %8
+         %14 = OpConstantTrue %9
+         %17 = OpTypeVector %6 4
+         %18 = OpTypePointer Output %17
+         %19 = OpVariable %18 Output
+         %20 = OpConstant %6 1
+         %21 = OpConstant %6 0
+         %22 = OpConstantComposite %17 %20 %21 %21 %20
+         %27 = OpTypePointer Input %17
+         %28 = OpVariable %27 Input
+         %29 = OpTypeInt 32 0
+         %30 = OpConstant %29 1
+         %31 = OpTypePointer Input %6
+         %34 = OpConstant %6 -1
+         %39 = OpTypeInt 32 1
+         %40 = OpTypeStruct %39
+         %41 = OpTypePointer Function %40
+         %43 = OpConstant %39 0
+         %44 = OpTypePointer Function %39
+         %47 = OpConstant %39 1
+         %63 = OpConstantComposite %17 %20 %20 %20 %20
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %42 = OpVariable %41 Function
+         %49 = OpVariable %8 Function
+         %56 = OpVariable %8 Function
+         %58 = OpVariable %8 Function
+               OpStore %19 %22
+               OpBranch %23
+         %23 = OpLabel
+               OpLoopMerge %25 %26 None
+               OpBranch %24
+         %24 = OpLabel
+         %32 = OpAccessChain %31 %28 %30
+         %33 = OpLoad %6 %32
+         %35 = OpFOrdGreaterThan %9 %33 %34
+               OpSelectionMerge %37 None
+               OpBranchConditional %35 %36 %37
+         %36 = OpLabel
+               OpReturn
+         %37 = OpLabel
+               OpBranch %26
+         %26 = OpLabel
+         %45 = OpAccessChain %44 %42 %43
+         %46 = OpLoad %39 %45
+         %48 = OpINotEqual %9 %46 %47
+               OpBranchConditional %48 %23 %25
+         %25 = OpLabel
+         %51 = OpLoad %39 %45
+         %52 = OpConvertSToF %6 %51
+         %53 = OpCompositeConstruct %7 %20 %52
+         %54 = OpLoad %7 %49
+         %55 = OpFAdd %7 %54 %53
+               OpStore %49 %55
+         %57 = OpLoad %7 %49
+               OpStore %56 %57
+         %59 = OpLoad %7 %56
+               OpStore %58 %59
+         %60 = OpFunctionCall %9 %12 %58
+               OpStore %19 %63
+               OpReturn
+               OpFunctionEnd
+         %12 = OpFunction %9 None %10
+         %11 = OpFunctionParameter %8
+         %13 = OpLabel
+               OpReturnValue %14
+               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
index 77b69f3..928bacd 100644 (file)
@@ -57,6 +57,7 @@ void createAmberTests (tcu::TestCaseGroup* group)
                {       "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"                                                                },
                {       "do-while-loop-in-conditionals.amber",                  "do-while-loop-in-conditionals",                "A fragment shader with do-while loop in conditional nest"                                                              },
+               {       "do-while-with-always-true-if.amber",                   "do-while-with-always-true-if",                 "A fragment shader with a do while that always returns"                                                                 },
                {       "early-return-and-barrier.amber",                               "early-return-and-barrier",                             "A compute shader with an early return and a barrier"                                                                   },
                {       "for-condition-always-false.amber",                             "for-condition-always-false",                   "A fragment shader that uses a for loop with condition always false"                                    },
                {       "for-with-ifs-and-return.amber",                                "for-with-ifs-and-return",                              "A fragment shader with two ifs and return/continue inside a for loop"                                  },
index 352b4e8..c89cb2c 100644 (file)
@@ -521851,6 +521851,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.do-while-loop-in-conditionals
+dEQP-VK.graphicsfuzz.do-while-with-always-true-if
 dEQP-VK.graphicsfuzz.early-return-and-barrier
 dEQP-VK.graphicsfuzz.for-condition-always-false
 dEQP-VK.graphicsfuzz.for-with-ifs-and-return
index 045ab6c..f0d39cf 100644 (file)
@@ -521698,6 +521698,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.do-while-loop-in-conditionals
+dEQP-VK.graphicsfuzz.do-while-with-always-true-if
 dEQP-VK.graphicsfuzz.early-return-and-barrier
 dEQP-VK.graphicsfuzz.for-condition-always-false
 dEQP-VK.graphicsfuzz.for-with-ifs-and-return