Merge vk-gl-cts/vulkan-cts-1.1.6 into vk-gl-cts/master
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / amber / vktAmberGraphicsFuzzTests.cpp
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2018 Intel Corporation
6  * Copyright (c) 2018 Google LLC
7  * Copyright (c) 2019 The Khronos Group Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief GraphicsFuzz tests
24  *//*--------------------------------------------------------------------*/
25
26 #include "vktTestGroupUtil.hpp"
27 #include "vktAmberGraphicsFuzzTests.hpp"
28 #include "vktAmberTestCase.hpp"
29
30 namespace vkt
31 {
32 namespace cts_amber
33 {
34 namespace
35 {
36
37 void createAmberTests (tcu::TestCaseGroup* group)
38 {
39         tcu::TestContext& testCtx = group->getTestContext();
40
41         static const struct
42         {
43                 const std::string       filename;
44                 const char*                     name;
45                 const char*                     description;
46         }
47         tests[] =
48         {
49                 {       "always-false-if-with-discard-return.amber",    "always-false-if-with-discard-return",  "A fragment shader with discard keyword and a return"                                                                   },
50                 {       "barrier-in-loop-with-break.amber",                             "barrier-in-loop-with-break",                   "A compute shader with a barrier in a loop with a break"                                                                },
51                 {       "color-write-in-loop.amber",                                    "color-write-in-loop",                                  "A fragment shader that writes to color in a loop"                                                                              },
52                 {       "complex-nested-loops-and-call.amber",                  "complex-nested-loops-and-call",                "A fragment shader with complex nested loops, breaks, etc."                                                             },
53                 {       "continue-and-merge.amber",                                             "continue-and-merge",                                   "A fragment shader with two nested loops"                                                                                               },
54                 {       "control-flow-in-function.amber",                               "control-flow-in-function",                             "A fragment shader with a lot of control flow"                                                                                  },
55                 {       "control-flow-switch.amber",                                    "control-flow-switch",                                  "A fragment shader with somewhat complex control flow and a switch"                                             },
56                 {       "dead-barriers-in-loops.amber",                                 "dead-barriers-in-loops",                               "A compute shader with dead barriers"                                                                                                   },
57                 {       "dead-struct-init.amber",                                               "dead-struct-init",                                             "A fragment shader that uses struct initializers"                                                                               },
58                 {       "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"                                                    },
59                 {       "discard-continue-return.amber",                                "discard-continue-return",                              "A fragment shader with a discard, continue, and return"                                                                },
60                 {       "discard-in-array-manipulating-loop.amber",             "discard-in-array-manipulating-loop",   "An array-manipulating fragment shader with a discard"                                                                  },
61                 {       "do-while-loop-in-conditionals.amber",                  "do-while-loop-in-conditionals",                "A fragment shader with do-while loop in conditional nest"                                                              },
62                 {       "do-while-with-always-true-if.amber",                   "do-while-with-always-true-if",                 "A fragment shader with a do while that always returns"                                                                 },
63                 {       "early-return-and-barrier.amber",                               "early-return-and-barrier",                             "A compute shader with an early return and a barrier"                                                                   },
64                 {       "for-condition-always-false.amber",                             "for-condition-always-false",                   "A fragment shader that uses a for loop with condition always false"                                    },
65                 {       "for-with-ifs-and-return.amber",                                "for-with-ifs-and-return",                              "A fragment shader with two ifs and return/continue inside a for loop"                                  },
66                 {       "fragcoord-control-flow.amber",                                 "fragcoord-control-flow",                               "A fragment shader that uses FragCoord and somewhat complex control flow"                               },
67                 {       "fragcoord-control-flow-2.amber",                               "fragcoord-control-flow-2",                             "A fragment shader that uses FragCoord and somewhat complex control flow"                               },
68                 {       "if-and-switch.amber",                                                  "if-and-switch",                                                "A fragment shader with a switch and some data flow"                                                                    },
69                 {       "loop-call-discard.amber",                                              "loop-call-discard",                                    "A fragment shader with nested loops and a function call"                                                               },
70                 {       "loop-dead-if-loop.amber",                                              "loop-dead-if-loop",                                    "A fragment shader with a loop, dead if, and a loop"                                                                    },
71                 {       "loop-nested-ifs.amber",                                                "loop-nested-ifs",                                              "A fragment shader with a for loop containing nested ifs"                                                               },
72                 {       "loops-breaks-returns.amber",                                   "loops-breaks-returns",                                 "A compute shader with loops, breaks, returns"                                                                                  },
73                 {       "mat-array-deep-control-flow.amber",                    "mat-array-deep-control-flow",                  "A fragment shader that uses an array of matrices and has deep control flow"                    },
74                 {       "mat-array-distance.amber",                                             "mat-array-distance",                                   "A fragment shader that uses an array of matrices and distance"                                                 },
75                 {       "matrices-and-return-in-loop.amber",                    "matrices-and-return-in-loop",                  "A fragment shader with matrices and a return in a loop"                                                                },
76                 {       "max-mix-conditional-discard.amber",                    "max-mix-conditional-discard",                  "A fragment shader with an expression used in two discard guards"                                               },
77                 {       "mix-floor-add.amber",                                                  "mix-floor-add",                                                "A fragment shader with mix, uintBitsToFloat, and floor"                                                                },
78                 {       "nested-for-loops-with-return.amber",                   "nested-for-loops-with-return",                 "A fragment shader with two nested for loops with return"                                                               },
79                 {       "nested-ifs-and-return-in-for-loop.amber",              "nested-ifs-and-return-in-for-loop",    "A fragment shader with return in nest of ifs, inside loop"                                                             },
80                 {       "nested-loops-switch.amber",                                    "nested-loops-switch",                                  "A fragment shader with nested loops and a switch"                                                                              },
81                 {       "pow-vec4.amber",                                                               "pow-vec4",                                                             "A fragment shader that uses pow"                                                                                                               },
82                 {       "return-before-writing-wrong-color.amber",              "return-before-writing-wrong-color",    "A fragment shader with return before writing wrong color"                                                              },
83                 {       "return-in-loop-in-function.amber",                             "return-in-loop-in-function",                   "A fragment shader with early return from loop in function"                                                             },
84                 {       "similar-nested-ifs.amber",                                             "similar-nested-ifs",                                   "A fragment shader with similar nested ifs and loops"                                                                   },
85                 {       "struct-used-as-temporary.amber",                               "struct-used-as-temporary",                             "A fragment shader that uses a temporary struct variable"                                                               },
86                 {       "switch-if-discard.amber",                                              "switch-if-discard",                                    "A fragment shader with a switch, if, and discard"                                                                              },
87                 {       "switch-with-empty-if-false.amber",                             "switch-with-empty-if-false",                   "A fragment shader with always false if in switch statement"                                                    },
88                 {       "swizzle-struct-init-min.amber",                                "swizzle-struct-init-min",                              "A fragment shader that uses vector swizzles, struct initializers, and min"                             },
89                 {       "two-for-loops-with-barrier-function.amber",    "two-for-loops-with-barrier-function",  "A compute shader with two barrier functions"                                                                                   },
90                 {       "two-loops-matrix.amber",                                               "two-loops-matrix",                                             "A fragment shader with two loops and some matrices"                                                                    },
91                 {       "two-loops-set-struct.amber",                                   "two-loops-set-struct",                                 "A fragment shader with two loops that write to a struct"                                                               },
92                 {       "two-loops-with-break.amber",                                   "two-loops-with-break",                                 "A fragment shader with two loops with breaks"                                                                                  },
93                 {       "two-nested-do-whiles.amber",                                   "two-nested-do-whiles",                                 "A fragment shader with nested do while"                                                                                                },
94                 {       "unreachable-barrier-in-loops.amber",                   "unreachable-barrier-in-loops",                 "A compute shader with an unreachable barrier in a loop nest"                                                   },
95                 {       "unreachable-continue-statement.amber",                 "unreachable-continue-statement",               "A fragment shader with unreachable continue statement"                                                                 },
96                 {       "unreachable-discard-statement.amber",                  "unreachable-discard-statement",                "A fragment shader with unreachable discard statement"                                                                  },
97                 {       "unreachable-loops.amber",                                              "unreachable-loops",                                    "Fragment shader that writes red despite unreachable loops"                                                             },
98                 {       "unreachable-loops-in-switch.amber",                    "unreachable-loops-in-switch",                  "A fragment shader with unreachable loops in a switch"                                                                  },
99                 {       "unreachable-return-in-loop.amber",                             "unreachable-return-in-loop",                   "A fragment shader with an unreachable return in a loop"                                                                },
100                 {       "while-inside-switch.amber",                                    "while-inside-switch",                                  "A fragment shader that uses a while loop inside a switch"                                                              },
101                 {       "write-before-break.amber",                                             "write-before-break",                                   "Fragment shader that writes red before loop break"                                                                             },
102                 {       "write-red-after-search.amber",                                 "write-red-after-search",                               "A fragment shader performing a search computation, then writing red regardless"                },
103                 {       "write-red-in-loop-nest.amber",                                 "write-red-in-loop-nest",                               "A fragment shader that writes red in a nest of loops"                                                                  },
104                 {       "wrong-color-in-always-false-if.amber",                 "wrong-color-in-always-false-if",               "A fragment shader with wrong color write in false if"                                                                  },
105         };
106
107         for (size_t i = 0; i < sizeof tests / sizeof tests[0]; i++)
108                 group->addChild(createAmberTestCase(testCtx, tests[i].name, tests[i].description, "graphicsfuzz", tests[i].filename));
109 }
110
111 } // anonymous
112
113 tcu::TestCaseGroup* createGraphicsFuzzTests (tcu::TestContext& testCtx)
114 {
115         return createTestGroup(testCtx, "graphicsfuzz", "Amber GraphicsFuzz Tests", createAmberTests);
116 }
117
118 } // cts_amber
119 } // vkt