From 308e466f65c2bf6eed97c5603b2551aac921a1ed Mon Sep 17 00:00:00 2001 From: Venni Ihanakangas Date: Wed, 2 Oct 2019 09:58:18 +0300 Subject: [PATCH] dEQP-VK.graphicsfuzz.unreachable-discard-statement Components: Vulkan New Tests: dEQP-VK.graphicsfuzz.unreachable-discard-statement Change-Id: If693c48dbeee308c613c110bab93ed22c8282d8f --- android/cts/master/vk-master.txt | 1 + .../unreachable-discard-statement.amber | 196 +++++++++++++++++++++ .../vulkan/amber/vktAmberGraphicsFuzzTests.cpp | 1 + .../mustpass/master/vk-default-no-waivers.txt | 1 + external/vulkancts/mustpass/master/vk-default.txt | 1 + 5 files changed, 200 insertions(+) create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index 223c21f..bc81b70 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -519538,6 +519538,7 @@ dEQP-VK.graphicsfuzz.two-loops-with-break dEQP-VK.graphicsfuzz.two-nested-do-whiles dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops dEQP-VK.graphicsfuzz.unreachable-continue-statement +dEQP-VK.graphicsfuzz.unreachable-discard-statement dEQP-VK.graphicsfuzz.unreachable-loops dEQP-VK.graphicsfuzz.unreachable-loops-in-switch dEQP-VK.graphicsfuzz.unreachable-return-in-loop diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber new file mode 100644 index 0000000..70908b0 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-discard-statement.amber @@ -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 unreachable discard statement + +# The test passes because the shader always writes the color red. The discard statement is never reached. + +# Optimized using spirv-opt with the following arguments: +# '--scalar-replacement=100' +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--private-to-local' +# '--copy-propagate-arrays' +# '--scalar-replacement=100' +# '--combine-access-chains' +# '--vector-dce' +# '--convert-local-access-chains' +# '--if-conversion' +# '--eliminate-dead-branches' +# '--merge-return' +# '--ccp' +# '--eliminate-dead-branches' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--combine-access-chains' +# '--eliminate-local-single-block' +# '--copy-propagate-arrays' +# '--ccp' +# '--private-to-local' +# '--private-to-local' +# 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; +# +# vec3 mand() +# { +# for (int k = 0; k < 1000; k++) +# return vec3(1.0); +# +# discard; // This statement is never reached +# return vec3(1.0); +# } +# +# void main() +# { +# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); +# +# for (int i = 0; i < 4; i++) +# mand(); +# +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %35 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "mand(" + OpName %13 "k" + OpName %35 "_GLF_color" + OpName %38 "i" + OpDecorate %13 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %35 Location 0 + OpDecorate %38 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 3 + %8 = OpTypeFunction %7 + %11 = OpTypeInt 32 1 + %12 = OpTypePointer Function %11 + %14 = OpConstant %11 0 + %21 = OpConstant %11 1000 + %22 = OpTypeBool + %24 = OpConstant %6 1 + %25 = OpConstantComposite %7 %24 %24 %24 + %28 = OpConstant %11 1 + %33 = OpTypeVector %6 4 + %34 = OpTypePointer Output %33 + %35 = OpVariable %34 Output + %36 = OpConstant %6 0 + %37 = OpConstantComposite %33 %24 %36 %36 %24 + %45 = OpConstant %11 4 + %51 = OpTypePointer Function %7 + %57 = OpConstantFalse %22 + %58 = OpTypePointer Function %22 + %60 = OpConstantTrue %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %38 = OpVariable %12 Function + OpStore %35 %37 + OpStore %38 %14 + OpBranch %39 + %39 = OpLabel + %44 = OpLoad %11 %38 + %46 = OpSLessThan %22 %44 %45 + OpLoopMerge %41 %40 None + OpBranchConditional %46 %40 %41 + %40 = OpLabel + %47 = OpFunctionCall %7 %9 + %48 = OpLoad %11 %38 + %49 = OpIAdd %11 %48 %28 + OpStore %38 %49 + OpBranch %39 + %41 = OpLabel + OpReturn + OpFunctionEnd + %9 = OpFunction %7 None %8 + %10 = OpLabel + %59 = OpVariable %58 Function %57 + %52 = OpVariable %51 Function + %13 = OpVariable %12 Function + OpBranch %54 + %54 = OpLabel + OpStore %13 %14 + OpLoopMerge %50 %56 None + OpBranch %15 + %15 = OpLabel + %20 = OpLoad %11 %13 + %23 = OpSLessThan %22 %20 %21 + OpLoopMerge %17 %18 None + OpBranchConditional %23 %16 %17 + %16 = OpLabel + OpStore %59 %60 + OpStore %52 %25 + OpBranch %17 + %18 = OpLabel + OpBranch %15 + %17 = OpLabel + %62 = OpLoad %22 %59 + OpSelectionMerge %61 None + OpBranchConditional %62 %50 %61 + %61 = OpLabel + OpKill + %56 = OpLabel + OpBranch %54 + %50 = OpLabel + %53 = OpLoad %7 %52 + OpReturnValue %53 + 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 diff --git a/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp b/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp index e4931c7..77b69f3 100644 --- a/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp +++ b/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp @@ -87,6 +87,7 @@ void createAmberTests (tcu::TestCaseGroup* group) { "two-nested-do-whiles.amber", "two-nested-do-whiles", "A fragment shader with nested do while" }, { "unreachable-barrier-in-loops.amber", "unreachable-barrier-in-loops", "A compute shader with an unreachable barrier in a loop nest" }, { "unreachable-continue-statement.amber", "unreachable-continue-statement", "A fragment shader with unreachable continue statement" }, + { "unreachable-discard-statement.amber", "unreachable-discard-statement", "A fragment shader with unreachable discard statement" }, { "unreachable-loops.amber", "unreachable-loops", "Fragment shader that writes red despite unreachable loops" }, { "unreachable-loops-in-switch.amber", "unreachable-loops-in-switch", "A fragment shader with unreachable loops in a switch" }, { "unreachable-return-in-loop.amber", "unreachable-return-in-loop", "A fragment shader with an unreachable return in a loop" }, diff --git a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt index 472abee..352b4e8 100644 --- a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt +++ b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt @@ -521881,6 +521881,7 @@ dEQP-VK.graphicsfuzz.two-loops-with-break dEQP-VK.graphicsfuzz.two-nested-do-whiles dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops dEQP-VK.graphicsfuzz.unreachable-continue-statement +dEQP-VK.graphicsfuzz.unreachable-discard-statement dEQP-VK.graphicsfuzz.unreachable-loops dEQP-VK.graphicsfuzz.unreachable-loops-in-switch dEQP-VK.graphicsfuzz.unreachable-return-in-loop diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt index 952b3ab..045ab6c 100644 --- a/external/vulkancts/mustpass/master/vk-default.txt +++ b/external/vulkancts/mustpass/master/vk-default.txt @@ -521728,6 +521728,7 @@ dEQP-VK.graphicsfuzz.two-loops-with-break dEQP-VK.graphicsfuzz.two-nested-do-whiles dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops dEQP-VK.graphicsfuzz.unreachable-continue-statement +dEQP-VK.graphicsfuzz.unreachable-discard-statement dEQP-VK.graphicsfuzz.unreachable-loops dEQP-VK.graphicsfuzz.unreachable-loops-in-switch dEQP-VK.graphicsfuzz.unreachable-return-in-loop -- 2.7.4