if [[ "$VULKAN_BUILD_TARGET" == "LINUX" ]]; then
# Install the appropriate Linux packages.
sudo apt-get -qq update
- sudo apt-get -y install libxkbcommon-dev libwayland-dev libmirclient-dev libxrandr-dev libx11-xcb-dev
+ sudo apt-get -y install libxkbcommon-dev libwayland-dev libxrandr-dev libx11-xcb-dev
fi
- |
if [[ "$VULKAN_BUILD_TARGET" == "MACOS" ]]; then
| BUILD_WSI_XCB_SUPPORT | Linux | `ON` | Build the loader with the XCB entry points enabled. Without this, the XCB headers should not be needed, but the extension `VK_KHR_xcb_surface` won't be available. |
| BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the loader with the Xlib entry points enabled. Without this, the X11 headers should not be needed, but the extension `VK_KHR_xlib_surface` won't be available. |
| BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the loader with the Wayland entry points enabled. Without this, the Wayland headers should not be needed, but the extension `VK_KHR_wayland_surface` won't be available. |
-| BUILD_WSI_MIR_SUPPORT | Linux | `OFF` | Build the loader with the Mir entry points enabled. Without this, the Mir headers should not be needed, but the extension `VK_KHR_mir_surface` won't be available. |
| ENABLE_STATIC_LOADER | Windows | `OFF` | By default, the loader is built as a dynamic library. This allows it to be built as a static library, instead. |
| ENABLE_WIN10_ONECORE | Windows | `OFF` | Link the loader to the [OneCore](https://msdn.microsoft.com/en-us/library/windows/desktop/mt654039.aspx) umbrella library, instead of the standard Win32 ones. |
| USE_CCACHE | Linux | `OFF` | Enable caching with the CCache program. |
#### Required Package List
sudo apt-get install git cmake build-essential libx11-xcb-dev \
- libxkbcommon-dev libmirclient-dev libwayland-dev libxrandr-dev
+ libxkbcommon-dev libwayland-dev libxrandr-dev
### Linux Build
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON)
- option(BUILD_WSI_MIR_SUPPORT "Build Mir WSI support" OFF)
if(BUILD_WSI_XCB_SUPPORT)
find_package(XCB REQUIRED)
find_package(Wayland REQUIRED)
include_directories(${WAYLAND_CLIENT_INCLUDE_DIR})
endif()
-
- if(BUILD_WSI_MIR_SUPPORT)
- find_package(Mir REQUIRED)
- endif()
endif()
if(WIN32)
+++ /dev/null
-# Try to find Mir on a Unix system
-#
-# This will define:
-#
-# MIR_FOUND - System has Mir
-# MIR_LIBRARIES - Link these to use Mir
-# MIR_INCLUDE_DIR - Include directory for Mir
-# MIR_DEFINITIONS - Compiler switches required for using Mir
-
-if (NOT WIN32)
-
- find_package (PkgConfig)
- pkg_check_modules (PKG_MIR QUIET mirclient)
- set(MIR_DEFINITIONS ${PKG_MIR_CFLAGS_OTHER})
-
- find_path(MIR_INCLUDE_DIR
- NAMES xkbcommon/xkbcommon.h
- HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS}
- )
-
- find_library(MIR_LIBRARY
- NAMES mirclient
- HINTS ${PKG_MIR_LIBRARIES} ${MIR_LIBRARY_DIRS}
- )
-
- set (MIR_INCLUDE_DIR ${PKG_MIR_INCLUDE_DIRS})
- set (MIR_LIBRARIES ${MIR_LIBRARY})
-
- include (FindPackageHandleStandardArgs)
- find_package_handle_standard_args (MIR DEFAULT_MSG
- MIR_LIBRARIES
- MIR_INCLUDE_DIR
- )
-
- mark_as_advanced (MIR_LIBRARIES MIR_INCLUDE_DIR)
-
-endif ()
if(BUILD_WSI_WAYLAND_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR)
endif()
-
- if(BUILD_WSI_MIR_SUPPORT)
- add_definitions(-DVK_USE_PLATFORM_MIR_KHR)
- include_directories(${MIR_INCLUDE_DIR})
- endif()
else()
message(FATAL_ERROR "Unsupported Platform!")
endif()
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_core.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_ios.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_macos.h
- ${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_mir.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_vi.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_wayland.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_win32.h
| Windows | VK_KHR_win32_surface |
| Linux (Default) | VK_KHR_xcb_surface and VK_KHR_xlib_surface |
| Linux (Wayland) | VK_KHR_wayland_surface |
-| Linux (Mir) | VK_KHR_mir_surface |
| MacOS (MoltenVK) | VK_MVK_macos_surface |
-**NOTE:** Wayland and Mir targets are not fully supported at this time. Wayland
-support is present, but should be considered Beta quality. Mir support is not
-completely implemented at this time.
+**NOTE:** Wayland is not fully supported at this time. Wayland
+support is present, but should be considered Beta quality.
It is important to understand that while the loader may support the various
entry-points for these extensions, there is a hand-shake required to actually
Normally, ICDs handle object creation and destruction for various Vulkan
objects. The WSI surface extensions for Linux, Windows, and MacOS
("VK\_KHR\_win32\_surface", "VK\_KHR\_xcb\_surface", "VK\_KHR\_xlib\_surface",
-"VK\_KHR\_mir\_surface", "VK\_KHR\_wayland\_surface", "VK\_MVK\_macos\_surface"
+"VK\_KHR\_wayland\_surface", "VK\_MVK\_macos\_surface"
and "VK\_KHR\_surface")
are handled differently. For these extensions, the `VkSurfaceKHR` object
creation and destruction may be handled by either the loader, or an ICD.
`vkDestroySurfaceKHR`
functions without involving the ICDs.
* Where XXX stands for the Windowing System name:
- * Mir
* Wayland
* Xcb
* Xlib
`VkIcdSurfaceXXX` structure.
4. The first field of all the `VkIcdSurfaceXXX` structures is a
`VkIcdSurfaceBase` enumerant that indicates whether the
- surface object is Win32, Xcb, Xlib, Mir, or Wayland.
+ surface object is Win32, Xcb, Xlib, or Wayland.
The ICD may choose to handle `VkSurfaceKHR` object creation instead. If an ICD
desires to handle creating and destroying it must do the following:
#ifdef VK_USE_PLATFORM_WIN32_KHR
bool wsi_win32_surface_enabled;
#endif
-#ifdef VK_USE_PLATFORM_MIR_KHR
- bool wsi_mir_surface_enabled;
-#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
bool wsi_wayland_surface_enabled;
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
ptr_instance->wsi_win32_surface_enabled = false;
#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
- ptr_instance->wsi_mir_surface_enabled = false;
-#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
ptr_instance->wsi_wayland_surface_enabled = false;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
continue;
}
#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
- if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) {
- ptr_instance->wsi_mir_surface_enabled = true;
- continue;
- }
-#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) {
ptr_instance->wsi_wayland_surface_enabled = true;
// Linux WSI surface extensions are not always compiled into the loader. (Assume
// for Windows the KHR_win32_surface is always compiled into loader). A given
// Linux build environment might not have the headers required for building one
-// of the four extensions (Xlib, Xcb, Mir, Wayland). Thus, need to check if
+// of the three extensions (Xlib, Xcb, Wayland). Thus, need to check if
// the built loader actually supports the particular Linux surface extension.
// If not supported by the built loader it will not be included in the list of
// enumerated instance extensions. This solves the issue where an ICD or layer
// advertises support for a given Linux surface extension but the loader was not
// built to support the extension.
bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop) {
-#ifndef VK_USE_PLATFORM_MIR_KHR
- if (!strcmp(ext_prop->extensionName, "VK_KHR_mir_surface")) return true;
-#endif // VK_USE_PLATFORM_MIR_KHR
#ifndef VK_USE_PLATFORM_WAYLAND_KHR
if (!strcmp(ext_prop->extensionName, "VK_KHR_wayland_surface")) return true;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
}
#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
-
-// Functions for the VK_KHR_mir_surface extension:
-
-// This is the trampoline entrypoint for CreateMirSurfaceKHR
-LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(VkInstance instance,
- const VkMirSurfaceCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator,
- VkSurfaceKHR *pSurface) {
- const VkLayerInstanceDispatchTable *disp;
- disp = loader_get_instance_layer_dispatch(instance);
- VkResult res;
-
- res = disp->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
- return res;
-}
-
-// This is the instance chain terminator function for CreateMirSurfaceKHR
-VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
- VkResult vkRes = VK_SUCCESS;
- VkIcdSurface *pIcdSurface = NULL;
- uint32_t i = 0;
-
- // First, check to ensure the appropriate extension was enabled:
- struct loader_instance *ptr_instance = loader_get_instance(instance);
- if (!ptr_instance->wsi_mir_surface_enabled) {
- loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
- "VK_KHR_mir_surface extension not enabled. vkCreateMirSurfaceKHR not executed!\n");
- vkRes = VK_ERROR_EXTENSION_NOT_PRESENT;
- goto out;
- }
-
- // Next, if so, proceed with the implementation of this function:
- pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->mir_surf.base), sizeof(pIcdSurface->mir_surf));
- if (pIcdSurface == NULL) {
- vkRes = VK_ERROR_OUT_OF_HOST_MEMORY;
- goto out;
- }
-
- pIcdSurface->mir_surf.base.platform = VK_ICD_WSI_PLATFORM_MIR;
- pIcdSurface->mir_surf.connection = pCreateInfo->connection;
- pIcdSurface->mir_surf.mirSurface = pCreateInfo->mirSurface;
-
- // Loop through each ICD and determine if they need to create a surface
- for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) {
- if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) {
- if (NULL != icd_term->dispatch.CreateMirSurfaceKHR) {
- vkRes = icd_term->dispatch.CreateMirSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator,
- &pIcdSurface->real_icd_surfaces[i]);
- if (VK_SUCCESS != vkRes) {
- goto out;
- }
- }
- }
- }
-
- *pSurface = (VkSurfaceKHR)pIcdSurface;
-
-out:
-
- if (VK_SUCCESS != vkRes && NULL != pIcdSurface) {
- if (NULL != pIcdSurface->real_icd_surfaces) {
- i = 0;
- for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) {
- if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) {
- icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
- }
- }
- loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces);
- }
- loader_instance_heap_free(ptr_instance, pIcdSurface);
- }
-
- return vkRes;
-}
-
-// This is the trampoline entrypoint for
-// GetPhysicalDeviceMirPresentationSupportKHR
-LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice,
- uint32_t queueFamilyIndex,
- MirConnection *connection) {
- VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
- const VkLayerInstanceDispatchTable *disp;
- disp = loader_get_instance_layer_dispatch(physicalDevice);
- VkBool32 res = disp->GetPhysicalDeviceMirPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, connection);
- return res;
-}
-
-// This is the instance chain terminator function for
-// GetPhysicalDeviceMirPresentationSupportKHR
-VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice,
- uint32_t queueFamilyIndex,
- MirConnection *connection) {
- // First, check to ensure the appropriate extension was enabled:
- struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice;
- struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;
- struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance;
- if (!ptr_instance->wsi_mir_surface_enabled) {
- loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
- "VK_KHR_mir_surface extension not enabled. vkGetPhysicalDeviceMirPresentationSupportKHR not executed!\n");
- return VK_SUCCESS;
- }
-
- if (NULL == icd_term->dispatch.GetPhysicalDeviceMirPresentationSupportKHR) {
- loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
- "ICD for selected physical device is not exporting vkGetPhysicalDeviceMirPresentationSupportKHR!\n");
- assert(false && "loader: null GetPhysicalDeviceMirPresentationSupportKHR ICD pointer");
- }
-
- return icd_term->dispatch.GetPhysicalDeviceMirPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, connection);
-}
-#endif // VK_USE_PLATFORM_MIR_KHR
-
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
// This is the trampoline entrypoint for CreateWaylandSurfaceKHR
return true;
}
#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
-
- // Functions for the VK_KHR_mir_surface extension:
- if (!strcmp("vkCreateMirSurfaceKHR", name)) {
- *addr = ptr_instance->wsi_mir_surface_enabled ? (void *)vkCreateMirSurfaceKHR : NULL;
- return true;
- }
- if (!strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) {
- *addr = ptr_instance->wsi_mir_surface_enabled ? (void *)vkGetPhysicalDeviceMirPresentationSupportKHR : NULL;
- return true;
- }
-#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
// Functions for the VK_KHR_wayland_surface extension:
typedef struct {
union {
-#ifdef VK_USE_PLATFORM_MIR_KHR
- VkIcdSurfaceMir mir_surf;
-#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
VkIcdSurfaceWayland wayland_surf;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex);
#endif
-#ifdef VK_USE_PLATFORM_MIR_KHR
-VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
-VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice,
- uint32_t queueFamilyIndex,
- MirConnection *connection);
-#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance,
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
if(BUILD_WSI_WAYLAND_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR)
endif()
-
- if(BUILD_WSI_MIR_SUPPORT)
- add_definitions(-DVK_USE_PLATFORM_MIR_KHR)
- include_directories(${MIR_INCLUDE_DIR})
- endif()
else()
message(FATAL_ERROR "Unsupported Platform!")
endif()
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
-
-#ifdef VK_USE_PLATFORM_MIR_KHR
-
-
-VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
-{
- wrapped_inst_obj *inst;
- auto vk_inst = unwrap_instance(instance, &inst);
- VkResult result = inst->layer_disp.CreateMirSurfaceKHR(vk_inst, pCreateInfo, pAllocator, pSurface);
- return result;
-}
-
-VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection)
-{
- wrapped_phys_dev_obj *phys_dev;
- auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
- VkBool32 result = phys_dev->inst->layer_disp.GetPhysicalDeviceMirPresentationSupportKHR(vk_phys_dev, queueFamilyIndex, connection);
- return result;
-}
-#endif // VK_USE_PLATFORM_MIR_KHR
-
VKAPI_ATTR VkResult VKAPI_CALL
vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) {
if (!strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", funcName))
return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceXlibPresentationSupportKHR);
#endif // VK_USE_PLATFORM_XLIB_KHR
-#ifdef VK_USE_PLATFORM_MIR_KHR
- if (!strcmp("vkCreateMirSurfaceKHR", funcName))
- return reinterpret_cast<PFN_vkVoidFunction>(vkCreateMirSurfaceKHR);
- if (!strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", funcName))
- return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceMirPresentationSupportKHR);
-#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
if (!strcmp("vkCreateWaylandSurfaceKHR", funcName))
return reinterpret_cast<PFN_vkVoidFunction>(vkCreateWaylandSurfaceKHR);