vkWsiUtil.hpp revision 12021ac26c6d6f8923f526bd7635dcf68e0c4061
1#ifndef _VKWSIUTIL_HPP
2#define _VKWSIUTIL_HPP
3/*-------------------------------------------------------------------------
4 * Vulkan CTS Framework
5 * --------------------
6 *
7 * Copyright (c) 2016 Google Inc.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and/or associated documentation files (the
11 * "Materials"), to deal in the Materials without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sublicense, and/or sell copies of the Materials, and to
14 * permit persons to whom the Materials are furnished to do so, subject to
15 * the following conditions:
16 *
17 * The above copyright notice(s) and this permission notice shall be
18 * included in all copies or substantial portions of the Materials.
19 *
20 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 *
28 *//*!
29 * \file
30 * \brief Windowing System Integration (WSI) Utilities.
31 *//*--------------------------------------------------------------------*/
32
33#include "vkDefs.hpp"
34#include "vkWsiPlatform.hpp"
35#include "vkRef.hpp"
36
37namespace vk
38{
39namespace wsi
40{
41
42struct PlatformProperties
43{
44	enum FeatureFlags
45	{
46		FEATURE_INITIAL_WINDOW_SIZE		= (1<<0),		//!< Platform honors initial window size request
47		FEATURE_RESIZE_WINDOW			= (1<<1),		//!< Platform supports resizing window
48	};
49
50	enum SwapchainExtent
51	{
52		SWAPCHAIN_EXTENT_MUST_MATCH_WINDOW_SIZE = 0,	//!< Swapchain extent must match window size
53		SWAPCHAIN_EXTENT_SETS_WINDOW_SIZE,				//!< Window will be resized to swapchain size when first image is presented
54		SWAPCHAIN_EXTENT_SCALED_TO_WINDOW_SIZE,			//!< Presented image contents will be scaled to window size
55
56		SWAPCHAIN_EXTENT_LAST
57	};
58
59	deUint32		features;
60	SwapchainExtent	swapchainExtent;
61	deUint32		maxDisplays;
62	deUint32		maxWindowsPerDisplay;
63};
64
65const char*					getName									(Type wsiType);
66const char*					getExtensionName						(Type wsiType);
67
68const PlatformProperties&	getPlatformProperties					(Type wsiType);
69
70VkResult					createSurface							(const InstanceInterface&		vki,
71																	 VkInstance						instance,
72																	 Type							wsiType,
73																	 const Display&					nativeDisplay,
74																	 const Window&					nativeWindow,
75																	 const VkAllocationCallbacks*	pAllocator,
76																	 VkSurfaceKHR*					pSurface);
77
78Move<VkSurfaceKHR>			createSurface							(const InstanceInterface&		vki,
79																	 VkInstance						instance,
80																	 Type							wsiType,
81																	 const Display&					nativeDisplay,
82																	 const Window&					nativeWindow,
83																	 const VkAllocationCallbacks*	pAllocator = DE_NULL);
84
85VkSurfaceCapabilitiesKHR	getPhysicalDeviceSurfaceCapabilities	(const InstanceInterface&		vki,
86																	 VkPhysicalDevice				physicalDevice,
87																	 VkSurfaceKHR					surface);
88
89} // wsi
90} // vk
91
92#endif // _VKWSIUTIL_HPP
93