Merge pull request #276 from Ella-0/master
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / wsi / vktNativeObjectsUtil.hpp
1 #ifndef _VKTNATIVEOBJECTSUTIL_HPP
2 #define _VKTNATIVEOBJECTSUTIL_HPP
3 /*-------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2019 The Khronos Group Inc.
8  * Copyright (c) 2019 Valve Corporation.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  *//*!
23  * \file
24  * \brief WSI Native Objects utility class.
25  *//*--------------------------------------------------------------------*/
26 #include "vktTestCase.hpp"
27
28 #include "vkDefs.hpp"
29 #include "vkWsiPlatform.hpp"
30
31 #include "tcuMaybe.hpp"
32 #include "tcuVectorType.hpp"
33
34
35 namespace vkt
36 {
37 namespace wsi
38 {
39
40 class NativeObjects
41 {
42 public:
43         using Extensions = std::vector<vk::VkExtensionProperties>;
44
45                                                                                                 NativeObjects   (Context&                                               context,
46                                                                                                                                  const Extensions&                              supportedExtensions,
47                                                                                                                                  vk::wsi::Type                                  wsiType,
48                                                                                                                                  size_t                                                 windowCount = 1u,
49                                                                                                                                  const tcu::Maybe<tcu::UVec2>&  initialWindowSize = tcu::nothing<tcu::UVec2>());
50
51                                                                                                 NativeObjects   (NativeObjects&& other);
52
53         vk::wsi::Display&                                                       getDisplay              () const;
54
55         vk::wsi::Window&                                                        getWindow               (size_t index = 0u) const;
56
57         static de::MovePtr<vk::wsi::Window>                     createWindow    (const vk::wsi::Display& display, const tcu::Maybe<tcu::UVec2>& initialSize);
58
59         static de::MovePtr<vk::wsi::Display>            createDisplay   (const vk::Platform&    platform,
60                                                                                                                                  const Extensions&              supportedExtensions,
61                                                                                                                                  vk::wsi::Type                  wsiType);
62 private:
63         de::UniquePtr<vk::wsi::Display>                         display;
64         std::vector<de::MovePtr<vk::wsi::Window>>       windows;
65
66 };
67
68 } // wsi
69 } // vkt
70
71 #endif // _VKTNATIVEOBJECTSUTIL_HPP