From 21886620cba46d25ba9b3e926a9648d156c6c493 Mon Sep 17 00:00:00 2001 From: Paul Thomson Date: Sun, 1 Sep 2019 20:44:00 +0100 Subject: [PATCH] dEQP-VK.graphicsfuzz.two-loops-matrix Components: Vulkan New Tests: dEQP-VK.graphicsfuzz.two-loops-matrix Change-Id: I342e971350d2becbc69dcce9fef38863e251ccd9 --- android/cts/master/vk-master.txt | 1 + .../amber/graphicsfuzz/two-loops-matrix.amber | 212 +++++++++++++++++++++ .../vulkan/amber/vktAmberGraphicsFuzzTests.cpp | 1 + .../mustpass/master/vk-default-no-waivers.txt | 1 + external/vulkancts/mustpass/master/vk-default.txt | 1 + 5 files changed, 216 insertions(+) create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/two-loops-matrix.amber diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index e96290b..137c73d 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -484090,6 +484090,7 @@ dEQP-VK.graphicsfuzz.return-in-loop-in-function dEQP-VK.graphicsfuzz.similar-nested-ifs dEQP-VK.graphicsfuzz.struct-used-as-temporary dEQP-VK.graphicsfuzz.swizzle-struct-init-min +dEQP-VK.graphicsfuzz.two-loops-matrix dEQP-VK.graphicsfuzz.two-loops-set-struct dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops dEQP-VK.graphicsfuzz.unreachable-loops diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/two-loops-matrix.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/two-loops-matrix.amber new file mode 100644 index 0000000..dca2215 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/two-loops-matrix.amber @@ -0,0 +1,212 @@ +#!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 loops and some matrices + +# The test passes because the fragment shader always writes red; the loops do nothing. +# The second loop condition is always false. + +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 +# { +# mat4 matrix_a_uni; +# }; +# void main() +# { +# vec4 matrix_b; +# vec4 matrix_u; +# for ( +# int x = 4; +# x >= 1; +# x--) +# { +# matrix_u[x] = 1.0; +# } +# for ( +# int b = 4; +# matrix_a_uni[0][0] < -1.0; +# b--) +# { +# matrix_b[b] = (b > 1 ? min(matrix_b, matrix_b) : matrix_u)[1]; +# } +# _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: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %66 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %22 "matrix_u" + OpName %29 "b" + OpName %36 "buf0" + OpMemberName %36 0 "matrix_a_uni" + OpName %38 "" + OpName %47 "matrix_b" + OpName %66 "_GLF_color" + OpDecorate %8 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpMemberDecorate %36 0 ColMajor + OpMemberDecorate %36 0 Offset 0 + OpMemberDecorate %36 0 MatrixStride 16 + OpDecorate %36 Block + OpDecorate %38 DescriptorSet 0 + OpDecorate %38 Binding 0 + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %66 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %16 = OpConstant %6 1 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Function %20 + %24 = OpConstant %19 1 + %25 = OpTypePointer Function %19 + %35 = OpTypeMatrix %20 4 + %36 = OpTypeStruct %35 + %37 = OpTypePointer Uniform %36 + %38 = OpVariable %37 Uniform + %39 = OpConstant %6 0 + %40 = OpTypeInt 32 0 + %41 = OpConstant %40 0 + %42 = OpTypePointer Uniform %19 + %45 = OpConstant %19 -1 + %59 = OpConstant %40 1 + %65 = OpTypePointer Output %20 + %66 = OpVariable %65 Output + %67 = OpConstant %19 0 + %68 = OpConstantComposite %20 %24 %67 %67 %24 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %21 Function + %29 = OpVariable %7 Function + %47 = OpVariable %21 Function + %51 = OpVariable %21 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSGreaterThanEqual %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %23 = OpLoad %6 %8 + %26 = OpAccessChain %25 %22 %23 + OpStore %26 %24 + OpBranch %13 + %13 = OpLabel + %27 = OpLoad %6 %8 + %28 = OpISub %6 %27 %16 + OpStore %8 %28 + OpBranch %10 + %12 = OpLabel + OpStore %29 %9 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %43 = OpAccessChain %42 %38 %39 %39 %41 + %44 = OpLoad %19 %43 + %46 = OpFOrdLessThan %17 %44 %45 + OpBranchConditional %46 %31 %32 + %31 = OpLabel + %48 = OpLoad %6 %29 + %49 = OpLoad %6 %29 + %50 = OpSGreaterThan %17 %49 %16 + OpSelectionMerge %53 None + OpBranchConditional %50 %52 %57 + %52 = OpLabel + %54 = OpLoad %20 %47 + %55 = OpLoad %20 %47 + %56 = OpExtInst %20 %1 FMin %54 %55 + OpStore %51 %56 + OpBranch %53 + %57 = OpLabel + %58 = OpLoad %20 %22 + OpStore %51 %58 + OpBranch %53 + %53 = OpLabel + %60 = OpAccessChain %25 %51 %59 + %61 = OpLoad %19 %60 + %62 = OpAccessChain %25 %47 %48 + OpStore %62 %61 + OpBranch %33 + %33 = OpLabel + %63 = OpLoad %6 %29 + %64 = OpISub %6 %63 %16 + OpStore %29 %64 + OpBranch %30 + %32 = OpLabel + OpStore %66 %68 + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# matrix_a_uni +BUFFER variant_matrix_a_uni DATA_TYPE mat4x4 DATA + 1.0 5.0 3.0 7.0 9.0 6.0 7.0 8.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.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_matrix_a_uni 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 b8c80a6..cf1ada6 100644 --- a/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp +++ b/external/vulkancts/modules/vulkan/amber/vktAmberGraphicsFuzzTests.cpp @@ -75,6 +75,7 @@ void createAmberTests (tcu::TestCaseGroup* group) { "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" }, { "swizzle-struct-init-min.amber", "swizzle-struct-init-min", "A fragment shader that uses vector swizzles, struct initializers, and min" }, + { "two-loops-matrix.amber", "two-loops-matrix", "A fragment shader with two loops and some matrices" }, { "two-loops-set-struct.amber", "two-loops-set-struct", "A fragment shader with two loops that write to a struct" }, { "unreachable-barrier-in-loops.amber", "unreachable-barrier-in-loops", "A compute shader with an unreachable barrier in a loop nest" }, { "unreachable-loops.amber", "unreachable-loops", "Fragment shader that writes red despite unreachable loops" }, diff --git a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt index 479e202..c9fc295 100644 --- a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt +++ b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt @@ -486236,6 +486236,7 @@ dEQP-VK.graphicsfuzz.return-in-loop-in-function dEQP-VK.graphicsfuzz.similar-nested-ifs dEQP-VK.graphicsfuzz.struct-used-as-temporary dEQP-VK.graphicsfuzz.swizzle-struct-init-min +dEQP-VK.graphicsfuzz.two-loops-matrix dEQP-VK.graphicsfuzz.two-loops-set-struct dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops dEQP-VK.graphicsfuzz.unreachable-loops diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt index b88d6c2..44d750a 100644 --- a/external/vulkancts/mustpass/master/vk-default.txt +++ b/external/vulkancts/mustpass/master/vk-default.txt @@ -486083,6 +486083,7 @@ dEQP-VK.graphicsfuzz.return-in-loop-in-function dEQP-VK.graphicsfuzz.similar-nested-ifs dEQP-VK.graphicsfuzz.struct-used-as-temporary dEQP-VK.graphicsfuzz.swizzle-struct-init-min +dEQP-VK.graphicsfuzz.two-loops-matrix dEQP-VK.graphicsfuzz.two-loops-set-struct dEQP-VK.graphicsfuzz.unreachable-barrier-in-loops dEQP-VK.graphicsfuzz.unreachable-loops -- 2.7.4