xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/wsi/vktNativeObjectsUtil.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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 namespace vkt
35 {
36 namespace wsi
37 {
38 
39 class NativeObjects
40 {
41 public:
42     using Extensions = std::vector<vk::VkExtensionProperties>;
43 
44     NativeObjects(Context &context, const Extensions &supportedExtensions, vk::wsi::Type wsiType,
45                   size_t windowCount = 1u, const tcu::Maybe<tcu::UVec2> &initialWindowSize = tcu::Nothing);
46 
47     NativeObjects(NativeObjects &&other);
48 
49     vk::wsi::Display &getDisplay() const;
50 
51     vk::wsi::Window &getWindow(size_t index = 0u) const;
52 
53     static de::MovePtr<vk::wsi::Window> createWindow(const vk::wsi::Display &display,
54                                                      const tcu::Maybe<tcu::UVec2> &initialSize);
55 
56     static de::MovePtr<vk::wsi::Display> createDisplay(const vk::Platform &platform,
57                                                        const Extensions &supportedExtensions, vk::wsi::Type wsiType);
58 
59 private:
60     de::UniquePtr<vk::wsi::Display> display;
61     std::vector<de::MovePtr<vk::wsi::Window>> windows;
62 };
63 
64 } // namespace wsi
65 } // namespace vkt
66 
67 #endif // _VKTNATIVEOBJECTSUTIL_HPP
68