Home | History | Annotate | Download | only in vulkan
      1 #ifndef _VKWSIUTIL_HPP
      2 #define _VKWSIUTIL_HPP
      3 /*-------------------------------------------------------------------------
      4  * Vulkan CTS Framework
      5  * --------------------
      6  *
      7  * Copyright (c) 2016 Google Inc.
      8  *
      9  * Licensed under the Apache License, Version 2.0 (the "License");
     10  * you may not use this file except in compliance with the License.
     11  * You may obtain a copy of the License at
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     15  * Unless required by applicable law or agreed to in writing, software
     16  * distributed under the License is distributed on an "AS IS" BASIS,
     17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18  * See the License for the specific language governing permissions and
     19  * limitations under the License.
     20  *
     21  *//*!
     22  * \file
     23  * \brief Windowing System Integration (WSI) Utilities.
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "vkDefs.hpp"
     27 #include "vkWsiPlatform.hpp"
     28 #include "vkRef.hpp"
     29 
     30 #include <vector>
     31 
     32 namespace vk
     33 {
     34 namespace wsi
     35 {
     36 
     37 struct PlatformProperties
     38 {
     39 	enum FeatureFlags
     40 	{
     41 		FEATURE_INITIAL_WINDOW_SIZE		= (1<<0),		//!< Platform honors initial window size request
     42 		FEATURE_RESIZE_WINDOW			= (1<<1),		//!< Platform supports resizing window
     43 	};
     44 
     45 	enum SwapchainExtent
     46 	{
     47 		SWAPCHAIN_EXTENT_MUST_MATCH_WINDOW_SIZE = 0,	//!< Swapchain extent must match window size
     48 		SWAPCHAIN_EXTENT_SETS_WINDOW_SIZE,				//!< Window will be resized to swapchain size when first image is presented
     49 		SWAPCHAIN_EXTENT_SCALED_TO_WINDOW_SIZE,			//!< Presented image contents will be scaled to window size
     50 
     51 		SWAPCHAIN_EXTENT_LAST
     52 	};
     53 
     54 	deUint32		features;
     55 	SwapchainExtent	swapchainExtent;
     56 	deUint32		maxDisplays;
     57 	deUint32		maxWindowsPerDisplay;
     58 };
     59 
     60 const char*						getName									(Type wsiType);
     61 const char*						getExtensionName						(Type wsiType);
     62 
     63 const PlatformProperties&		getPlatformProperties					(Type wsiType);
     64 
     65 VkResult						createSurface							(const InstanceInterface&		vki,
     66 																		 VkInstance						instance,
     67 																		 Type							wsiType,
     68 																		 const Display&					nativeDisplay,
     69 																		 const Window&					nativeWindow,
     70 																		 const VkAllocationCallbacks*	pAllocator,
     71 																		 VkSurfaceKHR*					pSurface);
     72 
     73 Move<VkSurfaceKHR>				createSurface							(const InstanceInterface&		vki,
     74 																		 VkInstance						instance,
     75 																		 Type							wsiType,
     76 																		 const Display&					nativeDisplay,
     77 																		 const Window&					nativeWindow,
     78 																		 const VkAllocationCallbacks*	pAllocator = DE_NULL);
     79 
     80 VkBool32						getPhysicalDeviceSurfaceSupport			(const InstanceInterface&		vki,
     81 																		 VkPhysicalDevice				physicalDevice,
     82 																		 deUint32						queueFamilyIndex,
     83 																		 VkSurfaceKHR					surface);
     84 
     85 VkSurfaceCapabilitiesKHR		getPhysicalDeviceSurfaceCapabilities	(const InstanceInterface&		vki,
     86 																		 VkPhysicalDevice				physicalDevice,
     87 																		 VkSurfaceKHR					surface);
     88 
     89 std::vector<VkSurfaceFormatKHR>	getPhysicalDeviceSurfaceFormats			(const InstanceInterface&		vki,
     90 																		 VkPhysicalDevice				physicalDevice,
     91 																		 VkSurfaceKHR					surface);
     92 
     93 std::vector<VkPresentModeKHR>	getPhysicalDeviceSurfacePresentModes	(const InstanceInterface&		vki,
     94 																		 VkPhysicalDevice				physicalDevice,
     95 																		 VkSurfaceKHR					surface);
     96 
     97 std::vector<VkImage>			getSwapchainImages						(const DeviceInterface&			vkd,
     98 																		 VkDevice						device,
     99 																		 VkSwapchainKHR					swapchain);
    100 
    101 } // wsi
    102 } // vk
    103 
    104 #endif // _VKWSIUTIL_HPP
    105