dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop
Components: Vulkan
New Tests:
dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop
Change-Id: I87cbd5e5f9b0d27f9d875a1ca31d3c7aa12cb433
diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt
index 4cc9238..4d84a70 100644
--- a/android/cts/master/vk-master.txt
+++ b/android/cts/master/vk-master.txt
Binary files differ
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber
new file mode 100644
index 0000000..10bf2dd
--- /dev/null
+++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/disc-and-add-in-func-in-loop.amber
@@ -0,0 +1,192 @@
+#!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 discard and add in function in loop
+
+# The test passes because main always outputs the color red and returns.
+# red() has an unreachable discard and adds zero to the returned value.
+
+# 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;
+#
+# layout(location = 0) out vec4 _GLF_color;
+#
+# layout(set = 0, binding = 0) uniform buf0 {
+# vec2 injectionSwitch;
+# };
+#
+# vec4 red()
+# {
+# if(injectionSwitch.x > 0.0) // always false
+# discard;
+#
+# return vec4(1.0, 0.0, 0.0, 1.0) + injectionSwitch.x; // add zero
+# }
+#
+# void main()
+# {
+# while(true)
+# {
+# while(injectionSwitch.y > 0.0) // always true
+# {
+# _GLF_color = red();
+# return;
+# }
+# }
+# }
+SHADER fragment variant_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 101
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %52
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 310
+ OpName %4 "main"
+ OpName %12 "buf0"
+ OpMemberName %12 0 "injectionSwitch"
+ OpName %14 ""
+ OpName %52 "_GLF_color"
+ OpMemberDecorate %12 0 Offset 0
+ OpDecorate %12 Block
+ OpDecorate %14 DescriptorSet 0
+ OpDecorate %14 Binding 0
+ OpDecorate %52 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 4
+ %11 = OpTypeVector %6 2
+ %12 = OpTypeStruct %11
+ %13 = OpTypePointer Uniform %12
+ %14 = OpVariable %13 Uniform
+ %15 = OpTypeInt 32 1
+ %16 = OpConstant %15 0
+ %17 = OpTypeInt 32 0
+ %18 = OpConstant %17 0
+ %19 = OpTypePointer Uniform %6
+ %22 = OpConstant %6 0
+ %23 = OpTypeBool
+ %28 = OpConstant %6 1
+ %29 = OpConstantComposite %7 %28 %22 %22 %28
+ %41 = OpConstantTrue %23
+ %47 = OpConstant %17 1
+ %51 = OpTypePointer Output %7
+ %52 = OpVariable %51 Output
+ %63 = OpConstantFalse %23
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ OpBranch %60
+ %60 = OpLabel
+ OpLoopMerge %59 %62 None
+ OpBranch %36
+ %36 = OpLabel
+ %100 = OpPhi %23 %63 %60 %98 %66
+ OpLoopMerge %38 %66 None
+ OpBranch %42
+ %42 = OpLabel
+ %48 = OpAccessChain %19 %14 %16 %47
+ %49 = OpLoad %6 %48
+ %50 = OpFOrdGreaterThan %23 %49 %22
+ OpLoopMerge %44 %45 None
+ OpBranchConditional %50 %43 %44
+ %43 = OpLabel
+ OpBranch %81
+ %81 = OpLabel
+ OpLoopMerge %82 %83 None
+ OpBranch %84
+ %84 = OpLabel
+ %85 = OpAccessChain %19 %14 %16 %18
+ %86 = OpLoad %6 %85
+ %87 = OpFOrdGreaterThan %23 %86 %22
+ OpSelectionMerge %88 None
+ OpBranchConditional %87 %89 %88
+ %89 = OpLabel
+ %90 = OpFunctionCall %2 %55
+ %91 = OpUndef %7
+ OpBranch %82
+ %88 = OpLabel
+ %94 = OpCompositeConstruct %7 %86 %86 %86 %86
+ %95 = OpFAdd %7 %29 %94
+ OpBranch %82
+ %83 = OpLabel
+ OpBranch %81
+ %82 = OpLabel
+ %97 = OpPhi %7 %91 %89 %95 %88
+ OpStore %52 %97
+ OpBranch %44
+ %45 = OpLabel
+ OpBranch %42
+ %44 = OpLabel
+ %98 = OpPhi %23 %100 %42 %41 %82
+ OpSelectionMerge %66 None
+ OpBranchConditional %98 %38 %66
+ %66 = OpLabel
+ OpBranch %36
+ %38 = OpLabel
+ OpSelectionMerge %68 None
+ OpBranchConditional %98 %59 %68
+ %68 = OpLabel
+ OpBranch %59
+ %62 = OpLabel
+ OpBranch %60
+ %59 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %55 = OpFunction %2 None %3
+ %56 = OpLabel
+ OpKill
+ 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
diff --git a/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp b/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp
index f878701..e2acf98 100644
--- a/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp
+++ b/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp
@@ -53,6 +53,7 @@
{ "control-flow-switch.amber", "control-flow-switch", "A fragment shader with somewhat complex control flow and a switch" },
{ "dead-barriers-in-loops.amber", "dead-barriers-in-loops", "A compute shader with dead barriers" },
{ "dead-struct-init.amber", "dead-struct-init", "A fragment shader that uses struct initializers" },
+ { "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" },
{ "early-return-and-barrier.amber", "early-return-and-barrier", "A compute shader with an early return and a barrier" },
diff --git a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt
index 41b9011..ebabcd5 100644
--- a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt
+++ b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt
Binary files differ
diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt
index ce881eb..ccd9a10 100644
--- a/external/vulkancts/mustpass/master/vk-default.txt
+++ b/external/vulkancts/mustpass/master/vk-default.txt
Binary files differ