Vulkan/Surface: Remove MIR support

This commit is contained in:
Lynix 2020-04-13 15:12:19 +02:00
parent 75241ed8f0
commit 7447875753
5 changed files with 40 additions and 82 deletions

View File

@ -45,8 +45,8 @@ namespace Nz
inline VkPhysicalDeviceProperties GetPhysicalDeviceProperties(VkPhysicalDevice device); inline VkPhysicalDeviceProperties GetPhysicalDeviceProperties(VkPhysicalDevice device);
bool GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice device, std::vector<VkQueueFamilyProperties>* queueFamilyProperties); bool GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice device, std::vector<VkQueueFamilyProperties>* queueFamilyProperties);
inline bool IsExtensionLoaded(const std::string& extensionName); inline bool IsExtensionLoaded(const std::string& extensionName) const;
inline bool IsLayerLoaded(const std::string& layerName); inline bool IsLayerLoaded(const std::string& layerName) const;
inline bool IsValid() const; inline bool IsValid() const;
Instance& operator=(const Instance&) = delete; Instance& operator=(const Instance&) = delete;

View File

@ -78,12 +78,12 @@ namespace Nz
return m_lastErrorCode; return m_lastErrorCode;
} }
inline bool Instance::IsExtensionLoaded(const std::string& extensionName) inline bool Instance::IsExtensionLoaded(const std::string& extensionName) const
{ {
return m_loadedExtensions.count(extensionName) > 0; return m_loadedExtensions.count(extensionName) > 0;
} }
inline bool Instance::IsLayerLoaded(const std::string& layerName) inline bool Instance::IsLayerLoaded(const std::string& layerName) const
{ {
return m_loadedLayers.count(layerName) > 0; return m_loadedLayers.count(layerName) > 0;
} }

View File

@ -55,13 +55,6 @@ NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_KHR_android_surface)
NAZARA_VULKANRENDERER_INSTANCE_EXT_END() NAZARA_VULKANRENDERER_INSTANCE_EXT_END()
#endif #endif
#ifdef VK_USE_PLATFORM_MIR_KHR
NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_KHR_mir_surface)
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkCreateMirSurfaceKHR)
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkGetPhysicalDeviceMirPresentationSupportKHR)
NAZARA_VULKANRENDERER_INSTANCE_EXT_END()
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_KHR_xcb_surface) NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_KHR_xcb_surface)
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR) NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR)

View File

@ -10,14 +10,13 @@
#include <Nazara/Prerequisites.hpp> #include <Nazara/Prerequisites.hpp>
#include <Nazara/VulkanRenderer/Config.hpp> #include <Nazara/VulkanRenderer/Config.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp> #include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
namespace Nz namespace Nz
{ {
namespace Vk namespace Vk
{ {
class Instance;
class Surface class Surface
{ {
public: public:
@ -32,12 +31,6 @@ namespace Nz
inline bool Create(ANativeWindow* window, VkAndroidSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr); inline bool Create(ANativeWindow* window, VkAndroidSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
#endif #endif
#ifdef VK_USE_PLATFORM_MIR_KHR
// VK_KHR_mir_surface
inline bool Create(const VkMirSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr);
inline bool Create(MirConnection* connection, MirSurface* surface, VkMirSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
// VK_KHR_xcb_surface // VK_KHR_xcb_surface
inline bool Create(const VkXcbSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr); inline bool Create(const VkXcbSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr);
@ -69,8 +62,6 @@ namespace Nz
bool GetPresentModes(VkPhysicalDevice physicalDevice, std::vector<VkPresentModeKHR>* presentModes) const; bool GetPresentModes(VkPhysicalDevice physicalDevice, std::vector<VkPresentModeKHR>* presentModes) const;
bool GetSupportPresentation(VkPhysicalDevice physicalDevice, UInt32 queueFamilyIndex, bool* supported) const; bool GetSupportPresentation(VkPhysicalDevice physicalDevice, UInt32 queueFamilyIndex, bool* supported) const;
inline bool IsSupported() const;
inline VkResult GetLastErrorCode() const; inline VkResult GetLastErrorCode() const;
Surface& operator=(const Surface&) = delete; Surface& operator=(const Surface&) = delete;
@ -78,6 +69,8 @@ namespace Nz
inline operator VkSurfaceKHR() const; inline operator VkSurfaceKHR() const;
static inline bool IsSupported(const Instance& instance);
private: private:
inline bool Create(const VkAllocationCallbacks* allocator); inline bool Create(const VkAllocationCallbacks* allocator);

View File

@ -5,7 +5,6 @@
#include <Nazara/VulkanRenderer/Wrapper/Surface.hpp> #include <Nazara/VulkanRenderer/Wrapper/Surface.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/VulkanRenderer/Utils.hpp> #include <Nazara/VulkanRenderer/Utils.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp> #include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz namespace Nz
@ -53,28 +52,6 @@ namespace Nz
} }
#endif #endif
#ifdef VK_USE_PLATFORM_MIR_KHR
inline bool Surface::Create(const VkMirSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator)
{
m_lastErrorCode = m_instance.vkCreateMirSurfaceKHR(m_instance, &createInfo, allocator, &m_surface);
return Create(allocator);
}
inline bool Surface::Create(MirConnection* connection, MirSurface* surface, VkMirSurfaceCreateFlagsKHR flags, const VkAllocationCallbacks* allocator)
{
VkMirSurfaceCreateInfoKHR createInfo =
{
VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR,
nullptr,
flags,
connection,
surface
};
return Create(createInfo, allocator);
}
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
inline bool Surface::Create(const VkXcbSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator) inline bool Surface::Create(const VkXcbSurfaceCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator)
{ {
@ -250,49 +227,44 @@ namespace Nz
return true; return true;
} }
inline bool Surface::IsSupported() const inline Surface::operator VkSurfaceKHR() const
{ {
if (!m_instance.IsExtensionLoaded("VK_KHR_surface")) return m_surface;
}
inline bool Surface::IsSupported(const Instance& instance)
{
if (!instance.IsExtensionLoaded(VK_KHR_SURFACE_EXTENSION_NAME))
return false; return false;
#ifdef VK_USE_PLATFORM_ANDROID_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR
if (m_instance.IsExtensionLoaded("VK_KHR_android_surface")) if (instance.IsExtensionLoaded(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME))
return true;
#endif
#ifdef VK_USE_PLATFORM_MIR_KHR
if (m_instance.IsExtensionLoaded("VK_KHR_mir_surface"))
return true; return true;
#endif #endif
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
if (m_instance.IsExtensionLoaded("VK_KHR_xcb_surface")) if (instance.IsExtensionLoaded(VK_KHR_XCB_SURFACE_EXTENSION_NAME))
return true; return true;
#endif #endif
#ifdef VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR
if (m_instance.IsExtensionLoaded("VK_KHR_xlib_surface")) if (instance.IsExtensionLoaded(VK_KHR_XLIB_SURFACE_EXTENSION_NAME))
return true; return true;
#endif #endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR
if (m_instance.IsExtensionLoaded("VK_KHR_wayland_surface")) if (instance.IsExtensionLoaded(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME))
return true; return true;
#endif #endif
#ifdef VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR
if (m_instance.IsExtensionLoaded("VK_KHR_win32_surface")) if (instance.IsExtensionLoaded(VK_KHR_WIN32_SURFACE_EXTENSION_NAME))
return true; return true;
#endif #endif
return false; return false;
} }
inline Surface::operator VkSurfaceKHR() const
{
return m_surface;
}
inline bool Surface::Create(const VkAllocationCallbacks* allocator) inline bool Surface::Create(const VkAllocationCallbacks* allocator)
{ {
if (m_lastErrorCode != VkResult::VK_SUCCESS) if (m_lastErrorCode != VkResult::VK_SUCCESS)