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);
bool GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice device, std::vector<VkQueueFamilyProperties>* queueFamilyProperties);
inline bool IsExtensionLoaded(const std::string& extensionName);
inline bool IsLayerLoaded(const std::string& layerName);
inline bool IsExtensionLoaded(const std::string& extensionName) const;
inline bool IsLayerLoaded(const std::string& layerName) const;
inline bool IsValid() const;
Instance& operator=(const Instance&) = delete;

View File

@ -78,12 +78,12 @@ namespace Nz
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;
}
inline bool Instance::IsLayerLoaded(const std::string& layerName)
inline bool Instance::IsLayerLoaded(const std::string& layerName) const
{
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()
#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
NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(VK_KHR_xcb_surface)
NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR)

View File

@ -10,14 +10,13 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/VulkanRenderer/Config.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
#include <vulkan/vulkan.h>
namespace Nz
{
namespace Vk
{
class Instance;
class Surface
{
public:
@ -32,12 +31,6 @@ namespace Nz
inline bool Create(ANativeWindow* window, VkAndroidSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
#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
// VK_KHR_xcb_surface
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 GetSupportPresentation(VkPhysicalDevice physicalDevice, UInt32 queueFamilyIndex, bool* supported) const;
inline bool IsSupported() const;
inline VkResult GetLastErrorCode() const;
Surface& operator=(const Surface&) = delete;
@ -78,6 +69,8 @@ namespace Nz
inline operator VkSurfaceKHR() const;
static inline bool IsSupported(const Instance& instance);
private:
inline bool Create(const VkAllocationCallbacks* allocator);

View File

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