mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Merge pull request #14713 from amverweij/vulkan-display-khr
First pass on using Display KHR, needs proper init flags
This commit is contained in:
commit
43ae32e5b8
@ -124,6 +124,7 @@ option(USING_FBDEV "Set to ON if target environment uses fbdev (eg. Pandora)" ${
|
||||
option(USING_GLES2 "Set to ON if target device uses OpenGL ES 2.0" ${USING_GLES2})
|
||||
option(USING_X11_VULKAN "Set to OFF if target environment doesn't use X11 for Vulkan" ON)
|
||||
option(USE_WAYLAND_WSI "Enable or disable Wayland WSI support for Vulkan" ${USE_WAYLAND_WSI})
|
||||
option(USE_VULKAN_DISPLAY_KHR "Enable or disable full screen display of Vulkan" ${USE_VULKAN_DISPLAY_KHR})
|
||||
# :: Frontends
|
||||
option(USING_QT_UI "Set to ON if you wish to use the Qt frontend wrapper" ${USING_QT_UI})
|
||||
option(MOBILE_DEVICE "Set to ON when targeting a mobile device" ${MOBILE_DEVICE})
|
||||
@ -148,6 +149,7 @@ if(UNIX AND NOT (APPLE OR ANDROID) AND VULKAN)
|
||||
else()
|
||||
message("NOT using X11 for Vulkan")
|
||||
endif()
|
||||
|
||||
# add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
|
||||
if(USE_WAYLAND_WSI)
|
||||
find_package(Wayland)
|
||||
@ -158,6 +160,11 @@ if(UNIX AND NOT (APPLE OR ANDROID) AND VULKAN)
|
||||
add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_VULKAN_DISPLAY_KHR)
|
||||
message(STATUS "Using experimental full-screen display for Vulkan.")
|
||||
add_definitions(-DVK_USE_PLATFORM_DISPLAY_KHR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBRETRO)
|
||||
|
@ -114,6 +114,11 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
|
||||
instance_extensions_enabled_.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||
}
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
if (IsInstanceExtensionAvailable(VK_KHR_DISPLAY_EXTENSION_NAME)) {
|
||||
instance_extensions_enabled_.push_back(VK_KHR_DISPLAY_EXTENSION_NAME);
|
||||
}
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_METAL_EXT)
|
||||
if (IsInstanceExtensionAvailable(VK_EXT_METAL_SURFACE_EXTENSION_NAME)) {
|
||||
instance_extensions_enabled_.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME);
|
||||
@ -769,6 +774,15 @@ VkResult VulkanContext::ReinitSurface() {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
case WINDOWSYSTEM_DISPLAY:
|
||||
{
|
||||
VkDisplaySurfaceCreateInfoKHR display{ VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR };
|
||||
display.flags = 0;
|
||||
retval = vkCreateDisplayPlaneSurfaceKHR(instance_, &display, nullptr, &surface_);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
_assert_msg_(false, "Vulkan support for chosen window system not implemented");
|
||||
|
@ -48,6 +48,9 @@ enum WindowSystem {
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
WINDOWSYSTEM_WAYLAND,
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_DISPLAY_KHR
|
||||
WINDOWSYSTEM_DISPLAY,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct VulkanPhysicalDeviceInfo {
|
||||
|
@ -186,6 +186,9 @@ PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR;
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR;
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR;
|
||||
#endif
|
||||
|
||||
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
|
||||
|
||||
@ -535,6 +538,9 @@ void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &en
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
LOAD_INSTANCE_FUNC(instance, vkCreateWaylandSurfaceKHR);
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
LOAD_INSTANCE_FUNC(instance, vkCreateDisplayPlaneSurfaceKHR);
|
||||
#endif
|
||||
|
||||
LOAD_INSTANCE_FUNC(instance, vkDestroySurfaceKHR);
|
||||
|
||||
|
@ -184,6 +184,9 @@ extern PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR;
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
extern PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR;
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
extern PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR;
|
||||
#endif
|
||||
|
||||
extern PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
|
||||
|
||||
|
@ -66,6 +66,8 @@ static bool create_device(retro_vulkan_context *context, VkInstance instance, Vk
|
||||
vk->InitSurface(WINDOWSYSTEM_XCB, nullptr, nullptr);
|
||||
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
vk->InitSurface(WINDOWSYSTEM_WAYLAND, nullptr, nullptr);
|
||||
#elif defined(VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
vk->InitSurface(WINDOWSYSTEM_DISPLAY, nullptr, nullptr);
|
||||
#endif
|
||||
|
||||
context->gpu = vk->GetPhysicalDevice(physical_device);
|
||||
|
@ -372,6 +372,9 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr_libretro(VkInstan
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
|| !strcmp(pName, "vkCreateWaylandSurfaceKHR")
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_DISPLAY_KHR
|
||||
|| !strcmp(pName, "vkCreateDisplayPlaneSurfaceKHR")
|
||||
#endif
|
||||
) {
|
||||
return (PFN_vkVoidFunction)vkCreateLibretroSurfaceKHR;
|
||||
|
Loading…
Reference in New Issue
Block a user