From 5b5b2b0e18f1c78d0efbab39899d0e84dc2fe718 Mon Sep 17 00:00:00 2001 From: Paul Thomson Date: Thu, 30 Jul 2020 18:11:05 +0100 Subject: [PATCH] Convert GraphicsFuzz vkscript to AmberScript Also re-disassembled some SPIR-V shaders so that IDs are numbers instead of names. Corrected some comments. Changed some tests to check ALL pixels colors where this was possible. Components: Vulkan Affected tests: dEQP-VK.graphicsfuzz.* Change-Id: Iea2e7d852cf2b02886af84e986d180614ae543ff --- .../amber/graphicsfuzz/color-write-in-loop.amber | 26 +- .../amber/graphicsfuzz/continue-and-merge.amber | 99 +++-- .../amber/graphicsfuzz/control-flow-switch.amber | 272 +++++++------ .../amber/graphicsfuzz/dead-struct-init.amber | 98 +++-- .../do-while-loop-in-conditionals.amber | 30 +- .../graphicsfuzz/fragcoord-control-flow-2.amber | 208 +++++----- .../graphicsfuzz/fragcoord-control-flow.amber | 423 +++++++++++---------- .../vulkan/amber/graphicsfuzz/if-and-switch.amber | 36 +- .../graphicsfuzz/mat-array-deep-control-flow.amber | 221 ++++++----- .../amber/graphicsfuzz/mat-array-distance.amber | 238 ++++++------ .../graphicsfuzz/matrices-and-return-in-loop.amber | 29 +- .../nested-ifs-and-return-in-for-loop.amber | 41 +- .../data/vulkan/amber/graphicsfuzz/pow-vec4.amber | 98 +++-- .../graphicsfuzz/return-in-loop-in-function.amber | 31 +- .../graphicsfuzz/swizzle-struct-init-min.amber | 171 +++++---- .../graphicsfuzz/unreachable-loops-in-switch.amber | 28 +- .../amber/graphicsfuzz/while-inside-switch.amber | 183 +++++---- 17 files changed, 1240 insertions(+), 992 deletions(-) diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/color-write-in-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/color-write-in-loop.amber index a274672..9459f68 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/color-write-in-loop.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/color-write-in-loop.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -67,12 +69,9 @@ # } # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -178,8 +177,19 @@ fbsize 256 256 %65 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/continue-and-merge.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/continue-and-merge.amber index 4eae650..db45ea2 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/continue-and-merge.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/continue-and-merge.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,56 +16,71 @@ # A test for a bug found by GraphicsFuzz; reduced by spirv-fuzz and by hand. # A fragment shader with two nested loops. All loop conditions are false. -# Block %45 is both a continue block and a merge block. # We check that all pixels are red. The test passes because the final statement # writes red to _GLF_color. -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 22 +; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %_GLF_color "_GLF_color" - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %6 = OpTypeFunction %void - %float = OpTypeFloat 32 - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %v4float = OpTypeVector %float 4 - %red = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %bool = OpTypeBool - %true = OpConstantTrue %bool - %false = OpConstantFalse %bool - - %main = OpFunction %void None %6 - %23 = OpLabel - OpBranch %42 - %42 = OpLabel - OpLoopMerge %47 %45 None - OpBranchConditional %false %49 %47 - %49 = OpLabel - OpLoopMerge %50 %52 None - OpBranchConditional %false %50 %50 - %52 = OpLabel - OpBranch %49 - %50 = OpLabel - OpBranch %45 - %45 = OpLabel - OpBranch %42 - %47 = OpLabel - OpStore %_GLF_color %red + OpName %2 "main" + OpName %3 "_GLF_color" + OpDecorate %3 Location 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpConstant %6 1 + %8 = OpConstant %6 0 + %9 = OpTypeVector %6 4 + %10 = OpConstantComposite %9 %7 %8 %8 %7 + %11 = OpTypePointer Output %9 + %3 = OpVariable %11 Output + %12 = OpTypeBool + %13 = OpConstantTrue %12 + %14 = OpConstantFalse %12 + %2 = OpFunction %4 None %5 + %15 = OpLabel + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranchConditional %14 %19 %17 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranchConditional %14 %20 %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpBranch %18 + %18 = OpLabel + OpBranch %16 + %17 = OpLabel + OpStore %3 %10 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 -[test] -draw rect -1 -1 2 2 -probe all rgba 1 0 0 1 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber index 113ac09..4163101 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/control-flow-switch.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,10 +15,11 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader with somewhat complex control flow and a switch. # Derived from the following GLSL fragment shader. # We check that all pixels are red. The test passes because the final -# statement writes red to _GLF_color and there are no discard statments. +# statement writes red to _GLF_color and there are no discard statements. # #version 310 es # @@ -80,139 +83,158 @@ # } # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 196 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 72 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "injectionSwitch" - OpName %_ "" - OpName %_GLF_color "_GLF_color" - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %bool = OpTypeBool - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %v2float = OpTypeVector %float 2 - %buf0 = OpTypeStruct %v2float -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Uniform_float = OpTypePointer Uniform %float - %float_0 = OpConstant %float 0 - %true = OpConstantTrue %bool - %73 = OpConstantComposite %v3float %float_0 %float_0 %float_0 - %float_1 = OpConstant %float 1 - %79 = OpConstantComposite %v3float %float_1 %float_1 %float_1 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %96 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %false = OpConstantFalse %bool - %182 = OpUndef %bool - %main = OpFunction %void None %3 - %5 = OpLabel - OpBranch %119 - %119 = OpLabel - OpLoopMerge %120 %121 None - OpBranch %122 - %122 = OpLabel - %123 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 - %124 = OpLoad %float %123 - %125 = OpFOrdNotEqual %bool %124 %float_0 - OpSelectionMerge %129 None - OpBranchConditional %125 %130 %129 - %130 = OpLabel - OpBranch %120 - %129 = OpLabel - OpBranch %141 - %141 = OpLabel - OpLoopMerge %142 %143 None - OpBranch %145 - %145 = OpLabel - %179 = OpPhi %bool %182 %141 %194 %156 - %177 = OpPhi %int %int_0 %141 %169 %156 - %150 = OpSLessThan %bool %177 %int_1 - OpLoopMerge %146 %156 None - OpBranchConditional %150 %151 %146 - %151 = OpLabel - %154 = OpConvertFToS %int %124 - OpSelectionMerge %195 None - OpSwitch %154 %156 9 %157 42 %158 - %195 = OpLabel - OpBranch %156 - %156 = OpLabel - %194 = OpPhi %bool %179 %151 %178 %166 %false %195 - %169 = OpIAdd %int %177 %int_1 - OpBranch %145 - %157 = OpLabel - OpBranch %158 - %158 = OpLabel - %178 = OpPhi %bool %179 %151 %125 %157 - OpSelectionMerge %166 None - OpBranchConditional %178 %167 %166 - %167 = OpLabel - OpBranch %146 - %166 = OpLabel - OpBranch %156 - %146 = OpLabel - %187 = OpPhi %bool %182 %145 %true %167 - %183 = OpPhi %bool %false %145 %true %167 - OpSelectionMerge %171 None - OpBranchConditional %183 %142 %171 - %171 = OpLabel - OpBranch %142 - %143 = OpLabel - OpBranch %141 - %142 = OpLabel - %186 = OpPhi %bool %187 %146 %true %171 - OpSelectionMerge %132 None - OpBranchConditional %186 %133 %132 - %133 = OpLabel - OpBranch %120 - %132 = OpLabel - OpBranch %120 - %121 = OpLabel - OpBranch %119 - %120 = OpLabel - %193 = OpPhi %v3float %73 %130 %79 %133 %79 %132 - %87 = OpCompositeExtract %float %193 0 - %88 = OpCompositeExtract %float %193 1 - %89 = OpCompositeExtract %float %193 2 - %90 = OpCompositeConstruct %v4float %87 %88 %89 %float_1 - OpStore %_GLF_color %90 - %93 = OpFOrdEqual %bool %124 %float_0 - OpSelectionMerge %95 None - OpBranchConditional %93 %94 %95 - %94 = OpLabel - OpStore %_GLF_color %96 - OpBranch %95 - %95 = OpLabel + OpName %2 "main" + OpName %4 "buf0" + OpMemberName %4 0 "injectionSwitch" + OpName %5 "" + OpName %3 "_GLF_color" + OpMemberDecorate %4 0 Offset 0 + OpDecorate %4 Block + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeBool + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 3 + %11 = OpTypeInt 32 1 + %12 = OpConstant %11 0 + %13 = OpConstant %11 1 + %14 = OpTypeVector %9 2 + %4 = OpTypeStruct %14 + %15 = OpTypePointer Uniform %4 + %5 = OpVariable %15 Uniform + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 0 + %18 = OpTypePointer Uniform %9 + %19 = OpConstant %9 0 + %20 = OpConstantTrue %8 + %21 = OpConstantComposite %10 %19 %19 %19 + %22 = OpConstant %9 1 + %23 = OpConstantComposite %10 %22 %22 %22 + %24 = OpTypeVector %9 4 + %25 = OpTypePointer Output %24 + %3 = OpVariable %25 Output + %26 = OpConstantComposite %24 %22 %19 %19 %22 + %27 = OpConstantFalse %8 + %28 = OpUndef %8 + %2 = OpFunction %6 None %7 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpAccessChain %18 %5 %12 %17 + %35 = OpLoad %9 %34 + %36 = OpFOrdNotEqual %8 %35 %19 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpBranch %31 + %37 = OpLabel + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %8 %28 %39 %44 %45 + %46 = OpPhi %11 %12 %39 %47 %45 + %48 = OpSLessThan %8 %46 %13 + OpLoopMerge %49 %45 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpConvertFToS %11 %35 + OpSelectionMerge %52 None + OpSwitch %51 %45 9 %53 42 %54 + %52 = OpLabel + OpBranch %45 + %45 = OpLabel + %44 = OpPhi %8 %43 %50 %55 %56 %27 %52 + %47 = OpIAdd %11 %46 %13 + OpBranch %42 + %53 = OpLabel + OpBranch %54 + %54 = OpLabel + %55 = OpPhi %8 %43 %50 %36 %53 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpBranch %49 + %56 = OpLabel + OpBranch %45 + %49 = OpLabel + %58 = OpPhi %8 %28 %42 %20 %57 + %59 = OpPhi %8 %27 %42 %20 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %40 %60 + %60 = OpLabel + OpBranch %40 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + %61 = OpPhi %8 %58 %49 %20 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + OpBranch %31 + %62 = OpLabel + OpBranch %31 + %32 = OpLabel + OpBranch %30 + %31 = OpLabel + %64 = OpPhi %10 %21 %38 %23 %63 %23 %62 + %65 = OpCompositeExtract %9 %64 0 + %66 = OpCompositeExtract %9 %64 1 + %67 = OpCompositeExtract %9 %64 2 + %68 = OpCompositeConstruct %24 %65 %66 %67 %22 + OpStore %3 %68 + %69 = OpFOrdEqual %8 %35 %19 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpStore %3 %26 + OpBranch %70 + %70 = 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 -[test] -uniform ubo 0:0 vec2 0 0.0 1.0 -draw rect -1 -1 2 2 -probe all rgba 1 0 0 1 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/dead-struct-init.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/dead-struct-init.amber index 6e7ac87..0c1fcd1 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/dead-struct-init.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/dead-struct-init.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses struct initializers. # Derived from the following GLSL fragment shader. # We check that all pixels are red. The test passes because main does @@ -43,56 +46,69 @@ # _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 26 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 23 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %S "S" - OpMemberName %S 0 "b" - OpName %foo_ "foo(" - OpName %_GLF_color "_GLF_color" - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %bool = OpTypeBool - %S = OpTypeStruct %bool - %8 = OpTypeFunction %S - %true = OpConstantTrue %bool - %14 = OpConstantComposite %S %true - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %main = OpFunction %void None %3 - %5 = OpLabel - %18 = OpFunctionCall %S %foo_ - OpStore %_GLF_color %25 + OpName %2 "main" + OpName %4 "S" + OpMemberName %4 0 "b" + OpName %5 "foo(" + OpName %3 "_GLF_color" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeBool + %4 = OpTypeStruct %8 + %9 = OpTypeFunction %4 + %10 = OpConstantTrue %8 + %11 = OpConstantComposite %4 %10 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %3 = OpVariable %14 Output + %15 = OpConstant %12 1 + %16 = OpConstant %12 0 + %17 = OpConstantComposite %13 %15 %16 %16 %15 + %2 = OpFunction %6 None %7 + %18 = OpLabel + %19 = OpFunctionCall %4 %5 + OpStore %3 %17 OpReturn OpFunctionEnd - %foo_ = OpFunction %S None %8 - %10 = OpLabel - OpSelectionMerge %13 None - OpBranchConditional %true %12 %13 - %12 = OpLabel - OpReturnValue %14 - %13 = OpLabel - OpReturnValue %14 + %5 = OpFunction %4 None %9 + %20 = OpLabel + OpSelectionMerge %21 None + OpBranchConditional %10 %22 %21 + %22 = OpLabel + OpReturnValue %11 + %21 = OpLabel + OpReturnValue %11 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 -[test] -draw rect -1 -1 2 2 -probe all rgba 1 0 0 1 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber index e358735..f99386d 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/do-while-loop-in-conditionals.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,8 +18,8 @@ # Short description: A fragment shader with do-while loop in conditional nest -# The test passes because the fragment shader writes a red pixel, and the -# do-while loop is not dynamically reachable +# The test passes because the fragment shader writes red, and the +# do-while loop is not dynamically reachable. # Derived from the following GLSL. @@ -44,12 +46,9 @@ # } # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -113,8 +112,19 @@ fbsize 256 256 %16 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber index baa82c9..f6b7553 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow-2.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,9 +15,10 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses FragCoord and somewhat complex control flow. # Derived from the following GLSL fragment shader. -# We check that the top-left pixel is red. The test passes because _GLF_color is +# We check that all pixels are red. The test passes because _GLF_color is # initially set to red, all other writes to _GLF_color write red, and the discard # statement only executes for pixels with an x coordinate >= 10000000. @@ -51,119 +54,130 @@ # } # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 98 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 63 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %_GLF_color "_GLF_color" - OpName %gl_FragCoord "gl_FragCoord" - OpDecorate %_GLF_color Location 0 - OpDecorate %gl_FragCoord BuiltIn FragCoord - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %bool = OpTypeBool -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float -%int_10000000 = OpConstant %int 10000000 - %88 = OpUndef %v4float - %main = OpFunction %void None %3 - %5 = OpLabel - OpStore %_GLF_color %12 - OpBranch %17 - %17 = OpLabel - %87 = OpPhi %v4float %88 %5 %95 %37 - %82 = OpPhi %int %int_0 %5 %81 %37 - %25 = OpSLessThan %bool %82 %int_1 - OpLoopMerge %19 %37 None - OpBranchConditional %25 %18 %19 - %18 = OpLabel - %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %32 = OpLoad %float %31 - %33 = OpConvertFToS %int %32 - %35 = OpSLessThan %bool %33 %int_10000000 - OpSelectionMerge %96 None - OpBranchConditional %35 %36 %38 - %36 = OpLabel - OpBranch %37 + OpName %2 "main" + OpName %3 "_GLF_color" + OpName %4 "gl_FragCoord" + OpDecorate %3 Location 0 + OpDecorate %4 BuiltIn FragCoord + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeFloat 32 + %8 = OpTypeVector %7 4 + %9 = OpTypePointer Output %8 + %3 = OpVariable %9 Output + %10 = OpConstant %7 1 + %11 = OpConstant %7 0 + %12 = OpConstantComposite %8 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpConstant %13 1 + %16 = OpTypeBool + %17 = OpTypePointer Input %8 + %4 = OpVariable %17 Input + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 0 + %20 = OpTypePointer Input %7 + %21 = OpConstant %13 10000000 + %22 = OpUndef %8 + %2 = OpFunction %5 None %6 + %23 = OpLabel + OpStore %3 %12 + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %8 %22 %23 %26 %27 + %28 = OpPhi %13 %14 %23 %29 %27 + %30 = OpSLessThan %16 %28 %15 + OpLoopMerge %31 %27 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + %33 = OpAccessChain %20 %4 %19 + %34 = OpLoad %7 %33 + %35 = OpConvertFToS %13 %34 + %36 = OpSLessThan %16 %35 %21 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 %38 = OpLabel - OpSelectionMerge %44 None - OpBranchConditional %35 %43 %78 + OpBranch %27 + %39 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %36 %41 %42 + %41 = OpLabel + OpBranch %43 %43 = OpLabel + %44 = OpPhi %13 %14 %41 %45 %46 + %47 = OpSLessThan %16 %44 %15 + OpLoopMerge %48 %46 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpBranch %50 + %50 = OpLabel + %51 = OpPhi %13 %14 %49 %52 %53 + %54 = OpSLessThan %16 %51 %15 + OpLoopMerge %55 %53 None + OpBranchConditional %54 %53 %55 + %53 = OpLabel + OpStore %3 %12 + %52 = OpIAdd %13 %51 %15 + OpBranch %50 + %55 = OpLabel OpBranch %46 %46 = OpLabel - %83 = OpPhi %int %int_0 %43 %64 %56 - %52 = OpSLessThan %bool %83 %int_1 - OpLoopMerge %48 %56 None - OpBranchConditional %52 %47 %48 - %47 = OpLabel - OpBranch %54 - %54 = OpLabel - %89 = OpPhi %int %int_0 %47 %62 %55 - %60 = OpSLessThan %bool %89 %int_1 - OpLoopMerge %97 %55 None - OpBranchConditional %60 %55 %97 - %55 = OpLabel - OpStore %_GLF_color %12 - %62 = OpIAdd %int %89 %int_1 - OpBranch %54 - %97 = OpLabel + %45 = OpIAdd %13 %44 %15 + OpBranch %43 + %48 = OpLabel OpBranch %56 %56 = OpLabel - %64 = OpIAdd %int %83 %int_1 - OpBranch %46 - %48 = OpLabel - OpBranch %66 - %66 = OpLabel - %85 = OpPhi %v4float %87 %48 %12 %67 - %84 = OpPhi %int %int_0 %48 %76 %67 - %72 = OpSLessThan %bool %84 %int_1 - OpLoopMerge %68 %67 None - OpBranchConditional %72 %67 %68 - %67 = OpLabel - %76 = OpIAdd %int %84 %int_1 - OpBranch %66 - %68 = OpLabel - OpStore %_GLF_color %85 - OpBranch %44 - %78 = OpLabel + %57 = OpPhi %8 %25 %48 %12 %58 + %59 = OpPhi %13 %14 %48 %60 %58 + %61 = OpSLessThan %16 %59 %15 + OpLoopMerge %62 %58 None + OpBranchConditional %61 %58 %62 + %58 = OpLabel + %60 = OpIAdd %13 %59 %15 + OpBranch %56 + %62 = OpLabel + OpStore %3 %57 + OpBranch %40 + %42 = OpLabel OpKill - %44 = OpLabel - OpBranch %37 - %96 = OpLabel - OpBranch %37 + %40 = OpLabel + OpBranch %27 %37 = OpLabel - %95 = OpPhi %v4float %87 %36 %85 %44 %88 %96 - %81 = OpIAdd %int %82 %int_1 - OpBranch %17 - %19 = OpLabel + OpBranch %27 + %27 = OpLabel + %26 = OpPhi %8 %25 %38 %57 %40 %22 %37 + %29 = OpIAdd %13 %28 %15 + OpBranch %24 + %31 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber index 4539440..b593a6d 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/fragcoord-control-flow.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses FragCoord and somewhat complex control flow. # Derived from the following GLSL fragment shader. # We check that the top-left pixel is red. The test passes because _GLF_color is @@ -79,231 +82,243 @@ # } while (false); # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 206 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 125 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %_GLF_color "_GLF_color" - OpName %gl_FragCoord "gl_FragCoord" - OpDecorate %_GLF_color Location 0 - OpDecorate %gl_FragCoord BuiltIn FragCoord - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %bool = OpTypeBool -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float - %float_40 = OpConstant %float 40 - %float_140 = OpConstant %float 140 - %float_160 = OpConstant %float 160 - %uint_1 = OpConstant %uint 1 - %float_180 = OpConstant %float 180 - %false = OpConstantFalse %bool - %true = OpConstantTrue %bool - %181 = OpUndef %v4float - %main = OpFunction %void None %3 - %5 = OpLabel - OpBranch %157 - %157 = OpLabel - OpStore %_GLF_color %12 - OpLoopMerge %156 %159 None - OpBranch %17 - %17 = OpLabel - %167 = OpPhi %int %int_0 %157 %44 %41 - %25 = OpSLessThan %bool %167 %int_1 - OpLoopMerge %19 %41 None - OpBranchConditional %25 %18 %19 - %18 = OpLabel - %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %32 = OpLoad %float %31 - %33 = OpFOrdLessThan %bool %float_1 %32 - OpSelectionMerge %35 None - OpBranchConditional %33 %34 %35 - %34 = OpLabel - OpBranch %19 - %35 = OpLabel - %39 = OpFOrdLessThan %bool %32 %float_0 - OpSelectionMerge %201 None - OpBranchConditional %39 %40 %41 - %40 = OpLabel - OpBranch %19 - %201 = OpLabel - OpBranch %41 - %41 = OpLabel - %44 = OpIAdd %int %167 %int_1 - OpBranch %17 - %19 = OpLabel - %168 = OpPhi %bool %false %17 %false %34 %true %40 - OpSelectionMerge %163 None - OpBranchConditional %168 %156 %163 - %163 = OpLabel - OpBranch %45 - %45 = OpLabel - OpLoopMerge %47 %53 None - OpBranch %46 + OpName %2 "main" + OpName %3 "_GLF_color" + OpName %4 "gl_FragCoord" + OpDecorate %3 Location 0 + OpDecorate %4 BuiltIn FragCoord + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeFloat 32 + %8 = OpTypeVector %7 4 + %9 = OpTypePointer Output %8 + %3 = OpVariable %9 Output + %10 = OpConstant %7 1 + %11 = OpConstant %7 0 + %12 = OpConstantComposite %8 %10 %11 %11 %10 + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpConstant %13 1 + %16 = OpTypeBool + %17 = OpTypePointer Input %8 + %4 = OpVariable %17 Input + %18 = OpTypeInt 32 0 + %19 = OpConstant %18 0 + %20 = OpTypePointer Input %7 + %21 = OpConstant %7 40 + %22 = OpConstant %7 140 + %23 = OpConstant %7 160 + %24 = OpConstant %18 1 + %25 = OpConstant %7 180 + %26 = OpConstantFalse %16 + %27 = OpConstantTrue %16 + %28 = OpUndef %8 + %2 = OpFunction %5 None %6 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpStore %3 %12 + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpPhi %13 %14 %30 %35 %36 + %37 = OpSLessThan %16 %34 %15 + OpLoopMerge %38 %36 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %40 = OpAccessChain %20 %4 %19 + %41 = OpLoad %7 %40 + %42 = OpFOrdLessThan %16 %10 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %38 + %43 = OpLabel + %45 = OpFOrdLessThan %16 %41 %11 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %36 + %47 = OpLabel + OpBranch %38 %46 = OpLabel - %49 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %50 = OpLoad %float %49 - %52 = OpFOrdLessThan %bool %50 %float_40 - OpSelectionMerge %202 None - OpBranchConditional %52 %53 %55 - %202 = OpLabel + OpBranch %36 + %36 = OpLabel + %35 = OpIAdd %13 %34 %15 + OpBranch %33 + %38 = OpLabel + %48 = OpPhi %16 %26 %33 %26 %44 %27 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %31 %49 + %49 = OpLabel + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None OpBranch %53 %53 = OpLabel - OpStore %_GLF_color %12 - OpBranchConditional %false %45 %47 - %55 = OpLabel - %59 = OpFOrdLessThan %bool %50 %float_140 - OpSelectionMerge %61 None - OpBranchConditional %59 %60 %62 - %60 = OpLabel - OpBranch %61 + %54 = OpAccessChain %20 %4 %19 + %55 = OpLoad %7 %54 + %56 = OpFOrdLessThan %16 %55 %21 + OpSelectionMerge %57 None + OpBranchConditional %56 %52 %58 + %57 = OpLabel + OpBranch %52 + %52 = OpLabel + OpStore %3 %12 + OpBranchConditional %26 %50 %51 + %58 = OpLabel + %59 = OpFOrdLessThan %16 %55 %22 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 %62 = OpLabel - OpBranch %64 - %64 = OpLabel - %176 = OpPhi %v4float %181 %62 %197 %76 - %171 = OpPhi %int %int_1 %62 %153 %76 - %70 = OpSGreaterThan %bool %171 %int_0 - OpLoopMerge %66 %76 None - OpBranchConditional %70 %65 %66 - %65 = OpLabel - %74 = OpFOrdLessThan %bool %50 %float_160 - OpSelectionMerge %203 None - OpBranchConditional %74 %75 %94 - %75 = OpLabel - OpBranch %78 - %78 = OpLabel - %185 = OpPhi %int %int_1 %75 %93 %90 - %84 = OpSGreaterThan %bool %185 %int_0 - OpLoopMerge %80 %90 None - OpBranchConditional %84 %79 %80 + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %8 %28 %62 %65 %66 + %67 = OpPhi %13 %15 %62 %68 %66 + %69 = OpSGreaterThan %16 %67 %14 + OpLoopMerge %70 %66 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpFOrdLessThan %16 %55 %23 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %76 + %76 = OpLabel + %77 = OpPhi %13 %15 %74 %78 %79 + %80 = OpSGreaterThan %16 %77 %14 + OpLoopMerge %81 %79 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpAccessChain %20 %4 %24 + %84 = OpLoad %7 %83 + %85 = OpFOrdLessThan %16 %84 %11 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %79 + %88 = OpLabel + OpStore %3 %12 + OpBranch %79 + %86 = OpLabel + OpBranch %79 %79 = OpLabel - %86 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 - %87 = OpLoad %float %86 - %88 = OpFOrdLessThan %bool %87 %float_0 - OpSelectionMerge %204 None - OpBranchConditional %88 %89 %91 - %89 = OpLabel - OpBranch %90 + %78 = OpISub %13 %77 %15 + OpBranch %76 + %81 = OpLabel + OpBranch %66 + %75 = OpLabel + %89 = OpFOrdLessThan %16 %55 %25 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 %91 = OpLabel - OpStore %_GLF_color %12 - OpBranch %90 - %204 = OpLabel + OpBranch %93 + %93 = OpLabel + %94 = OpPhi %13 %15 %91 %95 %96 + %97 = OpINotEqual %16 %94 %14 + OpLoopMerge %98 %96 None + OpBranchConditional %97 %96 %98 + %96 = OpLabel + OpStore %3 %12 + %95 = OpISub %13 %94 %15 + OpBranch %93 + %98 = OpLabel OpBranch %90 - %90 = OpLabel - %93 = OpISub %int %185 %int_1 - OpBranch %78 - %80 = OpLabel - OpBranch %76 - %94 = OpLabel - %98 = OpFOrdLessThan %bool %50 %float_180 - OpSelectionMerge %100 None - OpBranchConditional %98 %99 %111 - %99 = OpLabel + %92 = OpLabel + OpSelectionMerge %99 None + OpBranchConditional %89 %100 %101 + %100 = OpLabel OpBranch %102 %102 = OpLabel - %184 = OpPhi %int %int_1 %99 %110 %103 - %108 = OpINotEqual %bool %184 %int_0 - OpLoopMerge %104 %103 None - OpBranchConditional %108 %103 %104 - %103 = OpLabel - OpStore %_GLF_color %12 - %110 = OpISub %int %184 %int_1 + %103 = OpPhi %13 %14 %100 %104 %105 + %106 = OpINotEqual %16 %103 %15 + OpLoopMerge %107 %105 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpPhi %13 %14 %108 %111 %112 + %113 = OpSLessThan %16 %110 %15 + OpLoopMerge %114 %112 None + OpBranchConditional %113 %112 %114 + %112 = OpLabel + OpStore %3 %12 + %111 = OpIAdd %13 %110 %15 + OpBranch %109 + %114 = OpLabel + OpBranch %105 + %105 = OpLabel + %104 = OpIAdd %13 %103 %15 OpBranch %102 - %104 = OpLabel - OpBranch %100 - %111 = OpLabel - OpSelectionMerge %116 None - OpBranchConditional %98 %115 %150 + %107 = OpLabel + OpBranch %115 %115 = OpLabel - OpBranch %118 - %118 = OpLabel - %172 = OpPhi %int %int_0 %115 %136 %128 - %124 = OpINotEqual %bool %172 %int_1 - OpLoopMerge %120 %128 None - OpBranchConditional %124 %119 %120 - %119 = OpLabel - OpBranch %126 - %126 = OpLabel - %182 = OpPhi %int %int_0 %119 %134 %127 - %132 = OpSLessThan %bool %182 %int_1 - OpLoopMerge %205 %127 None - OpBranchConditional %132 %127 %205 - %127 = OpLabel - OpStore %_GLF_color %12 - %134 = OpIAdd %int %182 %int_1 - OpBranch %126 - %205 = OpLabel - OpBranch %128 - %128 = OpLabel - %136 = OpIAdd %int %172 %int_1 - OpBranch %118 - %120 = OpLabel - OpBranch %138 - %138 = OpLabel - %174 = OpPhi %v4float %176 %120 %12 %139 - %173 = OpPhi %int %int_1 %120 %148 %139 - %144 = OpINotEqual %bool %173 %int_0 - OpLoopMerge %140 %139 None - OpBranchConditional %144 %139 %140 - %139 = OpLabel - %148 = OpISub %int %173 %int_1 - OpBranch %138 - %140 = OpLabel - OpStore %_GLF_color %174 - OpBranch %116 - %150 = OpLabel + %116 = OpPhi %8 %64 %107 %12 %117 + %118 = OpPhi %13 %15 %107 %119 %117 + %120 = OpINotEqual %16 %118 %14 + OpLoopMerge %121 %117 None + OpBranchConditional %120 %117 %121 + %117 = OpLabel + %119 = OpISub %13 %118 %15 + OpBranch %115 + %121 = OpLabel + OpStore %3 %116 + OpBranch %99 + %101 = OpLabel OpKill - %116 = OpLabel - OpBranch %100 - %100 = OpLabel - %200 = OpPhi %v4float %176 %104 %174 %116 - OpBranch %76 - %203 = OpLabel - OpBranch %76 - %76 = OpLabel - %197 = OpPhi %v4float %176 %80 %200 %100 %181 %203 - %153 = OpISub %int %171 %int_1 - OpBranch %64 + %99 = OpLabel + OpBranch %90 + %90 = OpLabel + %122 = OpPhi %8 %64 %98 %116 %99 + OpBranch %66 + %73 = OpLabel + OpBranch %66 %66 = OpLabel - OpBranch %61 - %61 = OpLabel - OpBranch %47 - %47 = OpLabel - %194 = OpPhi %bool %true %61 %168 %53 - OpSelectionMerge %165 None - OpBranchConditional %194 %156 %165 - %165 = OpLabel - OpBranch %156 - %159 = OpLabel - OpBranch %157 - %156 = OpLabel + %65 = OpPhi %8 %64 %81 %122 %90 %28 %73 + %68 = OpISub %13 %67 %15 + OpBranch %63 + %70 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %51 + %51 = OpLabel + %123 = OpPhi %16 %27 %60 %48 %52 + OpSelectionMerge %124 None + OpBranchConditional %123 %31 %124 + %124 = OpLabel + OpBranch %31 + %32 = OpLabel + OpBranch %30 + %31 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/if-and-switch.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/if-and-switch.amber index 1b3157e..377dfb3 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/if-and-switch.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/if-and-switch.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +18,7 @@ # Short description: A fragment shader with a switch and some data flow -# Checks that the top-left pixel is red. +# Checks that all pixels are red. # Passes because main always writes red to _GLF_color. # Optimized using spirv-opt with the following arguments: @@ -59,12 +61,9 @@ # } # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -144,12 +143,27 @@ fbsize 256 256 %39 = OpLabel OpReturn OpFunctionEnd +END +# uniforms for variant -[test] -## Uniforms # injectionSwitch -uniform ubo 0:0 vec2 0 0.0 1.0 +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 -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber index ef6c7d4..0b11bab 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-deep-control-flow.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses an array of matrices and has deep control flow. # Derived from the following GLSL fragment shader. # We check that the top-left pixel is red. The test passes because the @@ -54,121 +57,133 @@ # } # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 106 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 68 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %gl_FragCoord "gl_FragCoord" - OpName %_GLF_color "_GLF_color" - OpName %m "m" - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float - %float_10 = OpConstant %float 10 - %bool = OpTypeBool -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 -%mat4v4float = OpTypeMatrix %v4float 4 - %36 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %37 = OpConstantComposite %mat4v4float %36 %36 %36 %36 - %uint_4 = OpConstant %uint 4 -%_arr_mat4v4float_uint_4 = OpTypeArray %mat4v4float %uint_4 -%_ptr_Function__arr_mat4v4float_uint_4 = OpTypePointer Function %_arr_mat4v4float_uint_4 - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %int_4 = OpConstant %int 4 - %v2float = OpTypeVector %float 2 - %70 = OpConstantComposite %v2float %float_1 %float_1 - %int_1 = OpConstant %int 1 - %uint_3 = OpConstant %uint 3 -%_ptr_Function_float = OpTypePointer Function %float - %103 = OpConstantComposite %_arr_mat4v4float_uint_4 %37 %37 %37 %37 - %main = OpFunction %void None %3 - %5 = OpLabel - %m = OpVariable %_ptr_Function__arr_mat4v4float_uint_4 Function - OpBranch %92 - %92 = OpLabel - OpLoopMerge %91 %94 None - OpBranch %93 - %93 = OpLabel - %13 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %14 = OpLoad %float %13 - %17 = OpFOrdLessThan %bool %14 %float_10 - OpSelectionMerge %19 None - OpBranchConditional %17 %18 %19 - %18 = OpLabel - OpStore %_GLF_color %24 - OpBranch %91 - %19 = OpLabel - OpStore %m %103 - OpBranch %51 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "m" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypePointer Input %9 + %3 = OpVariable %10 Input + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 0 + %13 = OpTypePointer Input %8 + %14 = OpConstant %8 10 + %15 = OpTypeBool + %16 = OpTypePointer Output %9 + %4 = OpVariable %16 Output + %17 = OpConstant %8 1 + %18 = OpConstant %8 0 + %19 = OpConstantComposite %9 %17 %18 %18 %17 + %20 = OpTypeMatrix %9 4 + %21 = OpConstantComposite %9 %17 %17 %17 %17 + %22 = OpConstantComposite %20 %21 %21 %21 %21 + %23 = OpConstant %11 4 + %24 = OpTypeArray %20 %23 + %25 = OpTypePointer Function %24 + %26 = OpTypeInt 32 1 + %27 = OpConstant %26 0 + %28 = OpConstant %26 4 + %29 = OpTypeVector %8 2 + %30 = OpConstantComposite %29 %17 %17 + %31 = OpConstant %26 1 + %32 = OpConstant %11 3 + %33 = OpTypePointer Function %8 + %34 = OpConstantComposite %24 %22 %22 %22 %22 + %2 = OpFunction %6 None %7 + %35 = OpLabel + %5 = OpVariable %25 Function + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %13 %3 %12 + %41 = OpLoad %8 %40 + %42 = OpFOrdLessThan %15 %41 %14 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %4 %19 + OpBranch %37 + %43 = OpLabel + OpStore %5 %34 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %26 %27 %43 %47 %48 + %49 = OpSLessThan %15 %46 %28 + OpLoopMerge %50 %48 None + OpBranchConditional %49 %51 %50 %51 = OpLabel - %98 = OpPhi %int %int_0 %19 %90 %62 - %58 = OpSLessThan %bool %98 %int_4 - OpLoopMerge %53 %62 None - OpBranchConditional %58 %52 %53 + OpBranch %52 %52 = OpLabel - OpBranch %60 - %60 = OpLabel - %99 = OpPhi %int %int_0 %52 %88 %86 - %66 = OpSLessThan %bool %99 %int_4 - OpLoopMerge %104 %86 None - OpBranchConditional %66 %61 %104 - %61 = OpLabel - %74 = OpSelect %int %66 %int_1 %int_0 - %78 = OpAccessChain %_ptr_Function_float %m %74 %98 %uint_3 - %79 = OpLoad %float %78 - %80 = OpCompositeConstruct %v2float %79 %79 - %81 = OpFDiv %v2float %70 %80 - %83 = OpExtInst %float %1 Distance %70 %81 - %84 = OpFOrdLessThan %bool %83 %float_1 - OpSelectionMerge %105 None - OpBranchConditional %84 %85 %86 - %85 = OpLabel - OpStore %_GLF_color %36 - OpBranch %86 - %105 = OpLabel - OpBranch %86 - %86 = OpLabel - %88 = OpIAdd %int %99 %int_1 - OpBranch %60 - %104 = OpLabel - OpBranch %62 - %62 = OpLabel - %90 = OpIAdd %int %98 %int_1 - OpBranch %51 - %53 = OpLabel - OpBranch %91 - %94 = OpLabel - OpBranch %92 - %91 = OpLabel + %53 = OpPhi %26 %27 %51 %54 %55 + %56 = OpSLessThan %15 %53 %28 + OpLoopMerge %57 %55 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpSelect %26 %56 %31 %27 + %60 = OpAccessChain %33 %5 %59 %46 %32 + %61 = OpLoad %8 %60 + %62 = OpCompositeConstruct %29 %61 %61 + %63 = OpFDiv %29 %30 %62 + %64 = OpExtInst %8 %1 Distance %30 %63 + %65 = OpFOrdLessThan %15 %64 %17 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %55 + %67 = OpLabel + OpStore %4 %21 + OpBranch %55 + %66 = OpLabel + OpBranch %55 + %55 = OpLabel + %54 = OpIAdd %26 %53 %31 + OpBranch %52 + %57 = OpLabel + OpBranch %48 + %48 = OpLabel + %47 = OpIAdd %26 %46 %31 + OpBranch %45 + %50 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-distance.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-distance.amber index a5658ef..688fff3 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-distance.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/mat-array-distance.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses an array of matrices and distance. # Derived from the following GLSL fragment shader. # We check that the top-left pixel is red. The test passes because the @@ -49,130 +52,141 @@ # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 100 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 75 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %gl_FragCoord "gl_FragCoord" - OpName %_GLF_color "_GLF_color" - OpName %m "m" - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float - %float_10 = OpConstant %float 10 - %bool = OpTypeBool -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 -%mat4v4float = OpTypeMatrix %v4float 4 - %uint_4 = OpConstant %uint 4 -%_arr_mat4v4float_uint_4 = OpTypeArray %mat4v4float %uint_4 -%_ptr_Function__arr_mat4v4float_uint_4 = OpTypePointer Function %_arr_mat4v4float_uint_4 - %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0 - %32 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 - %33 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_0 - %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 - %35 = OpConstantComposite %mat4v4float %31 %32 %33 %34 - %36 = OpConstantComposite %_arr_mat4v4float_uint_4 %35 %35 %35 %35 - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %int_4 = OpConstant %int 4 - %int_2 = OpConstant %int 2 - %int_1 = OpConstant %int 1 - %v2float = OpTypeVector %float 2 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %76 = OpConstantComposite %v2float %float_1 %float_1 - %82 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %main = OpFunction %void None %3 - %5 = OpLabel - %m = OpVariable %_ptr_Function__arr_mat4v4float_uint_4 Function - OpBranch %88 - %88 = OpLabel - OpLoopMerge %87 %90 None - OpBranch %89 - %89 = OpLabel - %13 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %14 = OpLoad %float %13 - %17 = OpFOrdLessThan %bool %14 %float_10 - OpSelectionMerge %19 None - OpBranchConditional %17 %18 %19 - %18 = OpLabel - OpStore %_GLF_color %24 - OpBranch %87 - %19 = OpLabel - OpStore %m %36 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "m" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 4 + %10 = OpTypePointer Input %9 + %3 = OpVariable %10 Input + %11 = OpTypeInt 32 0 + %12 = OpConstant %11 0 + %13 = OpTypePointer Input %8 + %14 = OpConstant %8 10 + %15 = OpTypeBool + %16 = OpTypePointer Output %9 + %4 = OpVariable %16 Output + %17 = OpConstant %8 1 + %18 = OpConstant %8 0 + %19 = OpConstantComposite %9 %17 %18 %18 %17 + %20 = OpTypeMatrix %9 4 + %21 = OpConstant %11 4 + %22 = OpTypeArray %20 %21 + %23 = OpTypePointer Function %22 + %24 = OpConstantComposite %9 %17 %18 %18 %18 + %25 = OpConstantComposite %9 %18 %17 %18 %18 + %26 = OpConstantComposite %9 %18 %18 %17 %18 + %27 = OpConstantComposite %9 %18 %18 %18 %17 + %28 = OpConstantComposite %20 %24 %25 %26 %27 + %29 = OpConstantComposite %22 %28 %28 %28 %28 + %30 = OpTypeInt 32 1 + %31 = OpConstant %30 0 + %32 = OpConstant %30 4 + %33 = OpConstant %30 2 + %34 = OpConstant %30 1 + %35 = OpTypeVector %8 2 + %36 = OpTypePointer Function %9 + %37 = OpConstantComposite %35 %17 %17 + %38 = OpConstantComposite %9 %17 %17 %17 %17 + %2 = OpFunction %6 None %7 + %39 = OpLabel + %5 = OpVariable %23 Function + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpAccessChain %13 %3 %12 + %45 = OpLoad %8 %44 + %46 = OpFOrdLessThan %15 %45 %14 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpStore %4 %19 OpBranch %41 - %41 = OpLabel - %95 = OpPhi %int %int_0 %19 %86 %53 - %48 = OpSLessThan %bool %95 %int_4 - OpLoopMerge %43 %53 None - OpBranchConditional %48 %42 %43 - %42 = OpLabel - OpBranch %51 - %51 = OpLabel - %97 = OpPhi %int %int_0 %42 %66 %81 - %96 = OpPhi %int %int_0 %42 %84 %81 - %57 = OpSLessThan %bool %96 %int_4 - OpLoopMerge %98 %81 None - OpBranchConditional %57 %52 %98 + %47 = OpLabel + OpStore %5 %29 + OpBranch %49 + %49 = OpLabel + %50 = OpPhi %30 %31 %47 %51 %52 + %53 = OpSLessThan %15 %50 %32 + OpLoopMerge %54 %52 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %56 + %56 = OpLabel + %57 = OpPhi %30 %31 %55 %58 %59 + %60 = OpPhi %30 %31 %55 %61 %59 + %62 = OpSLessThan %15 %60 %32 + OpLoopMerge %63 %59 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpSGreaterThanEqual %15 %57 %33 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + OpBranch %63 + %66 = OpLabel + %58 = OpIAdd %30 %57 %34 + %68 = OpAccessChain %36 %5 %60 %50 + %69 = OpLoad %9 %68 + %70 = OpVectorShuffle %35 %69 %69 0 1 + %71 = OpExtInst %8 %1 Distance %37 %70 + %72 = OpFOrdLessThan %15 %71 %17 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %59 + %74 = OpLabel + OpStore %4 %38 + OpBranch %59 + %73 = OpLabel + OpBranch %59 + %59 = OpLabel + %61 = OpIAdd %30 %60 %34 + OpBranch %56 + %63 = OpLabel + OpBranch %52 %52 = OpLabel - %60 = OpSGreaterThanEqual %bool %97 %int_2 - OpSelectionMerge %62 None - OpBranchConditional %60 %61 %62 - %61 = OpLabel - OpBranch %98 - %62 = OpLabel - %66 = OpIAdd %int %97 %int_1 - %73 = OpAccessChain %_ptr_Function_v4float %m %96 %95 - %74 = OpLoad %v4float %73 - %75 = OpVectorShuffle %v2float %74 %74 0 1 - %78 = OpExtInst %float %1 Distance %76 %75 - %79 = OpFOrdLessThan %bool %78 %float_1 - OpSelectionMerge %99 None - OpBranchConditional %79 %80 %81 - %80 = OpLabel - OpStore %_GLF_color %82 - OpBranch %81 - %99 = OpLabel - OpBranch %81 - %81 = OpLabel - %84 = OpIAdd %int %96 %int_1 - OpBranch %51 - %98 = OpLabel - OpBranch %53 - %53 = OpLabel - %86 = OpIAdd %int %95 %int_1 + %51 = OpIAdd %30 %50 %34 + OpBranch %49 + %54 = OpLabel OpBranch %41 - %43 = OpLabel - OpBranch %87 - %90 = OpLabel - OpBranch %88 - %87 = OpLabel + %42 = OpLabel + OpBranch %40 + %41 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber index 1c1fd09..9128c66 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/matrices-and-return-in-loop.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +18,7 @@ # Short description: A fragment shader with matrices and a return in a loop -# Checks that the top-left pixel is red. +# Checks that all pixels are red. # Passes because main always writes red to _GLF_color. # Optimized using spirv-opt with the following arguments: @@ -52,12 +54,9 @@ # _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -135,8 +134,20 @@ fbsize 256 256 %17 = OpLabel OpUnreachable 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber index 24c6d98..b1a4895 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/nested-ifs-and-return-in-for-loop.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,9 +18,9 @@ # Short description: A fragment shader with return in nest of ifs, inside loop -# The test passes because the fragment shader writes a red pixel, and then -# terminates without further output manipulation (the other write of red -# is not dynamically reachable) +# The test passes because the fragment shader assigns red to _GLF_color then +# assigns black to _GLF_color in the loop. The other assignment to _GLF_color +# (in the if statement) is not dynamically reachable. # Derived from the following GLSL. @@ -54,12 +56,9 @@ # } # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -148,12 +147,28 @@ fbsize 256 256 %19 = OpLabel OpReturn OpFunctionEnd +END + +# uniforms for variant -[test] -## Uniforms # injectionSwitch -uniform ubo 0:0 vec2 0 0.0 1.0 +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 -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 1, 1, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 255 255 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/pow-vec4.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/pow-vec4.amber index e2281f9..7738d87 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/pow-vec4.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/pow-vec4.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses pow. # Derived from the following GLSL fragment shader. # We check that all pixels are red. The test passes because main does @@ -33,58 +36,69 @@ # _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 +; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %a "a" - OpName %b "b" - OpName %_GLF_color "_GLF_color" - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 -%_ptr_Function_v2float = OpTypePointer Function %v2float - %float_1 = OpConstant %float 1 - %11 = OpConstantComposite %v2float %float_1 %float_1 - %v4float = OpTypeVector %float 4 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_0 = OpConstant %float 0 - %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %main = OpFunction %void None %3 - %5 = OpLabel - %a = OpVariable %_ptr_Function_v2float Function - %b = OpVariable %_ptr_Function_v4float Function - OpStore %a %11 - OpStore %b %15 - %16 = OpLoad %v2float %a - %17 = OpCompositeExtract %float %16 0 - %18 = OpCompositeExtract %float %16 1 - %19 = OpCompositeExtract %float %11 0 - %20 = OpCompositeExtract %float %11 1 - %21 = OpCompositeConstruct %v4float %17 %18 %19 %20 - %22 = OpLoad %v4float %b - %23 = OpExtInst %v4float %1 Pow %21 %22 - OpStore %_GLF_color %27 + OpName %2 "main" + OpName %4 "a" + OpName %5 "b" + OpName %3 "_GLF_color" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeFloat 32 + %9 = OpTypeVector %8 2 + %10 = OpTypePointer Function %9 + %11 = OpConstant %8 1 + %12 = OpConstantComposite %9 %11 %11 + %13 = OpTypeVector %8 4 + %14 = OpTypePointer Function %13 + %15 = OpConstantComposite %13 %11 %11 %11 %11 + %16 = OpTypePointer Output %13 + %3 = OpVariable %16 Output + %17 = OpConstant %8 0 + %18 = OpConstantComposite %13 %11 %17 %17 %11 + %2 = OpFunction %6 None %7 + %19 = OpLabel + %4 = OpVariable %10 Function + %5 = OpVariable %14 Function + OpStore %4 %12 + OpStore %5 %15 + %20 = OpLoad %9 %4 + %21 = OpCompositeExtract %8 %20 0 + %22 = OpCompositeExtract %8 %20 1 + %23 = OpCompositeExtract %8 %12 0 + %24 = OpCompositeExtract %8 %12 1 + %25 = OpCompositeConstruct %13 %21 %22 %23 %24 + %26 = OpLoad %13 %5 + %27 = OpExtInst %13 %1 Pow %25 %26 + OpStore %3 %18 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 -[test] -draw rect -1 -1 2 2 -probe all rgba 1 0 0 1 +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber index dfd6569..768f16f 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/return-in-loop-in-function.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,9 +18,8 @@ # Short description: A fragment shader with early return from loop in function -# The test passes because the fragment shader writes a red pixel, and then -# terminates without further output manipulation (the other write of red -# is not dynamically reachable) +# The test passes because the fragment shader writes red. The f function always +# returns 1.0, so c is unchanged. # Optimized using spirv-opt with the following arguments: # '--merge-blocks' @@ -62,12 +63,9 @@ # _GLF_color = c; # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -168,8 +166,19 @@ fbsize 256 256 %16 = OpLabel OpReturnValue %25 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber index 9b0ac43..0ba9262 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/swizzle-struct-init-min.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses vector swizzles, struct initializers, and min. # Derived from the following GLSL fragment shader. # We check that the top-left pixel is red. The test passes because the @@ -47,90 +50,108 @@ # _GLF_color = vec4(v4.x, 0.0, 0.0, 1.0); # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 63 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 45 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %gl_FragCoord "gl_FragCoord" - OpName %_GLF_color "_GLF_color" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "injectionSwitch" - OpName %_ "" - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_GLF_color Location 0 - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float - %float_10 = OpConstant %float 10 - %bool = OpTypeBool -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %v2float = OpTypeVector %float 2 - %buf0 = OpTypeStruct %v2float -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %uint_1 = OpConstant %uint 1 -%_ptr_Uniform_float = OpTypePointer Uniform %float - %49 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %main = OpFunction %void None %3 - %5 = OpLabel - OpBranch %60 - %60 = OpLabel - OpLoopMerge %59 %62 None - OpBranch %61 - %61 = OpLabel - %13 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %14 = OpLoad %float %13 - %17 = OpFOrdLessThan %bool %14 %float_10 - OpSelectionMerge %19 None - OpBranchConditional %17 %18 %19 - %18 = OpLabel - OpStore %_GLF_color %24 - OpBranch %59 - %19 = OpLabel - %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 - %37 = OpLoad %float %36 - %38 = OpCompositeConstruct %v4float %37 %37 %37 %37 - %48 = OpVectorShuffle %v4float %38 %38 4 5 2 3 - %51 = OpExtInst %v4float %1 FMin %49 %48 - %57 = OpCompositeExtract %float %51 0 - %58 = OpCompositeConstruct %v4float %57 %float_0 %float_0 %float_1 - OpStore %_GLF_color %58 - OpBranch %59 - %62 = OpLabel - OpBranch %60 - %59 = OpLabel + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "buf0" + OpMemberName %5 0 "injectionSwitch" + OpName %6 "" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %5 Block + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %3 = OpVariable %11 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %9 + %15 = OpConstant %9 10 + %16 = OpTypeBool + %17 = OpTypePointer Output %10 + %4 = OpVariable %17 Output + %18 = OpConstant %9 1 + %19 = OpConstant %9 0 + %20 = OpConstantComposite %10 %18 %19 %19 %18 + %21 = OpTypeVector %9 2 + %5 = OpTypeStruct %21 + %22 = OpTypePointer Uniform %5 + %6 = OpVariable %22 Uniform + %23 = OpTypeInt 32 1 + %24 = OpConstant %23 0 + %25 = OpConstant %12 1 + %26 = OpTypePointer Uniform %9 + %27 = OpConstantComposite %10 %18 %18 %18 %18 + %2 = OpFunction %7 None %8 + %28 = OpLabel + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpAccessChain %14 %3 %13 + %34 = OpLoad %9 %33 + %35 = OpFOrdLessThan %16 %34 %15 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + OpStore %4 %20 + OpBranch %30 + %36 = OpLabel + %38 = OpAccessChain %26 %6 %24 %25 + %39 = OpLoad %9 %38 + %40 = OpCompositeConstruct %10 %39 %39 %39 %39 + %41 = OpVectorShuffle %10 %40 %40 4 5 2 3 + %42 = OpExtInst %10 %1 FMin %27 %41 + %43 = OpCompositeExtract %9 %42 0 + %44 = OpCompositeConstruct %10 %43 %19 %19 %18 + OpStore %4 %44 + OpBranch %30 + %31 = OpLabel + OpBranch %29 + %30 = 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 -[test] -uniform ubo 0:0 vec2 0 0.0 1.0 -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber index 2becdff..eb219b7 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/unreachable-loops-in-switch.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +19,7 @@ # Short description: A fragment shader with unreachable loops in a switch # The test passes because the fragment shader writes a red pixel, and then -# terminates without further output manipulation +# terminates without further output manipulation. # Derived from the following GLSL. @@ -49,12 +51,9 @@ # } # } -[require] -fbsize 256 256 - -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 @@ -176,8 +175,19 @@ fbsize 256 256 %19 = 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 -[test] -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/while-inside-switch.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/while-inside-switch.amber index ecdde7d..4df6a07 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/while-inside-switch.amber +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/while-inside-switch.amber @@ -1,3 +1,5 @@ +#!amber + # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +15,7 @@ # limitations under the License. # A test for a bug found by GraphicsFuzz. + # A fragment shader that uses a while loop inside a switch. # Derived from the following GLSL fragment shader. # We check that the top-left pixel is red. The test passes because the @@ -48,98 +51,116 @@ # return; # } -[vertex shader passthrough] +SHADER vertex variant_vertex_shader PASSTHROUGH -[fragment shader spirv] +SHADER fragment variant_fragment_shader SPIRV-ASM ; SPIR-V ; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 7 -; Bound: 51 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 45 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft OpSource ESSL 310 - OpName %main "main" - OpName %gl_FragCoord "gl_FragCoord" - OpName %_GLF_color "_GLF_color" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "injectionSwitch" - OpName %_ "" - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_GLF_color Location 0 - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float - %float_10 = OpConstant %float 10 - %bool = OpTypeBool -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %v2float = OpTypeVector %float 2 - %buf0 = OpTypeStruct %v2float -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Uniform_float = OpTypePointer Uniform %float - %main = OpFunction %void None %3 - %5 = OpLabel - OpBranch %48 - %48 = OpLabel - OpLoopMerge %47 %50 None - OpBranch %49 - %49 = OpLabel - %13 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %14 = OpLoad %float %13 - %17 = OpFOrdLessThan %bool %14 %float_10 - OpSelectionMerge %19 None - OpBranchConditional %17 %18 %19 - %18 = OpLabel - OpStore %_GLF_color %24 - OpBranch %47 - %19 = OpLabel - %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 - %34 = OpLoad %float %33 - %35 = OpConvertFToS %int %34 - OpSelectionMerge %37 None - OpSwitch %35 %37 0 %36 - %36 = OpLabel - OpBranch %38 - %38 = OpLabel - OpLoopMerge %40 %41 None - OpBranch %39 - %39 = OpLabel - OpKill - %41 = OpLabel - OpBranch %38 + OpName %2 "main" + OpName %3 "gl_FragCoord" + OpName %4 "_GLF_color" + OpName %5 "buf0" + OpMemberName %5 0 "injectionSwitch" + OpName %6 "" + OpDecorate %3 BuiltIn FragCoord + OpDecorate %4 Location 0 + OpMemberDecorate %5 0 Offset 0 + OpDecorate %5 Block + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %3 = OpVariable %11 Input + %12 = OpTypeInt 32 0 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %9 + %15 = OpConstant %9 10 + %16 = OpTypeBool + %17 = OpTypePointer Output %10 + %4 = OpVariable %17 Output + %18 = OpConstant %9 1 + %19 = OpConstant %9 0 + %20 = OpConstantComposite %10 %18 %19 %19 %18 + %21 = OpTypeVector %9 2 + %5 = OpTypeStruct %21 + %22 = OpTypePointer Uniform %5 + %6 = OpVariable %22 Uniform + %23 = OpTypeInt 32 1 + %24 = OpConstant %23 0 + %25 = OpTypePointer Uniform %9 + %2 = OpFunction %7 None %8 + %26 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpAccessChain %14 %3 %13 + %32 = OpLoad %9 %31 + %33 = OpFOrdLessThan %16 %32 %15 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpStore %4 %20 + OpBranch %28 + %34 = OpLabel + %36 = OpAccessChain %25 %6 %24 %13 + %37 = OpLoad %9 %36 + %38 = OpConvertFToS %23 %37 + OpSelectionMerge %39 None + OpSwitch %38 %39 0 %40 %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + OpKill + %43 = OpLabel + OpBranch %41 + %42 = OpLabel OpUnreachable - %37 = OpLabel - OpStore %_GLF_color %24 - OpBranch %47 - %50 = OpLabel - OpBranch %48 - %47 = OpLabel + %39 = OpLabel + OpStore %4 %20 + OpBranch %28 + %29 = OpLabel + OpBranch %27 + %28 = 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 -[test] -uniform ubo 0:0 vec2 0 0.0 1.0 -draw rect -1 -1 2 2 -probe rgba (0, 0) (1, 0, 0, 1) +EXPECT variant_framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255 -- 2.7.4