dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
authorVenni Ihanakangas <venni.ihanakangas@siru.fi>
Wed, 9 Oct 2019 06:51:49 +0000 (09:51 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 25 Oct 2019 14:50:27 +0000 (10:50 -0400)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.return-before-writing-wrong-color

Change-Id: Id37174663e6573c0c17c9b2141570cacff52bff9

android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.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 32d9ea7..633e001 100644 (file)
@@ -519525,6 +519525,7 @@ 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
+dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
 dEQP-VK.graphicsfuzz.return-in-loop-in-function
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.struct-used-as-temporary
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/return-before-writing-wrong-color.amber
new file mode 100644 (file)
index 0000000..8f93abe
--- /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 fragment shader with return before writing wrong color
+
+# The test passes because the shader always writes color red.
+# Main writes red and returns. Code after writing red is never executed.
+
+# Optimized using spirv-opt with the following arguments:
+# '--private-to-local'
+# '--eliminate-local-multi-store'
+# '--redundancy-elimination'
+# '--eliminate-dead-code-aggressive'
+# '--simplify-instructions'
+# '--eliminate-dead-branches'
+# '--merge-blocks'
+# '--reduce-load-size'
+# '--combine-access-chains'
+# '--combine-access-chains'
+# '--eliminate-dead-branches'
+# '--ccp'
+# '--redundancy-elimination'
+# '--simplify-instructions'
+# '--vector-dce'
+# '--ccp'
+# '--private-to-local'
+# '--eliminate-dead-inserts'
+# spirv-opt commit hash: ad7f2c5c4c7f51360e9e079109a9217aa5ba5cc0
+
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+# variant_fragment_shader is derived from the following GLSL:
+# #version 310 es
+# precision highp float;
+#
+# precision highp int;
+#
+# struct _GLF_struct_0
+# {
+#   int msb9;
+# };
+#
+# layout(location = 0) out vec4 _GLF_color;
+#
+# void main()
+# {
+#   _GLF_struct_0 _GLF_struct_replacement_0;
+#
+#   do
+#   {
+#     for (int j = 0; 1 < findLSB(1024); 1)
+#     {
+#       _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red
+#       return; // We always return here. The code below is never executed.
+#     }
+#   } while (_GLF_struct_replacement_0.msb9 > 1);
+#   _GLF_color = vec4(1.0, 1.0, _GLF_struct_replacement_0.msb9, 1.0);
+# }
+SHADER fragment variant_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 42
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %27
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 310
+               OpName %4 "main"
+               OpName %27 "_GLF_color"
+               OpName %32 "_GLF_struct_0"
+               OpMemberName %32 0 "msb9"
+               OpName %34 "_GLF_struct_replacement_0"
+               OpDecorate %21 RelaxedPrecision
+               OpDecorate %27 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+         %10 = OpTypeInt 32 1
+         %11 = OpTypePointer Function %10
+         %13 = OpConstant %10 0
+         %19 = OpConstant %10 1
+         %20 = OpConstant %10 1024
+         %22 = OpTypeBool
+         %24 = OpTypeFloat 32
+         %25 = OpTypeVector %24 4
+         %26 = OpTypePointer Output %25
+         %27 = OpVariable %26 Output
+         %28 = OpConstant %24 1
+         %29 = OpConstant %24 0
+         %30 = OpConstantComposite %25 %28 %29 %29 %28
+         %32 = OpTypeStruct %10
+         %33 = OpTypePointer Function %32
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %34 = OpVariable %33 Function
+               OpBranch %6
+          %6 = OpLabel
+               OpLoopMerge %8 %16 None
+               OpBranch %14
+         %14 = OpLabel
+         %21 = OpExtInst %10 %1 FindILsb %20
+         %23 = OpSLessThan %22 %19 %21
+               OpLoopMerge %16 %17 None
+               OpBranchConditional %23 %15 %16
+         %15 = OpLabel
+               OpStore %27 %30
+               OpReturn
+         %17 = OpLabel
+               OpBranch %14
+         %16 = OpLabel
+         %35 = OpAccessChain %11 %34 %13
+         %36 = OpLoad %10 %35
+         %37 = OpSGreaterThan %22 %36 %19
+               OpBranchConditional %37 %6 %8
+          %8 = OpLabel
+         %39 = OpLoad %10 %35
+         %40 = OpConvertSToF %24 %39
+         %41 = OpCompositeConstruct %25 %28 %28 %40 %28
+               OpStore %27 %41
+               OpReturn
+               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 0ef93ee..0ebd919 100644 (file)
@@ -74,6 +74,7 @@ void createAmberTests (tcu::TestCaseGroup* group)
                {       "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"                                                                                                               },
+               {       "return-before-writing-wrong-color.amber",              "return-before-writing-wrong-color",    "A fragment shader with return before writing wrong color"                                                              },
                {       "return-in-loop-in-function.amber",                             "return-in-loop-in-function",                   "A fragment shader with early return from loop in function"                                                             },
                {       "similar-nested-ifs.amber",                                             "similar-nested-ifs",                                   "A fragment shader with similar nested ifs and loops"                                                                   },
                {       "struct-used-as-temporary.amber",                               "struct-used-as-temporary",                             "A fragment shader that uses a temporary struct variable"                                                               },
index 9413b06..51d3a17 100644 (file)
@@ -521868,6 +521868,7 @@ 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
+dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
 dEQP-VK.graphicsfuzz.return-in-loop-in-function
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.struct-used-as-temporary
index 05a1554..4cd09eb 100644 (file)
@@ -521715,6 +521715,7 @@ 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
+dEQP-VK.graphicsfuzz.return-before-writing-wrong-color
 dEQP-VK.graphicsfuzz.return-in-loop-in-function
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.struct-used-as-temporary