1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2020 Valve Corporation.
6 * Copyright (c) 2020 The Khronos Group Inc.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 *//*!
21 * \file
22 * \brief Amber tests in the GLSL group.
23 *//*--------------------------------------------------------------------*/
24
25 #include "vktAmberGlslTests.hpp"
26 #include "vktAmberTestCase.hpp"
27
28 #include <vector>
29 #include <utility>
30 #include <string>
31
32 namespace vkt
33 {
34 namespace cts_amber
35 {
36
createCombinedOperationsGroup(tcu::TestContext & testCtx)37 tcu::TestCaseGroup *createCombinedOperationsGroup(tcu::TestContext &testCtx)
38 {
39 static const std::string kGroupName = "combined_operations";
40 static const std::vector<std::pair<std::string, std::string>> combinedOperationsTests = {
41 {"notxor", "Bitwise negation of a bitwise xor operation"},
42 {"negintdivand", "Bitwise and of a negative value that was divided"},
43 };
44
45 de::MovePtr<tcu::TestCaseGroup> group{new tcu::TestCaseGroup{testCtx, kGroupName.c_str()}};
46 for (const auto &test : combinedOperationsTests)
47 {
48 group->addChild(createAmberTestCase(testCtx, test.first.c_str(), test.second.c_str(), kGroupName.c_str(),
49 test.first + ".amber"));
50 }
51 return group.release();
52 }
53
createCrashTestGroup(tcu::TestContext & testCtx)54 tcu::TestCaseGroup *createCrashTestGroup(tcu::TestContext &testCtx)
55 {
56 struct TestParameters
57 {
58 std::string name;
59 std::string description;
60 std::vector<std::string> requirements;
61 };
62 static const std::string kGroupName = "crash_test";
63 static const std::vector<TestParameters> crashTestParameters = {
64 {"divbyzero_vert", "Vertex shader division by zero tests", {}},
65 {"divbyzero_tesc", "Tessellation control shader division by zero tests", {"Features.tessellationShader"}},
66 {"divbyzero_tese", "Tessellation evaluation shader division by zero tests", {"Features.tessellationShader"}},
67 {"divbyzero_geom", "Geoemtry shader division by zero tests", {"Features.geometryShader"}},
68 {"divbyzero_frag", "Fragment shader division by zero tests", {}},
69 {"divbyzero_comp", "Compute shader division by zero tests", {}},
70 };
71
72 de::MovePtr<tcu::TestCaseGroup> group{new tcu::TestCaseGroup{testCtx, kGroupName.c_str()}};
73 for (const auto ¶ms : crashTestParameters)
74 {
75 group->addChild(createAmberTestCase(testCtx, params.name.c_str(), params.description.c_str(),
76 kGroupName.c_str(), params.name + ".amber", params.requirements));
77 }
78 return group.release();
79 }
80
81 } // namespace cts_amber
82 } // namespace vkt
83