From a727746bce8f8352080c2b44bbe489f6c4112250 Mon Sep 17 00:00:00 2001 From: Ari Suonpaa Date: Tue, 3 Mar 2020 15:03:58 +0200 Subject: [PATCH] Added a second batch of coverage tests found by GraphicsFuzz New tests: dEQP-VK.graphicsfuzz.cov-basic-block-discard-in-function dEQP-VK.graphicsfuzz.cov-const-folding-clamp-inside-while dEQP-VK.graphicsfuzz.cov-const-folding-clamp-vs-original dEQP-VK.graphicsfuzz.cov-const-folding-min-as-loop-range dEQP-VK.graphicsfuzz.cov-constant-folding-atan-over-tanh dEQP-VK.graphicsfuzz.cov-dead-branch-func-return-arg dEQP-VK.graphicsfuzz.cov-fold-and-in-for-loop-range dEQP-VK.graphicsfuzz.cov-folding-clamp-cmp-const-first dEQP-VK.graphicsfuzz.cov-folding-rules-merge-div-mul dEQP-VK.graphicsfuzz.cov-folding-rules-merge-divs dEQP-VK.graphicsfuzz.cov-folding-rules-merge-mul-div dEQP-VK.graphicsfuzz.cov-folding-rules-negate-div dEQP-VK.graphicsfuzz.cov-inline-pass-return-in-loop dEQP-VK.graphicsfuzz.cov-machinevaluetype-one-iter-loop dEQP-VK.graphicsfuzz.cov-vector-log2-cosh Components: Vulkan Change-Id: Ifcb87053f5ff52ee5b0f7460f289e3e144e31a1a --- android/cts/master/vk-master-2020-03-01.txt | 15 + android/cts/master/vk-master.txt | 15 + .../cov-basic-block-discard-in-function.amber | 198 +++++++++++++ .../cov-const-folding-clamp-inside-while.amber | 142 +++++++++ .../cov-const-folding-clamp-vs-original.amber | 136 +++++++++ .../cov-const-folding-min-as-loop-range.amber | 217 ++++++++++++++ .../cov-constant-folding-atan-over-tanh.amber | 109 +++++++ .../cov-dead-branch-func-return-arg.amber | 328 +++++++++++++++++++++ .../cov-fold-and-in-for-loop-range.amber | 172 +++++++++++ .../cov-folding-clamp-cmp-const-first.amber | 155 ++++++++++ .../cov-folding-rules-merge-div-mul.amber | 138 +++++++++ .../cov-folding-rules-merge-divs.amber | 136 +++++++++ .../cov-folding-rules-merge-mul-div.amber | 138 +++++++++ .../cov-folding-rules-negate-div.amber | 130 ++++++++ .../cov-inline-pass-return-in-loop.amber | 165 +++++++++++ .../cov-machinevaluetype-one-iter-loop.amber | 177 +++++++++++ .../amber/graphicsfuzz/cov-vector-log2-cosh.amber | 114 +++++++ .../data/vulkan/amber/graphicsfuzz/index.txt | 15 + .../mustpass/master/vk-default-no-waivers.txt | 15 + external/vulkancts/mustpass/master/vk-default.txt | 15 + 20 files changed, 2530 insertions(+) create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber create mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber diff --git a/android/cts/master/vk-master-2020-03-01.txt b/android/cts/master/vk-master-2020-03-01.txt index 95fc358..013474f 100644 --- a/android/cts/master/vk-master-2020-03-01.txt +++ b/android/cts/master/vk-master-2020-03-01.txt @@ -183320,18 +183320,25 @@ dEQP-VK.graphicsfuzz.control-flow-in-function dEQP-VK.graphicsfuzz.control-flow-switch dEQP-VK.graphicsfuzz.cov-apfloat-determinant dEQP-VK.graphicsfuzz.cov-apfloat-tanh +dEQP-VK.graphicsfuzz.cov-basic-block-discard-in-function dEQP-VK.graphicsfuzz.cov-blockfrequency-several-for-loops dEQP-VK.graphicsfuzz.cov-const-folding-clamp +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-inside-while dEQP-VK.graphicsfuzz.cov-const-folding-clamp-max dEQP-VK.graphicsfuzz.cov-const-folding-clamp-min +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-vs-original dEQP-VK.graphicsfuzz.cov-const-folding-dot-condition-true dEQP-VK.graphicsfuzz.cov-const-folding-dot-determinant +dEQP-VK.graphicsfuzz.cov-const-folding-min-as-loop-range dEQP-VK.graphicsfuzz.cov-const-folding-vector-shuffle +dEQP-VK.graphicsfuzz.cov-constant-folding-atan-over-tanh dEQP-VK.graphicsfuzz.cov-constants-mix-uniform dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-func-argument dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-no-stores dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-param-uniform +dEQP-VK.graphicsfuzz.cov-dead-branch-func-return-arg dEQP-VK.graphicsfuzz.cov-dead-code-unreachable-merge +dEQP-VK.graphicsfuzz.cov-fold-and-in-for-loop-range dEQP-VK.graphicsfuzz.cov-fold-bitwise-and-zero dEQP-VK.graphicsfuzz.cov-fold-bitwise-or-full-mask dEQP-VK.graphicsfuzz.cov-fold-bitwise-xor @@ -183344,12 +183351,17 @@ dEQP-VK.graphicsfuzz.cov-fold-negate-variable dEQP-VK.graphicsfuzz.cov-fold-shift-gte32 dEQP-VK.graphicsfuzz.cov-fold-shift-right-arithmetic dEQP-VK.graphicsfuzz.cov-fold-switch-udiv +dEQP-VK.graphicsfuzz.cov-folding-clamp-cmp-const-first dEQP-VK.graphicsfuzz.cov-folding-rules-construct-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-no-extract dEQP-VK.graphicsfuzz.cov-folding-rules-merge-add-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-div-mul +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-divs +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-mul-div dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-add dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-negate-div dEQP-VK.graphicsfuzz.cov-folding-rules-redundant-mix dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-extract dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-mix @@ -183357,9 +183369,11 @@ dEQP-VK.graphicsfuzz.cov-folding-rules-split-vector-init dEQP-VK.graphicsfuzz.cov-if-conversion-identical-branches dEQP-VK.graphicsfuzz.cov-inline-pass-empty-block dEQP-VK.graphicsfuzz.cov-inline-pass-nested-loops +dEQP-VK.graphicsfuzz.cov-inline-pass-return-in-loop dEQP-VK.graphicsfuzz.cov-inline-pass-unreachable-func dEQP-VK.graphicsfuzz.cov-intervalmap-set-stop dEQP-VK.graphicsfuzz.cov-liveinterval-different-dest +dEQP-VK.graphicsfuzz.cov-machinevaluetype-one-iter-loop dEQP-VK.graphicsfuzz.cov-merge-return-condition-twice dEQP-VK.graphicsfuzz.cov-modf-integer-to-private dEQP-VK.graphicsfuzz.cov-reduce-load-replace-extract @@ -183369,6 +183383,7 @@ dEQP-VK.graphicsfuzz.cov-ssa-rewrite-case-with-default dEQP-VK.graphicsfuzz.cov-types-return-in-main-never-hit dEQP-VK.graphicsfuzz.cov-vector-dce-inc-unused-comp dEQP-VK.graphicsfuzz.cov-vector-dce-unused-component +dEQP-VK.graphicsfuzz.cov-vector-log2-cosh dEQP-VK.graphicsfuzz.dead-barriers-in-loops dEQP-VK.graphicsfuzz.dead-struct-init dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index 66ce113..10bce2c 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -579734,18 +579734,25 @@ dEQP-VK.graphicsfuzz.control-flow-in-function dEQP-VK.graphicsfuzz.control-flow-switch dEQP-VK.graphicsfuzz.cov-apfloat-determinant dEQP-VK.graphicsfuzz.cov-apfloat-tanh +dEQP-VK.graphicsfuzz.cov-basic-block-discard-in-function dEQP-VK.graphicsfuzz.cov-blockfrequency-several-for-loops dEQP-VK.graphicsfuzz.cov-const-folding-clamp +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-inside-while dEQP-VK.graphicsfuzz.cov-const-folding-clamp-max dEQP-VK.graphicsfuzz.cov-const-folding-clamp-min +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-vs-original dEQP-VK.graphicsfuzz.cov-const-folding-dot-condition-true dEQP-VK.graphicsfuzz.cov-const-folding-dot-determinant +dEQP-VK.graphicsfuzz.cov-const-folding-min-as-loop-range dEQP-VK.graphicsfuzz.cov-const-folding-vector-shuffle +dEQP-VK.graphicsfuzz.cov-constant-folding-atan-over-tanh dEQP-VK.graphicsfuzz.cov-constants-mix-uniform dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-func-argument dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-no-stores dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-param-uniform +dEQP-VK.graphicsfuzz.cov-dead-branch-func-return-arg dEQP-VK.graphicsfuzz.cov-dead-code-unreachable-merge +dEQP-VK.graphicsfuzz.cov-fold-and-in-for-loop-range dEQP-VK.graphicsfuzz.cov-fold-bitwise-and-zero dEQP-VK.graphicsfuzz.cov-fold-bitwise-or-full-mask dEQP-VK.graphicsfuzz.cov-fold-bitwise-xor @@ -579758,12 +579765,17 @@ dEQP-VK.graphicsfuzz.cov-fold-negate-variable dEQP-VK.graphicsfuzz.cov-fold-shift-gte32 dEQP-VK.graphicsfuzz.cov-fold-shift-right-arithmetic dEQP-VK.graphicsfuzz.cov-fold-switch-udiv +dEQP-VK.graphicsfuzz.cov-folding-clamp-cmp-const-first dEQP-VK.graphicsfuzz.cov-folding-rules-construct-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-no-extract dEQP-VK.graphicsfuzz.cov-folding-rules-merge-add-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-div-mul +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-divs +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-mul-div dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-add dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-negate-div dEQP-VK.graphicsfuzz.cov-folding-rules-redundant-mix dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-extract dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-mix @@ -579771,9 +579783,11 @@ dEQP-VK.graphicsfuzz.cov-folding-rules-split-vector-init dEQP-VK.graphicsfuzz.cov-if-conversion-identical-branches dEQP-VK.graphicsfuzz.cov-inline-pass-empty-block dEQP-VK.graphicsfuzz.cov-inline-pass-nested-loops +dEQP-VK.graphicsfuzz.cov-inline-pass-return-in-loop dEQP-VK.graphicsfuzz.cov-inline-pass-unreachable-func dEQP-VK.graphicsfuzz.cov-intervalmap-set-stop dEQP-VK.graphicsfuzz.cov-liveinterval-different-dest +dEQP-VK.graphicsfuzz.cov-machinevaluetype-one-iter-loop dEQP-VK.graphicsfuzz.cov-merge-return-condition-twice dEQP-VK.graphicsfuzz.cov-modf-integer-to-private dEQP-VK.graphicsfuzz.cov-reduce-load-replace-extract @@ -579783,6 +579797,7 @@ dEQP-VK.graphicsfuzz.cov-ssa-rewrite-case-with-default dEQP-VK.graphicsfuzz.cov-types-return-in-main-never-hit dEQP-VK.graphicsfuzz.cov-vector-dce-inc-unused-comp dEQP-VK.graphicsfuzz.cov-vector-dce-unused-component +dEQP-VK.graphicsfuzz.cov-vector-log2-cosh dEQP-VK.graphicsfuzz.dead-barriers-in-loops dEQP-VK.graphicsfuzz.dead-struct-init dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber new file mode 100644 index 0000000..f531e89 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-basic-block-discard-in-function.amber @@ -0,0 +1,198 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific basic block code path + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--vector-dce' +# '--combine-access-chains' +# '--eliminate-local-multi-store' +# '--scalar-replacement=100' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--simplify-instructions' +# '--eliminate-dead-branches' +# '--merge-blocks' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# layout(location = 0) out vec4 _GLF_color; +# +# int func(int x) +# { +# if (x == 10) // Always false. +# discard; +# +# return x; +# } +# +# void main() +# { +# int a = 0; +# int b = zero; +# +# do +# { +# a = func(b); +# b++; +# } +# while(b < 4); +# +# if (a == 3) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 59 +; 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 %10 "func(i1;" + OpName %9 "x" + OpName %22 "a" + OpName %24 "b" + OpName %25 "buf0" + OpMemberName %25 0 "zero" + OpName %27 "" + OpName %35 "param" + OpName %52 "_GLF_color" + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %52 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %13 = OpConstant %6 10 + %14 = OpTypeBool + %23 = OpConstant %6 0 + %25 = OpTypeStruct %6 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %39 = OpConstant %6 1 + %42 = OpConstant %6 4 + %45 = OpConstant %6 3 + %49 = OpTypeFloat 32 + %50 = OpTypeVector %49 4 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %53 = OpConstant %49 1 + %54 = OpConstant %49 0 + %55 = OpConstantComposite %50 %53 %54 %54 %53 + %57 = OpConstantComposite %50 %54 %54 %54 %54 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %7 Function + %24 = OpVariable %7 Function + %35 = OpVariable %7 Function + OpStore %22 %23 + %29 = OpAccessChain %28 %27 %23 + %30 = OpLoad %6 %29 + OpStore %24 %30 + OpBranch %31 + %31 = OpLabel + %58 = OpPhi %6 %30 %5 %40 %31 + OpStore %35 %58 + %37 = OpFunctionCall %6 %10 %35 + OpStore %22 %37 + %40 = OpIAdd %6 %58 %39 + OpStore %24 %40 + %43 = OpSLessThan %14 %40 %42 + OpLoopMerge %33 %31 None + OpBranchConditional %43 %31 %33 + %33 = OpLabel + %46 = OpIEqual %14 %37 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %47 %56 + %47 = OpLabel + OpStore %52 %55 + OpBranch %48 + %56 = OpLabel + OpStore %52 %57 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %12 = OpLoad %6 %9 + %15 = OpIEqual %14 %12 %13 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + OpKill + %17 = OpLabel + %19 = OpLoad %6 %9 + OpReturnValue %19 + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 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_zero 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/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber new file mode 100644 index 0000000..fc13b4a --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-inside-while.amber @@ -0,0 +1,142 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# int i = 0, j = 1; +# +# while(i < clamp(j, 5, 9)) +# { +# i++; +# j++; +# } +# +# if (i == 9 && j == 10) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %39 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "i" + OpName %10 "j" + OpName %39 "_GLF_color" + OpDecorate %39 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %11 = OpConstant %6 1 + %19 = OpConstant %6 5 + %20 = OpConstant %6 9 + %22 = OpTypeBool + %31 = OpConstant %6 10 + %36 = OpTypeFloat 32 + %37 = OpTypeVector %36 4 + %38 = OpTypePointer Output %37 + %39 = OpVariable %38 Output + %40 = OpConstant %36 1 + %41 = OpConstant %36 0 + %42 = OpConstantComposite %37 %40 %41 %41 %40 + %44 = OpConstantComposite %37 %41 %41 %41 %41 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %11 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %6 %8 + %18 = OpLoad %6 %10 + %21 = OpExtInst %6 %1 SClamp %18 %19 %20 + %23 = OpSLessThan %22 %17 %21 + OpBranchConditional %23 %13 %14 + %13 = OpLabel + %24 = OpLoad %6 %8 + %25 = OpIAdd %6 %24 %11 + OpStore %8 %25 + %26 = OpLoad %6 %10 + %27 = OpIAdd %6 %26 %11 + OpStore %10 %27 + OpBranch %15 + %15 = OpLabel + OpBranch %12 + %14 = OpLabel + %28 = OpLoad %6 %8 + %29 = OpIEqual %22 %28 %20 + %30 = OpLoad %6 %10 + %32 = OpIEqual %22 %30 %31 + %33 = OpLogicalAnd %22 %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %43 + %34 = OpLabel + OpStore %39 %42 + OpBranch %35 + %43 = OpLabel + OpStore %39 %44 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +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 +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/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber new file mode 100644 index 0000000..438ce50 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-clamp-vs-original.amber @@ -0,0 +1,136 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +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 +# { +# float one; +# }; +# +# void main() +# { +# _GLF_color = vec4(0); +# +# float f = clamp(one, 1.0, 1.0); +# +# if (f > one) // Always false. +# _GLF_color = vec4(0); +# else +# _GLF_color = vec4(f, 0, 0, 1); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "_GLF_color" + OpName %13 "f" + OpName %14 "buf0" + OpMemberName %14 0 "one" + OpName %16 "" + OpDecorate %9 Location 0 + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Output %7 + %9 = OpVariable %8 Output + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypePointer Function %6 + %14 = OpTypeStruct %6 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1 + %27 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %13 = OpVariable %12 Function + OpStore %9 %11 + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %23 = OpExtInst %6 %1 FClamp %21 %22 %22 + OpStore %13 %23 + %24 = OpLoad %6 %13 + %25 = OpAccessChain %19 %16 %18 + %26 = OpLoad %6 %25 + %28 = OpFOrdGreaterThan %27 %24 %26 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %31 + %29 = OpLabel + OpStore %9 %11 + OpBranch %30 + %31 = OpLabel + %32 = OpLoad %6 %13 + %33 = OpCompositeConstruct %7 %32 %10 %10 %22 + OpStore %9 %33 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 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_one 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/data/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber new file mode 100644 index 0000000..1e00033 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-const-folding-min-as-loop-range.amber @@ -0,0 +1,217 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int zero; +# }; +# +# void main() +# { +# int data[2]; +# int highSigned = 1; +# uint highUnsigned = 2u; +# +# for(int i = 0; i < min(10, highSigned) + zero; i++) +# data[i] = 5; +# +# for(uint i = 1u; i < min(10u, highUnsigned) + uint(zero); i++) +# data[i] = 6; +# +# if (data[0] == 5 && data[1] == 6) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %77 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "highSigned" + OpName %12 "highUnsigned" + OpName %14 "i" + OpName %25 "buf0" + OpMemberName %25 0 "zero" + OpName %27 "" + OpName %36 "data" + OpName %42 "i" + OpName %77 "_GLF_color" + OpMemberDecorate %25 0 Offset 0 + OpDecorate %25 Block + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %77 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpTypeInt 32 0 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 2 + %15 = OpConstant %6 0 + %22 = OpConstant %6 10 + %25 = OpTypeStruct %6 + %26 = OpTypePointer Uniform %25 + %27 = OpVariable %26 Uniform + %28 = OpTypePointer Uniform %6 + %32 = OpTypeBool + %34 = OpTypeArray %6 %13 + %35 = OpTypePointer Function %34 + %38 = OpConstant %6 5 + %43 = OpConstant %10 1 + %50 = OpConstant %10 10 + %59 = OpConstant %6 6 + %74 = OpTypeFloat 32 + %75 = OpTypeVector %74 4 + %76 = OpTypePointer Output %75 + %77 = OpVariable %76 Output + %78 = OpConstant %74 1 + %79 = OpConstant %74 0 + %80 = OpConstantComposite %75 %78 %79 %79 %78 + %82 = OpConstantComposite %75 %79 %79 %79 %79 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %12 = OpVariable %11 Function + %14 = OpVariable %7 Function + %36 = OpVariable %35 Function + %42 = OpVariable %11 Function + OpStore %8 %9 + OpStore %12 %13 + OpStore %14 %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %6 %14 + %23 = OpLoad %6 %8 + %24 = OpExtInst %6 %1 SMin %22 %23 + %29 = OpAccessChain %28 %27 %15 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %24 %30 + %33 = OpSLessThan %32 %21 %31 + OpBranchConditional %33 %17 %18 + %17 = OpLabel + %37 = OpLoad %6 %14 + %39 = OpAccessChain %7 %36 %37 + OpStore %39 %38 + OpBranch %19 + %19 = OpLabel + %40 = OpLoad %6 %14 + %41 = OpIAdd %6 %40 %9 + OpStore %14 %41 + OpBranch %16 + %18 = OpLabel + OpStore %42 %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %10 %42 + %51 = OpLoad %10 %12 + %52 = OpExtInst %10 %1 UMin %50 %51 + %53 = OpAccessChain %28 %27 %15 + %54 = OpLoad %6 %53 + %55 = OpBitcast %10 %54 + %56 = OpIAdd %10 %52 %55 + %57 = OpULessThan %32 %49 %56 + OpBranchConditional %57 %45 %46 + %45 = OpLabel + %58 = OpLoad %10 %42 + %60 = OpAccessChain %7 %36 %58 + OpStore %60 %59 + OpBranch %47 + %47 = OpLabel + %61 = OpLoad %10 %42 + %62 = OpIAdd %10 %61 %9 + OpStore %42 %62 + OpBranch %44 + %46 = OpLabel + %63 = OpAccessChain %7 %36 %15 + %64 = OpLoad %6 %63 + %65 = OpIEqual %32 %64 %38 + OpSelectionMerge %67 None + OpBranchConditional %65 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %7 %36 %9 + %69 = OpLoad %6 %68 + %70 = OpIEqual %32 %69 %59 + OpBranch %67 + %67 = OpLabel + %71 = OpPhi %32 %65 %46 %70 %66 + OpSelectionMerge %73 None + OpBranchConditional %71 %72 %81 + %72 = OpLabel + OpStore %77 %80 + OpBranch %73 + %81 = OpLabel + OpStore %77 %82 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# zero +BUFFER variant_zero DATA_TYPE int32 DATA + 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_zero 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/data/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber new file mode 100644 index 0000000..d510860 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-constant-folding-atan-over-tanh.amber @@ -0,0 +1,109 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding code path. + +# The test passes because shader always writes red. + +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; +# +# void main() +# { +# float f = atan(1.0, tanh(1.0)); +# +# if (f > 0.91 && f < 0.93) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %24 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %24 "_GLF_color" + OpDecorate %24 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %13 = OpConstant %6 0.910000026 + %14 = OpTypeBool + %17 = OpConstant %6 0.930000007 + %22 = OpTypeVector %6 4 + %23 = OpTypePointer Output %22 + %24 = OpVariable %23 Output + %25 = OpConstant %6 0 + %26 = OpConstantComposite %22 %9 %25 %25 %9 + %28 = OpConstantComposite %22 %25 %25 %25 %25 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpExtInst %6 %1 Tanh %9 + %11 = OpExtInst %6 %1 Atan2 %9 %10 + OpStore %8 %11 + %12 = OpLoad %6 %8 + %15 = OpFOrdGreaterThan %14 %12 %13 + %16 = OpLoad %6 %8 + %18 = OpFOrdLessThan %14 %16 %17 + %19 = OpLogicalAnd %14 %15 %18 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %27 + %20 = OpLabel + OpStore %24 %26 + OpBranch %21 + %27 = OpLabel + OpStore %24 %28 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +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 +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/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber new file mode 100644 index 0000000..6c7dfb4 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-dead-branch-func-return-arg.amber @@ -0,0 +1,328 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific dead branch elimination path + +# The test passes because shader always writes red. + +# Optimized using spirv-opt with the following arguments: +# '--private-to-local' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-dead-branches' +# '--merge-return' +# '--combine-access-chains' +# '--reduce-load-size' +# '--eliminate-local-single-block' +# '--eliminate-dead-branches' +# '--merge-return' +# '--eliminate-local-single-block' +# '--eliminate-local-single-store' +# '--copy-propagate-arrays' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--scalar-replacement=100' +# '--eliminate-local-single-store' +# '--eliminate-local-single-store' +# '--eliminate-dead-code-aggressive' +# '--inline-entry-points-exhaustive' +# '--eliminate-dead-branches' +# '--merge-blocks' +# '--eliminate-local-single-block' +# spirv-opt commit hash: 9215c1b7df0029f27807e8c8d7ec80532ce90a87 + + + +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 func(float x) +# { +# float a = x; +# +# do +# { +# if (a == x) +# return a; +# +# a++; +# } while(a < x); +# +# return 0.0; +# } +# +# void main() +# { +# float f = 0.0; +# float i = 0.0; +# +# do +# { +# f = func(i); +# i += func(1.0); +# } +# while (i < 6.0); +# +# if (f == 5.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 126 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %58 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "func(f1;" + OpName %9 "x" + OpName %12 "a" + OpName %35 "f" + OpName %36 "i" + OpName %41 "param" + OpName %44 "param" + OpName %58 "_GLF_color" + OpDecorate %58 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %8 = OpTypeFunction %6 %7 + %20 = OpTypeBool + %27 = OpConstant %6 1 + %32 = OpConstant %6 0 + %49 = OpConstant %6 6 + %52 = OpConstant %6 5 + %56 = OpTypeVector %6 4 + %57 = OpTypePointer Output %56 + %58 = OpVariable %57 Output + %59 = OpConstantComposite %56 %27 %32 %32 %27 + %61 = OpConstantComposite %56 %32 %32 %32 %32 + %68 = OpConstantFalse %20 + %69 = OpTypePointer Function %20 + %71 = OpConstantTrue %20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %100 = OpVariable %69 Function %68 + %101 = OpVariable %7 Function + %102 = OpVariable %7 Function + %103 = OpVariable %7 Function + %74 = OpVariable %69 Function %68 + %75 = OpVariable %7 Function + %76 = OpVariable %7 Function + %77 = OpVariable %7 Function + %35 = OpVariable %7 Function + %36 = OpVariable %7 Function + %41 = OpVariable %7 Function + %44 = OpVariable %7 Function + OpStore %35 %32 + OpStore %36 %32 + OpBranch %37 + %37 = OpLabel + %42 = OpLoad %6 %36 + OpStore %41 %42 + OpStore %74 %68 + OpLoopMerge %39 %37 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %6 %41 + OpStore %76 %79 + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %6 %76 + %87 = OpLoad %6 %41 + %88 = OpFOrdEqual %20 %86 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpLoad %6 %76 + OpStore %74 %71 + OpStore %75 %91 + OpBranch %83 + %89 = OpLabel + %92 = OpLoad %6 %76 + %93 = OpFAdd %6 %92 %27 + OpStore %76 %93 + OpBranch %84 + %84 = OpLabel + %94 = OpLoad %6 %76 + %95 = OpLoad %6 %41 + %96 = OpFOrdLessThan %20 %94 %95 + OpBranchConditional %96 %82 %83 + %83 = OpLabel + %97 = OpLoad %20 %74 + OpSelectionMerge %98 None + OpBranchConditional %97 %80 %98 + %98 = OpLabel + OpStore %74 %71 + OpStore %75 %32 + OpBranch %80 + %81 = OpLabel + OpBranch %78 + %80 = OpLabel + %99 = OpLoad %6 %75 + OpStore %77 %99 + OpStore %35 %99 + OpStore %44 %27 + OpStore %100 %68 + OpBranch %104 + %104 = OpLabel + %105 = OpLoad %6 %44 + OpStore %102 %105 + OpLoopMerge %106 %107 None + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %6 %102 + %113 = OpLoad %6 %44 + %114 = OpFOrdEqual %20 %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpLoad %6 %102 + OpStore %100 %71 + OpStore %101 %117 + OpBranch %109 + %115 = OpLabel + %118 = OpLoad %6 %102 + %119 = OpFAdd %6 %118 %27 + OpStore %102 %119 + OpBranch %110 + %110 = OpLabel + %120 = OpLoad %6 %102 + %121 = OpLoad %6 %44 + %122 = OpFOrdLessThan %20 %120 %121 + OpBranchConditional %122 %108 %109 + %109 = OpLabel + %123 = OpLoad %20 %100 + OpSelectionMerge %124 None + OpBranchConditional %123 %106 %124 + %124 = OpLabel + OpStore %100 %71 + OpStore %101 %32 + OpBranch %106 + %107 = OpLabel + OpBranch %104 + %106 = OpLabel + %125 = OpLoad %6 %101 + OpStore %103 %125 + %46 = OpLoad %6 %36 + %47 = OpFAdd %6 %46 %125 + OpStore %36 %47 + %50 = OpFOrdLessThan %20 %47 %49 + OpBranchConditional %50 %37 %39 + %39 = OpLabel + %51 = OpLoad %6 %35 + %53 = OpFOrdEqual %20 %51 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %54 %60 + %54 = OpLabel + OpStore %58 %59 + OpBranch %55 + %60 = OpLabel + OpStore %58 %61 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %6 None %8 + %9 = OpFunctionParameter %7 + %11 = OpLabel + %70 = OpVariable %69 Function %68 + %63 = OpVariable %7 Function + %12 = OpVariable %7 Function + OpBranch %65 + %65 = OpLabel + %13 = OpLoad %6 %9 + OpStore %12 %13 + OpLoopMerge %62 %67 None + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %15 + %15 = OpLabel + %18 = OpLoad %6 %12 + %19 = OpLoad %6 %9 + %21 = OpFOrdEqual %20 %18 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %24 = OpLoad %6 %12 + OpStore %70 %71 + OpStore %63 %24 + OpBranch %16 + %23 = OpLabel + %26 = OpLoad %6 %12 + %28 = OpFAdd %6 %26 %27 + OpStore %12 %28 + OpBranch %17 + %17 = OpLabel + %29 = OpLoad %6 %12 + %30 = OpLoad %6 %9 + %31 = OpFOrdLessThan %20 %29 %30 + OpBranchConditional %31 %14 %16 + %16 = OpLabel + %73 = OpLoad %20 %70 + OpSelectionMerge %72 None + OpBranchConditional %73 %62 %72 + %72 = OpLabel + OpStore %70 %71 + OpStore %63 %32 + OpBranch %62 + %67 = OpLabel + OpBranch %65 + %62 = OpLabel + %64 = OpLoad %6 %63 + OpReturnValue %64 + OpFunctionEnd +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 +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/data/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber new file mode 100644 index 0000000..12a0e15 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-fold-and-in-for-loop-range.amber @@ -0,0 +1,172 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific folding path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int one; +# }; +# +# int func() +# { +# int ret = 0; +# +# for(int i = 3; i > (i & 1); i -= one) +# ret++; +# +# return ret; +# } +# +# void main() +# { +# if (func() == 2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %11 "ret" + OpName %13 "i" + OpName %28 "buf0" + OpMemberName %28 0 "one" + OpName %30 "" + OpName %47 "_GLF_color" + OpMemberDecorate %28 0 Offset 0 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 0 + OpDecorate %47 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %14 = OpConstant %6 3 + %22 = OpConstant %6 1 + %24 = OpTypeBool + %28 = OpTypeStruct %6 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpTypePointer Uniform %6 + %40 = OpConstant %6 2 + %44 = OpTypeFloat 32 + %45 = OpTypeVector %44 4 + %46 = OpTypePointer Output %45 + %47 = OpVariable %46 Output + %48 = OpConstant %44 1 + %49 = OpConstant %44 0 + %50 = OpConstantComposite %45 %48 %49 %49 %48 + %52 = OpConstantComposite %45 %49 %49 %49 %49 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %39 = OpFunctionCall %6 %8 + %41 = OpIEqual %24 %39 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %42 %51 + %42 = OpLabel + OpStore %47 %50 + OpBranch %43 + %51 = OpLabel + OpStore %47 %52 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %11 = OpVariable %10 Function + %13 = OpVariable %10 Function + OpStore %11 %12 + OpStore %13 %14 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %6 %13 + %21 = OpLoad %6 %13 + %23 = OpBitwiseAnd %6 %21 %22 + %25 = OpSGreaterThan %24 %20 %23 + OpBranchConditional %25 %16 %17 + %16 = OpLabel + %26 = OpLoad %6 %11 + %27 = OpIAdd %6 %26 %22 + OpStore %11 %27 + OpBranch %18 + %18 = OpLabel + %32 = OpAccessChain %31 %30 %12 + %33 = OpLoad %6 %32 + %34 = OpLoad %6 %13 + %35 = OpISub %6 %34 %33 + OpStore %13 %35 + OpBranch %15 + %17 = OpLabel + %36 = OpLoad %6 %11 + OpReturnValue %36 + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE int32 DATA + 1 +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_one 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/data/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber new file mode 100644 index 0000000..bf995c7 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-clamp-cmp-const-first.amber @@ -0,0 +1,155 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific constant folding path + +# The test passes because shader always writes red. + +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 +# { +# float one; +# }; +# +# void main() +# { +# float f = 1.0; +# +# do +# { +# f += one; +# } +# while(10.0 > clamp(f, 8.0, 9.0 + one)); +# +# if (f == 10.0) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %40 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %14 "buf0" + OpMemberName %14 0 "one" + OpName %16 "" + OpName %40 "_GLF_color" + OpMemberDecorate %14 0 Offset 0 + OpDecorate %14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %40 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %14 = OpTypeStruct %6 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpTypeInt 32 1 + %18 = OpConstant %17 0 + %19 = OpTypePointer Uniform %6 + %24 = OpConstant %6 10 + %26 = OpConstant %6 8 + %27 = OpConstant %6 9 + %32 = OpTypeBool + %38 = OpTypeVector %6 4 + %39 = OpTypePointer Output %38 + %40 = OpVariable %39 Output + %41 = OpConstant %6 0 + %42 = OpConstantComposite %38 %9 %41 %41 %9 + %44 = OpConstantComposite %38 %41 %41 %41 %41 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %6 %20 + %22 = OpLoad %6 %8 + %23 = OpFAdd %6 %22 %21 + OpStore %8 %23 + OpBranch %13 + %13 = OpLabel + %25 = OpLoad %6 %8 + %28 = OpAccessChain %19 %16 %18 + %29 = OpLoad %6 %28 + %30 = OpFAdd %6 %27 %29 + %31 = OpExtInst %6 %1 FClamp %25 %26 %30 + %33 = OpFOrdGreaterThan %32 %24 %31 + OpBranchConditional %33 %10 %12 + %12 = OpLabel + %34 = OpLoad %6 %8 + %35 = OpFOrdEqual %32 %34 %24 + OpSelectionMerge %37 None + OpBranchConditional %35 %36 %43 + %36 = OpLabel + OpStore %40 %42 + OpBranch %37 + %43 = OpLabel + OpStore %40 %44 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 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_one 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/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber new file mode 100644 index 0000000..3a8eb23 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-div-mul.amber @@ -0,0 +1,138 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +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 +# { +# float one; +# }; +# +# void main() +# { +# float f = 4.0 / (2.0 * one); +# +# // If condition is always true. +# if (f > 1.9 && f < 2.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %11 "buf0" + OpMemberName %11 0 "one" + OpName %13 "" + OpName %33 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %10 = OpConstant %6 2 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %22 = OpConstant %6 1.89999998 + %23 = OpTypeBool + %26 = OpConstant %6 2.0999999 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 1 + %35 = OpConstant %6 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %19 = OpFMul %6 %10 %18 + %20 = OpFDiv %6 %9 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + %24 = OpFOrdGreaterThan %23 %21 %22 + %25 = OpLoad %6 %8 + %27 = OpFOrdLessThan %23 %25 %26 + %28 = OpLogicalAnd %23 %24 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %37 + %29 = OpLabel + OpStore %33 %36 + OpBranch %30 + %37 = OpLabel + OpStore %33 %38 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 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_one 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/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber new file mode 100644 index 0000000..2105230 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-divs.amber @@ -0,0 +1,136 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# float four; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# float a = 2.0 / (1.0 / four); +# // If condition is always true. +# if (a > 7.9 && a < 8.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %11 "buf0" + OpMemberName %11 0 "four" + OpName %13 "" + OpName %33 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %10 = OpConstant %6 1 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %22 = OpConstant %6 7.9000001 + %23 = OpTypeBool + %26 = OpConstant %6 8.10000038 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 0 + %35 = OpConstantComposite %31 %10 %34 %34 %10 + %37 = OpConstantComposite %31 %34 %34 %34 %34 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %19 = OpFDiv %6 %10 %18 + %20 = OpFDiv %6 %9 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + %24 = OpFOrdGreaterThan %23 %21 %22 + %25 = OpLoad %6 %8 + %27 = OpFOrdLessThan %23 %25 %26 + %28 = OpLogicalAnd %23 %24 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %36 + %29 = OpLabel + OpStore %33 %35 + OpBranch %30 + %36 = OpLabel + OpStore %33 %37 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# four +BUFFER variant_four DATA_TYPE float DATA + 4.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_four 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/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber new file mode 100644 index 0000000..4d8f9fe --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-merge-mul-div.amber @@ -0,0 +1,138 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +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 +# { +# float one; +# }; +# +# void main() +# { +# float f = 4.0 * (2.0 / one); +# +# // If condition is always true. +# if(f > 7.9 && f < 8.1) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %33 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "f" + OpName %11 "buf0" + OpMemberName %11 0 "one" + OpName %13 "" + OpName %33 "_GLF_color" + OpMemberDecorate %11 0 Offset 0 + OpDecorate %11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %33 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 4 + %10 = OpConstant %6 2 + %11 = OpTypeStruct %6 + %12 = OpTypePointer Uniform %11 + %13 = OpVariable %12 Uniform + %14 = OpTypeInt 32 1 + %15 = OpConstant %14 0 + %16 = OpTypePointer Uniform %6 + %22 = OpConstant %6 7.9000001 + %23 = OpTypeBool + %26 = OpConstant %6 8.10000038 + %31 = OpTypeVector %6 4 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %34 = OpConstant %6 1 + %35 = OpConstant %6 0 + %36 = OpConstantComposite %31 %34 %35 %35 %34 + %38 = OpConstantComposite %31 %35 %35 %35 %35 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %17 = OpAccessChain %16 %13 %15 + %18 = OpLoad %6 %17 + %19 = OpFDiv %6 %10 %18 + %20 = OpFMul %6 %9 %19 + OpStore %8 %20 + %21 = OpLoad %6 %8 + %24 = OpFOrdGreaterThan %23 %21 %22 + %25 = OpLoad %6 %8 + %27 = OpFOrdLessThan %23 %25 %26 + %28 = OpLogicalAnd %23 %24 %27 + OpSelectionMerge %30 None + OpBranchConditional %28 %29 %37 + %29 = OpLabel + OpStore %33 %36 + OpBranch %30 + %37 = OpLabel + OpStore %33 %38 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# one +BUFFER variant_one DATA_TYPE float DATA + 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_one 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/data/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber new file mode 100644 index 0000000..d6cc914 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-folding-rules-negate-div.amber @@ -0,0 +1,130 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific instruction folding path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# int four; +# }; +# layout(location = 0) out vec4 _GLF_color; +# +# void main() +# { +# // If condition is always true. +# if(-(four / 2) == -2) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %25 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %7 "buf0" + OpMemberName %7 0 "four" + OpName %9 "" + OpName %25 "_GLF_color" + OpMemberDecorate %7 0 RelaxedPrecision + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 Block + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpDecorate %13 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %25 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeStruct %6 + %8 = OpTypePointer Uniform %7 + %9 = OpVariable %8 Uniform + %10 = OpConstant %6 0 + %11 = OpTypePointer Uniform %6 + %14 = OpConstant %6 2 + %17 = OpConstant %6 -2 + %18 = OpTypeBool + %22 = OpTypeFloat 32 + %23 = OpTypeVector %22 4 + %24 = OpTypePointer Output %23 + %25 = OpVariable %24 Output + %26 = OpConstant %22 1 + %27 = OpConstant %22 0 + %28 = OpConstantComposite %23 %26 %27 %27 %26 + %30 = OpConstantComposite %23 %27 %27 %27 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpAccessChain %11 %9 %10 + %13 = OpLoad %6 %12 + %15 = OpSDiv %6 %13 %14 + %16 = OpSNegate %6 %15 + %19 = OpIEqual %18 %16 %17 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %29 + %20 = OpLabel + OpStore %25 %28 + OpBranch %21 + %29 = OpLabel + OpStore %25 %30 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# four +BUFFER variant_four DATA_TYPE int32 DATA + 4 +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_four 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/data/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber new file mode 100644 index 0000000..5de3a4c --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-inline-pass-return-in-loop.amber @@ -0,0 +1,165 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific inlining optimization path. + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# float func() +# { +# for (int i = 0; i < 10; ++i) +# { +# if (i > 5) +# ++i; +# +# if (i > 8) +# return 0.0; +# } +# +# return 1.0; +# } +# +# void main() +# { +# if (false) +# { +# _GLF_color = vec4(func()); +# } +# else +# { +# _GLF_color = vec4(1, 0, 0, 1); +# } +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %48 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "func(" + OpName %12 "i" + OpName %48 "_GLF_color" + OpDecorate %48 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeFunction %6 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 0 + %20 = OpConstant %10 10 + %21 = OpTypeBool + %24 = OpConstant %10 5 + %29 = OpConstant %10 1 + %32 = OpConstant %10 8 + %36 = OpConstant %6 0 + %40 = OpConstant %6 1 + %43 = OpConstantFalse %21 + %46 = OpTypeVector %6 4 + %47 = OpTypePointer Output %46 + %48 = OpVariable %47 Output + %52 = OpConstantComposite %46 %40 %36 %36 %40 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %45 None + OpBranchConditional %43 %44 %51 + %44 = OpLabel + %49 = OpFunctionCall %6 %8 + %50 = OpCompositeConstruct %46 %49 %49 %49 %49 + OpStore %48 %50 + OpBranch %45 + %51 = OpLabel + OpStore %48 %52 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + %12 = OpVariable %11 Function + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %10 %12 + %22 = OpSLessThan %21 %19 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + %23 = OpLoad %10 %12 + %25 = OpSGreaterThan %21 %23 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %26 %27 + %26 = OpLabel + %28 = OpLoad %10 %12 + %30 = OpIAdd %10 %28 %29 + OpStore %12 %30 + OpBranch %27 + %27 = OpLabel + %31 = OpLoad %10 %12 + %33 = OpSGreaterThan %21 %31 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %34 %35 + %34 = OpLabel + OpReturnValue %36 + %35 = OpLabel + OpBranch %17 + %17 = OpLabel + %38 = OpLoad %10 %12 + %39 = OpIAdd %10 %38 %29 + OpStore %12 %39 + OpBranch %14 + %16 = OpLabel + OpReturnValue %40 + OpFunctionEnd +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 +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/data/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber new file mode 100644 index 0000000..c82366d --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-machinevaluetype-one-iter-loop.amber @@ -0,0 +1,177 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific machine value type code path + +# The test passes because shader always writes red. + +SHADER vertex variant_vertex_shader PASSTHROUGH + +# variant_fragment_shader is derived from the following GLSL: +# #version 310 es +# precision highp float; +# precision highp int; +# +# layout(location = 0) out vec4 _GLF_color; +# +# layout(set = 0, binding = 0) uniform buf0 +# { +# vec2 injectionSwitch; +# }; +# +# void main() +# { +# int a = 0; +# for(int i = 0; i < int(injectionSwitch.y); i++) +# { +# if (a > 0) +# { +# break; +# } +# // a becomes 1. +# a = ((int(injectionSwitch.y) * 2) / 2); +# } +# +# if (a == 1) // Always true. +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %50 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "a" + OpName %10 "i" + OpName %19 "buf0" + OpMemberName %19 0 "injectionSwitch" + OpName %21 "" + OpName %50 "_GLF_color" + OpMemberDecorate %19 0 Offset 0 + OpDecorate %19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %50 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 2 + %19 = OpTypeStruct %18 + %20 = OpTypePointer Uniform %19 + %21 = OpVariable %20 Uniform + %22 = OpTypeInt 32 0 + %23 = OpConstant %22 1 + %24 = OpTypePointer Uniform %17 + %28 = OpTypeBool + %38 = OpConstant %6 2 + %42 = OpConstant %6 1 + %48 = OpTypeVector %17 4 + %49 = OpTypePointer Output %48 + %50 = OpVariable %49 Output + %51 = OpConstant %17 1 + %52 = OpConstant %17 0 + %53 = OpConstantComposite %48 %51 %52 %52 %51 + %55 = OpConstantComposite %48 %52 %52 %52 %52 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %6 %10 + %25 = OpAccessChain %24 %21 %9 %23 + %26 = OpLoad %17 %25 + %27 = OpConvertFToS %6 %26 + %29 = OpSLessThan %28 %16 %27 + OpBranchConditional %29 %12 %13 + %12 = OpLabel + %30 = OpLoad %6 %8 + %31 = OpSGreaterThan %28 %30 %9 + OpSelectionMerge %33 None + OpBranchConditional %31 %32 %33 + %32 = OpLabel + OpBranch %13 + %33 = OpLabel + %35 = OpAccessChain %24 %21 %9 %23 + %36 = OpLoad %17 %35 + %37 = OpConvertFToS %6 %36 + %39 = OpIMul %6 %37 %38 + %40 = OpSDiv %6 %39 %38 + OpStore %8 %40 + OpBranch %14 + %14 = OpLabel + %41 = OpLoad %6 %10 + %43 = OpIAdd %6 %41 %42 + OpStore %10 %43 + OpBranch %11 + %13 = OpLabel + %44 = OpLoad %6 %8 + %45 = OpIEqual %28 %44 %42 + OpSelectionMerge %47 None + OpBranchConditional %45 %46 %54 + %46 = OpLabel + OpStore %50 %53 + OpBranch %47 + %54 = OpLabel + OpStore %50 %55 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +END + +# uniforms for variant + +# injectionSwitch +BUFFER variant_injectionSwitch DATA_TYPE vec2 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/data/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber new file mode 100644 index 0000000..14acaf1 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-vector-log2-cosh.amber @@ -0,0 +1,114 @@ +#!amber + +# Copyright 2020 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 coverage-gap found by GraphicsFuzz. + +# Short description: A fragment shader that covers a specific vector log2 and cosh code path. + +# The test passes because shader always writes red. + +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; +# +# void main() +# { +# vec2 v = log2(cosh(vec2(1, 100))); +# +# if (v.x < v.y) +# _GLF_color = vec4(1, 0, 0, 1); +# else +# _GLF_color = vec4(0); +# } +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %29 + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %9 "v" + OpName %29 "_GLF_color" + OpDecorate %29 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 1 + %11 = OpConstant %6 100 + %12 = OpConstantComposite %7 %10 %11 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 0 + %17 = OpTypePointer Function %6 + %20 = OpConstant %15 1 + %23 = OpTypeBool + %27 = OpTypeVector %6 4 + %28 = OpTypePointer Output %27 + %29 = OpVariable %28 Output + %30 = OpConstant %6 0 + %31 = OpConstantComposite %27 %10 %30 %30 %10 + %33 = OpConstantComposite %27 %30 %30 %30 %30 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + %13 = OpExtInst %7 %1 Cosh %12 + %14 = OpExtInst %7 %1 Log2 %13 + OpStore %9 %14 + %18 = OpAccessChain %17 %9 %16 + %19 = OpLoad %6 %18 + %21 = OpAccessChain %17 %9 %20 + %22 = OpLoad %6 %21 + %24 = OpFOrdLessThan %23 %19 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %25 %32 + %25 = OpLabel + OpStore %29 %31 + OpBranch %26 + %32 = OpLabel + OpStore %29 %33 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd +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 +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/data/vulkan/amber/graphicsfuzz/index.txt b/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt index bb99b86..60d55fd 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt @@ -15,18 +15,25 @@ { "control-flow-switch.amber", "control-flow-switch", "A fragment shader with somewhat complex control flow and a switch" }, { "cov-apfloat-determinant.amber", "cov-apfloat-determinant", "A fragment shader that covers a specific arbitrary precision float usage." }, { "cov-apfloat-tanh.amber", "cov-apfloat-tanh", "A fragment shader that covers a specific arbitrary precision float usage." }, +{ "cov-basic-block-discard-in-function.amber", "cov-basic-block-discard-in-function", "A fragment shader that covers a specific basic block code path" }, { "cov-blockfrequency-several-for-loops.amber", "cov-blockfrequency-several-for-loops", "A fragment shader that covers a specific block frequency info code path." }, { "cov-const-folding-clamp.amber", "cov-const-folding-clamp", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-clamp-inside-while.amber", "cov-const-folding-clamp-inside-while", "A fragment shader that covers a specific constant folding path" }, { "cov-const-folding-clamp-max.amber", "cov-const-folding-clamp-max", "A fragment shader that covers a specific const folding rule path." }, { "cov-const-folding-clamp-min.amber", "cov-const-folding-clamp-min", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-clamp-vs-original.amber", "cov-const-folding-clamp-vs-original", "A fragment shader that covers a specific constant folding path" }, { "cov-const-folding-dot-condition-true.amber", "cov-const-folding-dot-condition-true", "A fragment shader that covers a specific const folding rule path." }, { "cov-const-folding-dot-determinant.amber", "cov-const-folding-dot-determinant", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-const-folding-min-as-loop-range.amber", "cov-const-folding-min-as-loop-range", "A fragment shader that covers a specific constant folding path" }, { "cov-const-folding-vector-shuffle.amber", "cov-const-folding-vector-shuffle", "A fragment shader that covers a specific const folding rule path." }, +{ "cov-constant-folding-atan-over-tanh.amber", "cov-constant-folding-atan-over-tanh", "A fragment shader that covers a specific constant folding code path." }, { "cov-constants-mix-uniform.amber", "cov-constants-mix-uniform", "A fragment shader that covers a specific constant handling path." }, { "cov-copy-prop-arrays-func-argument.amber", "cov-copy-prop-arrays-func-argument", "A fragment shader that covers a specific propagate array copy path." }, { "cov-copy-prop-arrays-no-stores.amber", "cov-copy-prop-arrays-no-stores", "A fragment shader that covers a specific propagate array copy path." }, { "cov-copy-prop-arrays-param-uniform.amber", "cov-copy-prop-arrays-param-uniform", "A fragment shader that covers a specific propagate array copy path." }, +{ "cov-dead-branch-func-return-arg.amber", "cov-dead-branch-func-return-arg", "A fragment shader that covers a specific dead branch elimination path" }, { "cov-dead-code-unreachable-merge.amber", "cov-dead-code-unreachable-merge", "A fragment shader that covers a specific dead code elimination path." }, +{ "cov-fold-and-in-for-loop-range.amber", "cov-fold-and-in-for-loop-range", "A fragment shader that covers a specific folding path" }, { "cov-fold-bitwise-and-zero.amber", "cov-fold-bitwise-and-zero", "A fragment shader that covers a specific instruction folding path." }, { "cov-fold-bitwise-or-full-mask.amber", "cov-fold-bitwise-or-full-mask", "A fragment shader that covers a specific instruction folding path." }, { "cov-fold-bitwise-xor.amber", "cov-fold-bitwise-xor", "A fragment shader that covers a specific instruction folding path." }, @@ -39,12 +46,17 @@ { "cov-fold-shift-gte32.amber", "cov-fold-shift-gte32", "A fragment shader that covers a specific instruction folding path." }, { "cov-fold-shift-right-arithmetic.amber", "cov-fold-shift-right-arithmetic", "A fragment shader that covers a specific instruction folding path." }, { "cov-fold-switch-udiv.amber", "cov-fold-switch-udiv", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-clamp-cmp-const-first.amber", "cov-folding-clamp-cmp-const-first", "A fragment shader that covers a specific constant folding path" }, { "cov-folding-rules-construct-extract.amber", "cov-folding-rules-construct-extract", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-dot-extract.amber", "cov-folding-rules-dot-extract", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-dot-no-extract.amber", "cov-folding-rules-dot-no-extract", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-merge-add-sub.amber", "cov-folding-rules-merge-add-sub", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-div-mul.amber", "cov-folding-rules-merge-div-mul", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-divs.amber", "cov-folding-rules-merge-divs", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-merge-mul-div.amber", "cov-folding-rules-merge-mul-div", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-merge-sub-add.amber", "cov-folding-rules-merge-sub-add", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-merge-sub-sub.amber", "cov-folding-rules-merge-sub-sub", "A fragment shader that covers a specific instruction folding path." }, +{ "cov-folding-rules-negate-div.amber", "cov-folding-rules-negate-div", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-redundant-mix.amber", "cov-folding-rules-redundant-mix", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-shuffle-extract.amber", "cov-folding-rules-shuffle-extract", "A fragment shader that covers a specific instruction folding path." }, { "cov-folding-rules-shuffle-mix.amber", "cov-folding-rules-shuffle-mix", "A fragment shader that covers a specific instruction folding path." }, @@ -52,9 +64,11 @@ { "cov-if-conversion-identical-branches.amber", "cov-if-conversion-identical-branches", "A fragment shader that covers a specific if condition conversion path." }, { "cov-inline-pass-empty-block.amber", "cov-inline-pass-empty-block", "A fragment shader that covers a specific inlining optimization path." }, { "cov-inline-pass-nested-loops.amber", "cov-inline-pass-nested-loops", "A fragment shader that covers a specific inlining optimization path." }, +{ "cov-inline-pass-return-in-loop.amber", "cov-inline-pass-return-in-loop", "A fragment shader that covers a specific inlining optimization path." }, { "cov-inline-pass-unreachable-func.amber", "cov-inline-pass-unreachable-func", "A fragment shader that covers a specific inlining optimization path." }, { "cov-intervalmap-set-stop.amber", "cov-intervalmap-set-stop", "A fragment shader that covers a specific interval map code path." }, { "cov-liveinterval-different-dest.amber", "cov-liveinterval-different-dest", "A fragment shader that covers a specific live interval code path." }, +{ "cov-machinevaluetype-one-iter-loop.amber", "cov-machinevaluetype-one-iter-loop", "A fragment shader that covers a specific machine value type code path" }, { "cov-merge-return-condition-twice.amber", "cov-merge-return-condition-twice", "A fragment shader that covers a specific return merge path." }, { "cov-modf-integer-to-private.amber", "cov-modf-integer-to-private", "A fragment shader that covers a specific private to local path." }, { "cov-reduce-load-replace-extract.amber", "cov-reduce-load-replace-extract", "A fragment shader that covers a specific load size reduction path." }, @@ -64,6 +78,7 @@ { "cov-types-return-in-main-never-hit.amber", "cov-types-return-in-main-never-hit", "A fragment shader that covers a specific types optimization path." }, { "cov-vector-dce-inc-unused-comp.amber", "cov-vector-dce-inc-unused-comp", "A fragment shader that covers a specific vector DCE path." }, { "cov-vector-dce-unused-component.amber", "cov-vector-dce-unused-component", "A fragment shader that covers a specific vector DCE path." }, +{ "cov-vector-log2-cosh.amber", "cov-vector-log2-cosh", "A fragment shader that covers a specific vector log2 and cosh code path." }, { "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" }, diff --git a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt index d6ca761..592c679 100644 --- a/external/vulkancts/mustpass/master/vk-default-no-waivers.txt +++ b/external/vulkancts/mustpass/master/vk-default-no-waivers.txt @@ -582001,18 +582001,25 @@ dEQP-VK.graphicsfuzz.control-flow-in-function dEQP-VK.graphicsfuzz.control-flow-switch dEQP-VK.graphicsfuzz.cov-apfloat-determinant dEQP-VK.graphicsfuzz.cov-apfloat-tanh +dEQP-VK.graphicsfuzz.cov-basic-block-discard-in-function dEQP-VK.graphicsfuzz.cov-blockfrequency-several-for-loops dEQP-VK.graphicsfuzz.cov-const-folding-clamp +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-inside-while dEQP-VK.graphicsfuzz.cov-const-folding-clamp-max dEQP-VK.graphicsfuzz.cov-const-folding-clamp-min +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-vs-original dEQP-VK.graphicsfuzz.cov-const-folding-dot-condition-true dEQP-VK.graphicsfuzz.cov-const-folding-dot-determinant +dEQP-VK.graphicsfuzz.cov-const-folding-min-as-loop-range dEQP-VK.graphicsfuzz.cov-const-folding-vector-shuffle +dEQP-VK.graphicsfuzz.cov-constant-folding-atan-over-tanh dEQP-VK.graphicsfuzz.cov-constants-mix-uniform dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-func-argument dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-no-stores dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-param-uniform +dEQP-VK.graphicsfuzz.cov-dead-branch-func-return-arg dEQP-VK.graphicsfuzz.cov-dead-code-unreachable-merge +dEQP-VK.graphicsfuzz.cov-fold-and-in-for-loop-range dEQP-VK.graphicsfuzz.cov-fold-bitwise-and-zero dEQP-VK.graphicsfuzz.cov-fold-bitwise-or-full-mask dEQP-VK.graphicsfuzz.cov-fold-bitwise-xor @@ -582025,12 +582032,17 @@ dEQP-VK.graphicsfuzz.cov-fold-negate-variable dEQP-VK.graphicsfuzz.cov-fold-shift-gte32 dEQP-VK.graphicsfuzz.cov-fold-shift-right-arithmetic dEQP-VK.graphicsfuzz.cov-fold-switch-udiv +dEQP-VK.graphicsfuzz.cov-folding-clamp-cmp-const-first dEQP-VK.graphicsfuzz.cov-folding-rules-construct-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-no-extract dEQP-VK.graphicsfuzz.cov-folding-rules-merge-add-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-div-mul +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-divs +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-mul-div dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-add dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-negate-div dEQP-VK.graphicsfuzz.cov-folding-rules-redundant-mix dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-extract dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-mix @@ -582038,9 +582050,11 @@ dEQP-VK.graphicsfuzz.cov-folding-rules-split-vector-init dEQP-VK.graphicsfuzz.cov-if-conversion-identical-branches dEQP-VK.graphicsfuzz.cov-inline-pass-empty-block dEQP-VK.graphicsfuzz.cov-inline-pass-nested-loops +dEQP-VK.graphicsfuzz.cov-inline-pass-return-in-loop dEQP-VK.graphicsfuzz.cov-inline-pass-unreachable-func dEQP-VK.graphicsfuzz.cov-intervalmap-set-stop dEQP-VK.graphicsfuzz.cov-liveinterval-different-dest +dEQP-VK.graphicsfuzz.cov-machinevaluetype-one-iter-loop dEQP-VK.graphicsfuzz.cov-merge-return-condition-twice dEQP-VK.graphicsfuzz.cov-modf-integer-to-private dEQP-VK.graphicsfuzz.cov-reduce-load-replace-extract @@ -582050,6 +582064,7 @@ dEQP-VK.graphicsfuzz.cov-ssa-rewrite-case-with-default dEQP-VK.graphicsfuzz.cov-types-return-in-main-never-hit dEQP-VK.graphicsfuzz.cov-vector-dce-inc-unused-comp dEQP-VK.graphicsfuzz.cov-vector-dce-unused-component +dEQP-VK.graphicsfuzz.cov-vector-log2-cosh dEQP-VK.graphicsfuzz.dead-barriers-in-loops dEQP-VK.graphicsfuzz.dead-struct-init dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt index 2560d6b..ddcecc4 100644 --- a/external/vulkancts/mustpass/master/vk-default.txt +++ b/external/vulkancts/mustpass/master/vk-default.txt @@ -581848,18 +581848,25 @@ dEQP-VK.graphicsfuzz.control-flow-in-function dEQP-VK.graphicsfuzz.control-flow-switch dEQP-VK.graphicsfuzz.cov-apfloat-determinant dEQP-VK.graphicsfuzz.cov-apfloat-tanh +dEQP-VK.graphicsfuzz.cov-basic-block-discard-in-function dEQP-VK.graphicsfuzz.cov-blockfrequency-several-for-loops dEQP-VK.graphicsfuzz.cov-const-folding-clamp +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-inside-while dEQP-VK.graphicsfuzz.cov-const-folding-clamp-max dEQP-VK.graphicsfuzz.cov-const-folding-clamp-min +dEQP-VK.graphicsfuzz.cov-const-folding-clamp-vs-original dEQP-VK.graphicsfuzz.cov-const-folding-dot-condition-true dEQP-VK.graphicsfuzz.cov-const-folding-dot-determinant +dEQP-VK.graphicsfuzz.cov-const-folding-min-as-loop-range dEQP-VK.graphicsfuzz.cov-const-folding-vector-shuffle +dEQP-VK.graphicsfuzz.cov-constant-folding-atan-over-tanh dEQP-VK.graphicsfuzz.cov-constants-mix-uniform dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-func-argument dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-no-stores dEQP-VK.graphicsfuzz.cov-copy-prop-arrays-param-uniform +dEQP-VK.graphicsfuzz.cov-dead-branch-func-return-arg dEQP-VK.graphicsfuzz.cov-dead-code-unreachable-merge +dEQP-VK.graphicsfuzz.cov-fold-and-in-for-loop-range dEQP-VK.graphicsfuzz.cov-fold-bitwise-and-zero dEQP-VK.graphicsfuzz.cov-fold-bitwise-or-full-mask dEQP-VK.graphicsfuzz.cov-fold-bitwise-xor @@ -581872,12 +581879,17 @@ dEQP-VK.graphicsfuzz.cov-fold-negate-variable dEQP-VK.graphicsfuzz.cov-fold-shift-gte32 dEQP-VK.graphicsfuzz.cov-fold-shift-right-arithmetic dEQP-VK.graphicsfuzz.cov-fold-switch-udiv +dEQP-VK.graphicsfuzz.cov-folding-clamp-cmp-const-first dEQP-VK.graphicsfuzz.cov-folding-rules-construct-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-extract dEQP-VK.graphicsfuzz.cov-folding-rules-dot-no-extract dEQP-VK.graphicsfuzz.cov-folding-rules-merge-add-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-div-mul +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-divs +dEQP-VK.graphicsfuzz.cov-folding-rules-merge-mul-div dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-add dEQP-VK.graphicsfuzz.cov-folding-rules-merge-sub-sub +dEQP-VK.graphicsfuzz.cov-folding-rules-negate-div dEQP-VK.graphicsfuzz.cov-folding-rules-redundant-mix dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-extract dEQP-VK.graphicsfuzz.cov-folding-rules-shuffle-mix @@ -581885,9 +581897,11 @@ dEQP-VK.graphicsfuzz.cov-folding-rules-split-vector-init dEQP-VK.graphicsfuzz.cov-if-conversion-identical-branches dEQP-VK.graphicsfuzz.cov-inline-pass-empty-block dEQP-VK.graphicsfuzz.cov-inline-pass-nested-loops +dEQP-VK.graphicsfuzz.cov-inline-pass-return-in-loop dEQP-VK.graphicsfuzz.cov-inline-pass-unreachable-func dEQP-VK.graphicsfuzz.cov-intervalmap-set-stop dEQP-VK.graphicsfuzz.cov-liveinterval-different-dest +dEQP-VK.graphicsfuzz.cov-machinevaluetype-one-iter-loop dEQP-VK.graphicsfuzz.cov-merge-return-condition-twice dEQP-VK.graphicsfuzz.cov-modf-integer-to-private dEQP-VK.graphicsfuzz.cov-reduce-load-replace-extract @@ -581897,6 +581911,7 @@ dEQP-VK.graphicsfuzz.cov-ssa-rewrite-case-with-default dEQP-VK.graphicsfuzz.cov-types-return-in-main-never-hit dEQP-VK.graphicsfuzz.cov-vector-dce-inc-unused-comp dEQP-VK.graphicsfuzz.cov-vector-dce-unused-component +dEQP-VK.graphicsfuzz.cov-vector-log2-cosh dEQP-VK.graphicsfuzz.dead-barriers-in-loops dEQP-VK.graphicsfuzz.dead-struct-init dEQP-VK.graphicsfuzz.disc-and-add-in-func-in-loop -- 2.7.4