1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2019 Google LLC
6  * Copyright (c) 2019 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 
22 #include <string>
23 
24 #include "vktTestGroupUtil.hpp"
25 #include "vktAmberTestCase.hpp"
26 #include "vktSpvAsmVectorShuffleTests.hpp"
27 
28 namespace vkt
29 {
30 namespace SpirVAssembly
31 {
32 namespace
33 {
34 
createTests(tcu::TestCaseGroup * tests,const char * data_dir)35 void createTests(tcu::TestCaseGroup *tests, const char *data_dir)
36 {
37 #ifndef CTS_USES_VULKANSC
38     tcu::TestContext &testCtx = tests->getTestContext();
39 
40     // Shader test files are saved in <path>/external/vulkancts/data/vulkan/amber/<data_dir>/<basename>.amber
41     struct Case
42     {
43         const char *basename;
44         std::vector<std::string> requirements;
45     };
46     const Case cases[] = {
47         // OpVectorShuffle with indices including -1
48         {"vector_shuffle", {"VariablePointerFeatures.variablePointers"}},
49     };
50 
51     for (unsigned i = 0; i < sizeof(cases) / sizeof(cases[0]); ++i)
52     {
53         std::string file = std::string(cases[i].basename) + ".amber";
54         cts_amber::AmberTestCase *testCase =
55             cts_amber::createAmberTestCase(testCtx, cases[i].basename, data_dir, file, cases[i].requirements);
56 
57         tests->addChild(testCase);
58     }
59 #else
60     DE_UNREF(tests);
61     DE_UNREF(data_dir);
62 #endif
63 }
64 
65 } // namespace
66 
createVectorShuffleGroup(tcu::TestContext & testCtx)67 tcu::TestCaseGroup *createVectorShuffleGroup(tcu::TestContext &testCtx)
68 {
69     // Location of the Amber script files under the data/vulkan/amber source tree.
70     const char *data_dir = "spirv_assembly/instruction/compute/vector_shuffle";
71     return createTestGroup(testCtx, "vector_shuffle", createTests, data_dir);
72 }
73 
74 } // namespace SpirVAssembly
75 } // namespace vkt
76