Add tests for OpPtrAccessChain on Workgroup storage
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / spirv_assembly / vktSpvAsmPtrAccessChainTests.cpp
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 "vktAmberTestCaseUtil.hpp"
25 #include "vktSpvAsmPtrAccessChainTests.hpp"
26
27 namespace vkt
28 {
29 namespace SpirVAssembly
30 {
31 namespace
32 {
33
34 void createTests (tcu::TestCaseGroup* tests, const char* data_dir)
35 {
36         tcu::TestContext& testCtx = tests->getTestContext();
37
38         // Shader test files are saved in <path>/external/vulkancts/data/vulkan/amber/<data_dir>/<basename>.amber
39         struct Case {
40                 const char* basename;
41                 const char* description;
42         };
43         const Case cases[] =
44         {
45                 { "workgroup", "OpPtrAccessChain with correct ArrayStride decoration" },
46                 { "workgroup_no_stride", "OpPtrAccessChain with no ArrayStride decoration" },
47                 { "workgroup_bad_stride", "OpPtrAccessChain with incorrect ArrayStride decoration" },
48         };
49
50         for (unsigned i = 0; i < sizeof(cases)/sizeof(cases[0]) ; ++i)
51         {
52                 std::string                                     file            = std::string(cases[i].basename) + ".amber";
53                 cts_amber::AmberTestCase        *testCase       = cts_amber::createAmberTestCase(testCtx, cases[i].basename, cases[i].description, data_dir, file);
54
55                 tests->addChild(testCase);
56         }
57 }
58
59 } // anonymous
60
61 tcu::TestCaseGroup* createPtrAccessChainGroup (tcu::TestContext& testCtx)
62 {
63         // Location of the Amber script files under the data/vulkan/amber source tree.
64         const char* data_dir = "spirv_assembly/instruction/compute/ptr_access_chain";
65         return createTestGroup(testCtx, "ptr_access_chain", "OpPtrAccessChain edge cases", createTests, data_dir);
66 }
67
68 } // SpirVAssembly
69 } // vkt