dEQP-VK.graphicsfuzz.nested-for-loops-with-return
authorIlkka Saarelainen <ilkka.saarelainen@siru.fi>
Tue, 17 Sep 2019 12:40:40 +0000 (15:40 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 4 Oct 2019 09:39:30 +0000 (05:39 -0400)
Components: Vulkan

New tests:

dEQP-VK.graphicsfuzz.nested-for-loops-with-return

Change-Id: I9cb56f58d4e78d6e5ee10ee8c3119602408daf2a

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.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 b591f22..eba9b02 100644 (file)
@@ -484404,6 +484404,7 @@ dEQP-VK.graphicsfuzz.mat-array-distance
 dEQP-VK.graphicsfuzz.matrices-and-return-in-loop
 dEQP-VK.graphicsfuzz.max-mix-conditional-discard
 dEQP-VK.graphicsfuzz.mix-floor-add
+dEQP-VK.graphicsfuzz.nested-for-loops-with-return
 dEQP-VK.graphicsfuzz.nested-ifs-and-return-in-for-loop
 dEQP-VK.graphicsfuzz.nested-loops-switch
 dEQP-VK.graphicsfuzz.pow-vec4
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-for-loops-with-return.amber
new file mode 100644 (file)
index 0000000..d36cb29
--- /dev/null
@@ -0,0 +1,196 @@
+#!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 two nested for loops with return
+
+# The test passes because the shader always writes the color red.
+
+# Optimized using spirv-opt with the following arguments:
+# '--private-to-local'
+# '--if-conversion'
+# '--eliminate-dead-inserts'
+# '--eliminate-dead-branches'
+# '--reduce-load-size'
+# '--vector-dce'
+# '--ccp'
+# '--redundancy-elimination'
+# '--convert-local-access-chains'
+# '--eliminate-dead-inserts'
+# '--ccp'
+# '--eliminate-dead-branches'
+# '--merge-blocks'
+# '--eliminate-local-single-block'
+# '--eliminate-local-single-block'
+# '--copy-propagate-arrays'
+# '--inline-entry-points-exhaustive'
+# '--ccp'
+# '--eliminate-local-multi-store'
+# '--inline-entry-points-exhaustive'
+# '--reduce-load-size'
+# '--ccp'
+# '--eliminate-local-single-block'
+# '--eliminate-dead-branches'
+# 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;
+#
+# float nb_mod(float limit)
+# {
+#   if (float(1) >= limit)
+#   {
+#     return 1.0;
+#   }
+#   for (
+#       int _injected_loop_counter = 0;
+#       _injected_loop_counter < 2;
+#       ++_injected_loop_counter)
+#   {
+#     for (
+#         int _injected_loop_counter = 0;
+#         _injected_loop_counter < 1;
+#         ++_injected_loop_counter)
+#     {
+#       return 1.0;
+#     }
+#   }
+# }
+# void main()
+# {
+#   nb_mod(gl_FragCoord.x);
+#   _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: 65
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %48 %57
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %10 "nb_mod(f1;"
+               OpName %9 "limit"
+               OpName %21 "_injected_loop_counter"
+               OpName %31 "_injected_loop_counter"
+               OpName %48 "gl_FragCoord"
+               OpName %49 "param"
+               OpName %57 "_GLF_color"
+               OpDecorate %21 RelaxedPrecision
+               OpDecorate %31 RelaxedPrecision
+               OpDecorate %48 BuiltIn FragCoord
+               OpDecorate %57 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypePointer Function %6
+          %8 = OpTypeFunction %6 %7
+         %12 = OpConstant %6 1
+         %14 = OpTypeBool
+         %19 = OpTypeInt 32 1
+         %20 = OpTypePointer Function %19
+         %22 = OpConstant %19 0
+         %29 = OpConstant %19 2
+         %38 = OpConstant %19 1
+         %46 = OpTypeVector %6 4
+         %47 = OpTypePointer Input %46
+         %48 = OpVariable %47 Input
+         %50 = OpTypeInt 32 0
+         %51 = OpConstant %50 0
+         %52 = OpTypePointer Input %6
+         %56 = OpTypePointer Output %46
+         %57 = OpVariable %56 Output
+         %58 = OpConstant %6 0
+         %59 = OpConstantComposite %46 %12 %58 %58 %12
+         %63 = OpUndef %19
+         %64 = OpConstantTrue %14
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %49 = OpVariable %7 Function
+         %53 = OpAccessChain %52 %48 %51
+         %54 = OpLoad %6 %53
+               OpStore %49 %54
+         %55 = OpFunctionCall %6 %10 %49
+               OpStore %57 %59
+               OpReturn
+               OpFunctionEnd
+         %10 = OpFunction %6 None %8
+          %9 = OpFunctionParameter %7
+         %11 = OpLabel
+         %21 = OpVariable %20 Function
+         %31 = OpVariable %20 Function
+         %13 = OpLoad %6 %9
+         %15 = OpFOrdGreaterThanEqual %14 %12 %13
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %16 %17
+         %16 = OpLabel
+               OpReturnValue %12
+         %17 = OpLabel
+               OpStore %21 %22
+               OpBranch %23
+         %23 = OpLabel
+         %30 = OpSLessThan %14 %22 %29
+               OpLoopMerge %25 %34 None
+               OpBranch %24
+         %24 = OpLabel
+               OpStore %31 %22
+               OpBranch %32
+         %32 = OpLabel
+         %39 = OpSLessThan %14 %22 %38
+               OpLoopMerge %34 %35 None
+               OpBranch %33
+         %33 = OpLabel
+               OpReturnValue %12
+         %35 = OpLabel
+               OpBranch %32
+         %34 = OpLabel
+               OpBranch %23
+         %25 = OpLabel
+               OpUnreachable
+               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 b17cf6f..8c7dd46 100644 (file)
@@ -68,6 +68,7 @@ void createAmberTests (tcu::TestCaseGroup* group)
                {       "matrices-and-return-in-loop.amber",                    "matrices-and-return-in-loop",                  "A fragment shader with matrices and a return in a loop"                                                                },
                {       "max-mix-conditional-discard.amber",                    "max-mix-conditional-discard",                  "A fragment shader with an expression used in two discard guards"                                               },
                {       "mix-floor-add.amber",                                                  "mix-floor-add",                                                "A fragment shader with mix, uintBitsToFloat, and floor"                                                                },
+               {       "nested-for-loops-with-return.amber",                   "nested-for-loops-with-return",                 "A fragment shader with two nested for loops with return"                                                               },
                {       "nested-ifs-and-return-in-for-loop.amber",              "nested-ifs-and-return-in-for-loop",    "A fragment shader with return in nest of ifs, inside loop"                                                             },
                {       "nested-loops-switch.amber",                                    "nested-loops-switch",                                  "A fragment shader with nested loops and a switch"                                                                              },
                {       "pow-vec4.amber",                                                               "pow-vec4",                                                             "A fragment shader that uses pow"                                                                                                               },
index fe33394..7c183ef 100644 (file)
@@ -486553,6 +486553,7 @@ dEQP-VK.graphicsfuzz.mat-array-distance
 dEQP-VK.graphicsfuzz.matrices-and-return-in-loop
 dEQP-VK.graphicsfuzz.max-mix-conditional-discard
 dEQP-VK.graphicsfuzz.mix-floor-add
+dEQP-VK.graphicsfuzz.nested-for-loops-with-return
 dEQP-VK.graphicsfuzz.nested-ifs-and-return-in-for-loop
 dEQP-VK.graphicsfuzz.nested-loops-switch
 dEQP-VK.graphicsfuzz.pow-vec4
index 9884315..0b2a213 100644 (file)
@@ -486400,6 +486400,7 @@ dEQP-VK.graphicsfuzz.mat-array-distance
 dEQP-VK.graphicsfuzz.matrices-and-return-in-loop
 dEQP-VK.graphicsfuzz.max-mix-conditional-discard
 dEQP-VK.graphicsfuzz.mix-floor-add
+dEQP-VK.graphicsfuzz.nested-for-loops-with-return
 dEQP-VK.graphicsfuzz.nested-ifs-and-return-in-for-loop
 dEQP-VK.graphicsfuzz.nested-loops-switch
 dEQP-VK.graphicsfuzz.pow-vec4