From cbb564e8af81feaa77701b73778c47648d50843f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 16 Apr 2015 22:02:10 +0800 Subject: switch to VK_WSI_LunarG Switch from VK_WSI_X11 to VK_WSI_LunarG v2: - split out glave changes - redo mem_tracker changes - rebase Conflicts: demos/cube.c demos/tri.c v3 (from Ian): - Put "#if 0" around non-upstream members of VkDisplayPropertiesWSI. --- include/vkDbg.h | 5 +- include/vkLayer.h | 15 +++--- include/vkWsiWinExt.h | 14 ----- include/vkWsiX11Ext.h | 143 -------------------------------------------------- 4 files changed, 10 insertions(+), 167 deletions(-) delete mode 100644 include/vkWsiWinExt.h delete mode 100644 include/vkWsiX11Ext.h (limited to 'include') diff --git a/include/vkDbg.h b/include/vkDbg.h index 43a55993..cc3c4255 100644 --- a/include/vkDbg.h +++ b/include/vkDbg.h @@ -109,8 +109,11 @@ typedef enum _VK_DBG_OBJECT_TYPE VK_DBG_OBJECT_PIPELINE_LAYOUT, VK_DBG_OBJECT_DESCRIPTOR_POOL, + VK_DBG_OBJECT_DISPLAY_WSI, + VK_DBG_OBJECT_SWAP_CHAIN_WSI, + VK_DBG_OBJECT_TYPE_BEGIN_RANGE = VK_DBG_OBJECT_UNKNOWN, - VK_DBG_OBJECT_TYPE_END_RANGE = VK_DBG_OBJECT_DESCRIPTOR_POOL, + VK_DBG_OBJECT_TYPE_END_RANGE = VK_DBG_OBJECT_SWAP_CHAIN_WSI, VK_NUM_DBG_OBJECT_TYPE = (VK_DBG_OBJECT_TYPE_END_RANGE - VK_DBG_OBJECT_TYPE_BEGIN_RANGE + 1), } VK_DBG_OBJECT_TYPE; diff --git a/include/vkLayer.h b/include/vkLayer.h index 70c36a98..55fb3848 100644 --- a/include/vkLayer.h +++ b/include/vkLayer.h @@ -6,9 +6,7 @@ #include "vulkan.h" #include "vkDbg.h" -#if defined(__linux__) || defined(XCB_NVIDIA) -#include "vkWsiX11Ext.h" -#endif +#include "vk_wsi_lunarg.h" #if defined(__GNUC__) && __GNUC__ >= 4 # define VK_LAYER_EXPORT __attribute__((visibility("default"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) @@ -153,12 +151,11 @@ typedef struct VkLayerDispatchTable_ PFN_vkDbgSetDeviceOption DbgSetDeviceOption; PFN_vkCmdDbgMarkerBegin CmdDbgMarkerBegin; PFN_vkCmdDbgMarkerEnd CmdDbgMarkerEnd; -#if defined(__linux__) || defined(XCB_NVIDIA) - PFN_vkWsiX11AssociateConnection WsiX11AssociateConnection; - PFN_vkWsiX11GetMSC WsiX11GetMSC; - PFN_vkWsiX11CreatePresentableImage WsiX11CreatePresentableImage; - PFN_vkWsiX11QueuePresent WsiX11QueuePresent; -#endif // WIN32 + PFN_vkGetDisplayInfoWSI GetDisplayInfoWSI; + PFN_vkCreateSwapChainWSI CreateSwapChainWSI; + PFN_vkDestroySwapChainWSI DestroySwapChainWSI; + PFN_vkGetSwapChainInfoWSI GetSwapChainInfoWSI; + PFN_vkQueuePresentWSI QueuePresentWSI; } VkLayerDispatchTable; // LL node for tree of dbg callback functions diff --git a/include/vkWsiWinExt.h b/include/vkWsiWinExt.h deleted file mode 100644 index f3ee0f33..00000000 --- a/include/vkWsiWinExt.h +++ /dev/null @@ -1,14 +0,0 @@ -/* IN DEVELOPMENT. DO NOT SHIP. */ - -#ifndef __VKWSIWINEXT_H__ -#define __VKWSIWINEXT_H__ - -// This is just to get windows to build. -// Need to replace with the declarations for Windows wsi. -typedef void VK_WSI_X11_CONNECTION_INFO; -typedef unsigned int xcb_window_t; -typedef unsigned int xcb_randr_crtc_t; -typedef void VK_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO; -typedef void VK_WSI_X11_PRESENT_INFO; - -#endif // __VKWSIWINEXT_H__ diff --git a/include/vkWsiX11Ext.h b/include/vkWsiX11Ext.h deleted file mode 100644 index 3b39c643..00000000 --- a/include/vkWsiX11Ext.h +++ /dev/null @@ -1,143 +0,0 @@ -/* IN DEVELOPMENT. DO NOT SHIP. */ - -#ifndef __VKWSIX11EXT_H__ -#define __VKWSIX11EXT_H__ - -#include -#include -#include "vulkan.h" - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -typedef struct _VK_WSI_X11_CONNECTION_INFO { - xcb_connection_t* pConnection; - xcb_window_t root; - xcb_randr_provider_t provider; -} VK_WSI_X11_CONNECTION_INFO; - -typedef struct _VK_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO -{ - VkFormat format; - VkFlags usage; // VkImageUsageFlags - VkExtent2D extent; - VkFlags flags; -} VK_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO; - -typedef struct _VK_WSI_X11_PRESENT_INFO -{ - /* which window to present to */ - xcb_window_t destWindow; - VkImage srcImage; - - /** - * After the command buffers in the queue have been completed, if the MSC - * of \p crtc is less than or equal to \p target_msc, wait until it - * reaches \p target_msc. - * - * If the current MSC of \p crtc is greater than \p target_msc, adjust - * \p target_msc as following: - * - * if (divisor) { - * target_msc = crtc_msc - (crtc_msc % divisor) + remainder; - * if (target_msc < crtc_msc) - * target_msc += divisor; - * } else { - * target_msc = crtc_msc; - * } - * - * In other words, either set \p target_msc to an absolute value (require - * vkWsiX11GetMSC(), potentially a round-trip to the server, to get the - * current MSC first), or set \p target_msc to zero and set a "swap - * interval". - * - * \p crtc can be XCB_NONE. In that case, a suitable CRTC is picked based - * on \p destWindow. - */ - xcb_randr_crtc_t crtc; - uint64_t target_msc; - uint64_t divisor; - uint64_t remainder; - - /** - * After waiting for the current and target MSCs to match, the - * presentation is scheduled. When \p async is false, it will occur the - * next time current MSC is incremented. When \p async is true, it will - * occur as soon as possible. - */ - bool32_t async; - - /** - * When \p flip is false, the contents of \p srcImage are copied to - * \p destWindow when the presentation occurs. When \p flip is true, - * \p srcImage is made the front buffer of \p destWindow. - * - * An error may be returned if \p flip is true but \p destWindow can not - * be flipped to. - */ - bool32_t flip; -} VK_WSI_X11_PRESENT_INFO; - -typedef VkResult (VKAPI *PFN_vkWsiX11AssociateConnection)(VkPhysicalDevice gpu, const VK_WSI_X11_CONNECTION_INFO* pConnectionInfo); -typedef VkResult (VKAPI *PFN_vkWsiX11GetMSC)(VkDevice device, xcb_window_t window, xcb_randr_crtc_t crtc, uint64_t* pMsc); -typedef VkResult (VKAPI *PFN_vkWsiX11CreatePresentableImage)(VkDevice device, const VK_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo, VkImage* pImage, VkDeviceMemory* pMem); -typedef VkResult (VKAPI *PFN_vkWsiX11QueuePresent)(VkQueue queue, const VK_WSI_X11_PRESENT_INFO* pPresentInfo, VkFence fence); - -/** - * Associate an X11 connection with a GPU. This should be done before device - * creation. If the device is already created, - * VK_ERROR_DEVICE_ALREADY_CREATED is returned. - * - * Truth is, given a connection, we could find the associated GPU. But - * without having a GPU as the first parameter, the loader could not find the - * dispatch table. - * - * This function is available when vkGetGlobalExtensionInfo says "VK_WSI_X11" - * is supported. - */ -VkResult VKAPI vkWsiX11AssociateConnection( - VkPhysicalDevice gpu, - const VK_WSI_X11_CONNECTION_INFO* pConnectionInfo); - -/** - * Return the current MSC (Media Stream Counter, incremented for each vblank) - * of \p crtc. If crtc is \p XCB_NONE, a suitable CRTC is picked based on \p - * win. - */ -VkResult VKAPI vkWsiX11GetMSC( - VkDevice device, - xcb_window_t window, - xcb_randr_crtc_t crtc, - uint64_t* pMsc); - -/** - * Create an VkImage that can be presented. An VkDeviceMemory is created - * and bound automatically. The memory returned can only be used in - * vkQueue[Add|Remove]MemReference. Destroying the memory or binding another memory to the - * image is not allowed. - */ -VkResult VKAPI vkWsiX11CreatePresentableImage( - VkDevice device, - const VK_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo, - VkImage* pImage, - VkDeviceMemory* pMem); - -/** - * Present an image to an X11 window. The presentation always occurs after - * the command buffers in the queue have been completed, subject to other - * parameters specified in VK_WSI_X11_PRESENT_INFO. - * - * Fence is reached when the presentation occurs. - */ -VkResult VKAPI vkWsiX11QueuePresent( - VkQueue queue, - const VK_WSI_X11_PRESENT_INFO* pPresentInfo, - VkFence fence); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // __VKWSIX11EXT_H__ -- cgit v1.2.3