mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Unify Vulkan implementations under one header
This commit is contained in:
parent
01e4f3f783
commit
86682d99dd
@ -41,6 +41,7 @@ set(SRC
|
|||||||
${SRCROOT}/VideoModeImpl.hpp
|
${SRCROOT}/VideoModeImpl.hpp
|
||||||
${SRCROOT}/Vulkan.cpp
|
${SRCROOT}/Vulkan.cpp
|
||||||
${INCROOT}/Vulkan.hpp
|
${INCROOT}/Vulkan.hpp
|
||||||
|
${SRCROOT}/VulkanImpl.hpp
|
||||||
${SRCROOT}/Window.cpp
|
${SRCROOT}/Window.cpp
|
||||||
${INCROOT}/Window.hpp
|
${INCROOT}/Window.hpp
|
||||||
${SRCROOT}/WindowBase.cpp
|
${SRCROOT}/WindowBase.cpp
|
||||||
@ -66,7 +67,6 @@ if(SFML_OS_WINDOWS)
|
|||||||
${SRCROOT}/Win32/SensorImpl.cpp
|
${SRCROOT}/Win32/SensorImpl.cpp
|
||||||
${SRCROOT}/Win32/VideoModeImpl.cpp
|
${SRCROOT}/Win32/VideoModeImpl.cpp
|
||||||
${SRCROOT}/Win32/VulkanImplWin32.cpp
|
${SRCROOT}/Win32/VulkanImplWin32.cpp
|
||||||
${SRCROOT}/Win32/VulkanImplWin32.hpp
|
|
||||||
${SRCROOT}/Win32/WindowImplWin32.cpp
|
${SRCROOT}/Win32/WindowImplWin32.cpp
|
||||||
${SRCROOT}/Win32/WindowImplWin32.hpp
|
${SRCROOT}/Win32/WindowImplWin32.hpp
|
||||||
)
|
)
|
||||||
@ -123,7 +123,6 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
|||||||
${SRCROOT}/Unix/Utils.hpp
|
${SRCROOT}/Unix/Utils.hpp
|
||||||
${SRCROOT}/Unix/VideoModeImpl.cpp
|
${SRCROOT}/Unix/VideoModeImpl.cpp
|
||||||
${SRCROOT}/Unix/VulkanImplX11.cpp
|
${SRCROOT}/Unix/VulkanImplX11.cpp
|
||||||
${SRCROOT}/Unix/VulkanImplX11.hpp
|
|
||||||
${SRCROOT}/Unix/WindowImplX11.cpp
|
${SRCROOT}/Unix/WindowImplX11.cpp
|
||||||
${SRCROOT}/Unix/WindowImplX11.hpp
|
${SRCROOT}/Unix/WindowImplX11.hpp
|
||||||
)
|
)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Unix/Display.hpp>
|
#include <SFML/Window/Unix/Display.hpp>
|
||||||
#include <SFML/Window/Unix/VulkanImplX11.hpp>
|
#include <SFML/Window/VulkanImpl.hpp>
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
@ -106,7 +106,7 @@ VulkanLibraryWrapper wrapper;
|
|||||||
namespace sf::priv
|
namespace sf::priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool VulkanImplX11::isAvailable(bool requireGraphics)
|
bool VulkanImpl::isAvailable(bool requireGraphics)
|
||||||
{
|
{
|
||||||
static bool checked = false;
|
static bool checked = false;
|
||||||
static bool computeAvailable = false;
|
static bool computeAvailable = false;
|
||||||
@ -164,7 +164,7 @@ bool VulkanImplX11::isAvailable(bool requireGraphics)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VulkanFunctionPointer VulkanImplX11::getFunction(const char* name)
|
VulkanFunctionPointer VulkanImpl::getFunction(const char* name)
|
||||||
{
|
{
|
||||||
if (!isAvailable(false))
|
if (!isAvailable(false))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -174,7 +174,7 @@ VulkanFunctionPointer VulkanImplX11::getFunction(const char* name)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::vector<const char*>& VulkanImplX11::getGraphicsRequiredInstanceExtensions()
|
const std::vector<const char*>& VulkanImpl::getGraphicsRequiredInstanceExtensions()
|
||||||
{
|
{
|
||||||
static const std::vector<const char*> extensions{VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME};
|
static const std::vector<const char*> extensions{VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME};
|
||||||
return extensions;
|
return extensions;
|
||||||
@ -182,10 +182,10 @@ const std::vector<const char*>& VulkanImplX11::getGraphicsRequiredInstanceExtens
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool VulkanImplX11::createVulkanSurface(const VkInstance& instance,
|
bool VulkanImpl::createVulkanSurface(const VkInstance& instance,
|
||||||
WindowHandle windowHandle,
|
WindowHandle windowHandle,
|
||||||
VkSurfaceKHR& surface,
|
VkSurfaceKHR& surface,
|
||||||
const VkAllocationCallbacks* allocator)
|
const VkAllocationCallbacks* allocator)
|
||||||
{
|
{
|
||||||
if (!isAvailable())
|
if (!isAvailable())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Window/Vulkan.hpp>
|
|
||||||
#include <SFML/Window/WindowHandle.hpp>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf::priv
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Linux (X11) implementation of Vulkan
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class VulkanImplX11
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Tell whether or not the system supports Vulkan
|
|
||||||
///
|
|
||||||
/// This function should always be called before using
|
|
||||||
/// the Vulkan features. If it returns false, then
|
|
||||||
/// any attempt to use Vulkan will fail.
|
|
||||||
///
|
|
||||||
/// If only compute is required, set \a requireGraphics
|
|
||||||
/// to false to skip checking for the extensions necessary
|
|
||||||
/// for graphics rendering.
|
|
||||||
///
|
|
||||||
/// \param requireGraphics
|
|
||||||
///
|
|
||||||
/// \return True if Vulkan is supported, false otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static bool isAvailable(bool requireGraphics = true);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the address of a Vulkan function
|
|
||||||
///
|
|
||||||
/// \param name Name of the function to get the address of
|
|
||||||
///
|
|
||||||
/// \return Address of the Vulkan function, 0 on failure
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static VulkanFunctionPointer getFunction(const char* name);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get Vulkan instance extensions required for graphics
|
|
||||||
///
|
|
||||||
/// \return Vulkan instance extensions required for graphics
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static const std::vector<const char*>& getGraphicsRequiredInstanceExtensions();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create a Vulkan rendering surface
|
|
||||||
///
|
|
||||||
/// \param instance Vulkan instance
|
|
||||||
/// \param windowHandle Handle to the window to create the surface for
|
|
||||||
/// \param surface Created surface
|
|
||||||
/// \param allocator Allocator to use
|
|
||||||
///
|
|
||||||
/// \return True if surface creation was successful, false otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static bool createVulkanSurface(const VkInstance& instance,
|
|
||||||
WindowHandle windowHandle,
|
|
||||||
VkSurfaceKHR& surface,
|
|
||||||
const VkAllocationCallbacks* allocator);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf::priv
|
|
@ -31,8 +31,7 @@
|
|||||||
|
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
#if defined(SFML_SYSTEM_WINDOWS)
|
||||||
|
|
||||||
#include <SFML/Window/Win32/VulkanImplWin32.hpp>
|
#include <SFML/Window/VulkanImpl.hpp>
|
||||||
using VulkanImplType = sf::priv::VulkanImplWin32;
|
|
||||||
|
|
||||||
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || \
|
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || \
|
||||||
defined(SFML_SYSTEM_NETBSD)
|
defined(SFML_SYSTEM_NETBSD)
|
||||||
@ -43,8 +42,7 @@ using VulkanImplType = sf::priv::VulkanImplWin32;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <SFML/Window/Unix/VulkanImplX11.hpp>
|
#include <SFML/Window/VulkanImpl.hpp>
|
||||||
using VulkanImplType = sf::priv::VulkanImplX11;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -66,7 +64,7 @@ bool Vulkan::isAvailable([[maybe_unused]] bool requireGraphics)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
return VulkanImplType::isAvailable(requireGraphics);
|
return priv::VulkanImpl::isAvailable(requireGraphics);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -83,7 +81,7 @@ VulkanFunctionPointer Vulkan::getFunction([[maybe_unused]] const char* name)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
return VulkanImplType::getFunction(name);
|
return priv::VulkanImpl::getFunction(name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -100,7 +98,7 @@ const std::vector<const char*>& Vulkan::getGraphicsRequiredInstanceExtensions()
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
return VulkanImplType::getGraphicsRequiredInstanceExtensions();
|
return priv::VulkanImpl::getGraphicsRequiredInstanceExtensions();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
90
src/SFML/Window/VulkanImpl.hpp
Normal file
90
src/SFML/Window/VulkanImpl.hpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SFML - Simple and Fast Multimedia Library
|
||||||
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
|
// subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented;
|
||||||
|
// you must not claim that you wrote the original software.
|
||||||
|
// If you use this software in a product, an acknowledgment
|
||||||
|
// in the product documentation would be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
|
// and must not be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Window/Vulkan.hpp>
|
||||||
|
#include <SFML/Window/WindowHandle.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
namespace sf::priv::VulkanImpl
|
||||||
|
{
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Tell whether or not the system supports Vulkan
|
||||||
|
///
|
||||||
|
/// This function should always be called before using
|
||||||
|
/// the Vulkan features. If it returns false, then
|
||||||
|
/// any attempt to use Vulkan will fail.
|
||||||
|
///
|
||||||
|
/// If only compute is required, set \a requireGraphics
|
||||||
|
/// to false to skip checking for the extensions necessary
|
||||||
|
/// for graphics rendering.
|
||||||
|
///
|
||||||
|
/// \param requireGraphics
|
||||||
|
///
|
||||||
|
/// \return True if Vulkan is supported, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
[[nodiscard]] bool isAvailable(bool requireGraphics = true);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the address of a Vulkan function
|
||||||
|
///
|
||||||
|
/// \param name Name of the function to get the address of
|
||||||
|
///
|
||||||
|
/// \return Address of the Vulkan function, nullptr on failure
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
[[nodiscard]] VulkanFunctionPointer getFunction(const char* name);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get Vulkan instance extensions required for graphics
|
||||||
|
///
|
||||||
|
/// \return Vulkan instance extensions required for graphics
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
[[nodiscard]] const std::vector<const char*>& getGraphicsRequiredInstanceExtensions();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create a Vulkan rendering surface
|
||||||
|
///
|
||||||
|
/// \param instance Vulkan instance
|
||||||
|
/// \param windowHandle Handle to the window to create the surface for
|
||||||
|
/// \param surface Created surface
|
||||||
|
/// \param allocator Allocator to use
|
||||||
|
///
|
||||||
|
/// \return True if surface creation was successful, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
[[nodiscard]] bool createVulkanSurface(const VkInstance& instance,
|
||||||
|
WindowHandle windowHandle,
|
||||||
|
VkSurfaceKHR& surface,
|
||||||
|
const VkAllocationCallbacks* allocator);
|
||||||
|
|
||||||
|
} // namespace sf::priv::VulkanImpl
|
@ -25,7 +25,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Win32/VulkanImplWin32.hpp>
|
#include <SFML/Window/VulkanImpl.hpp>
|
||||||
|
|
||||||
#include <SFML/System/Win32/WindowsHeader.hpp>
|
#include <SFML/System/Win32/WindowsHeader.hpp>
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ VulkanLibraryWrapper wrapper;
|
|||||||
namespace sf::priv
|
namespace sf::priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool VulkanImplWin32::isAvailable(bool requireGraphics)
|
bool VulkanImpl::isAvailable(bool requireGraphics)
|
||||||
{
|
{
|
||||||
static bool checked = false;
|
static bool checked = false;
|
||||||
static bool computeAvailable = false;
|
static bool computeAvailable = false;
|
||||||
@ -163,7 +163,7 @@ bool VulkanImplWin32::isAvailable(bool requireGraphics)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VulkanFunctionPointer VulkanImplWin32::getFunction(const char* name)
|
VulkanFunctionPointer VulkanImpl::getFunction(const char* name)
|
||||||
{
|
{
|
||||||
if (!isAvailable(false))
|
if (!isAvailable(false))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -173,7 +173,7 @@ VulkanFunctionPointer VulkanImplWin32::getFunction(const char* name)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::vector<const char*>& VulkanImplWin32::getGraphicsRequiredInstanceExtensions()
|
const std::vector<const char*>& VulkanImpl::getGraphicsRequiredInstanceExtensions()
|
||||||
{
|
{
|
||||||
static const std::vector<const char*> extensions{VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME};
|
static const std::vector<const char*> extensions{VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME};
|
||||||
return extensions;
|
return extensions;
|
||||||
@ -181,10 +181,10 @@ const std::vector<const char*>& VulkanImplWin32::getGraphicsRequiredInstanceExte
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool VulkanImplWin32::createVulkanSurface(const VkInstance& instance,
|
bool VulkanImpl::createVulkanSurface(const VkInstance& instance,
|
||||||
WindowHandle windowHandle,
|
WindowHandle windowHandle,
|
||||||
VkSurfaceKHR& surface,
|
VkSurfaceKHR& surface,
|
||||||
const VkAllocationCallbacks* allocator)
|
const VkAllocationCallbacks* allocator)
|
||||||
{
|
{
|
||||||
if (!isAvailable())
|
if (!isAvailable())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <SFML/Window/Vulkan.hpp>
|
|
||||||
#include <SFML/Window/WindowHandle.hpp>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf::priv
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Windows implementation of Vulkan
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
class VulkanImplWin32
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Tell whether or not the system supports Vulkan
|
|
||||||
///
|
|
||||||
/// This function should always be called before using
|
|
||||||
/// the Vulkan features. If it returns false, then
|
|
||||||
/// any attempt to use Vulkan will fail.
|
|
||||||
///
|
|
||||||
/// If only compute is required, set \a requireGraphics
|
|
||||||
/// to false to skip checking for the extensions necessary
|
|
||||||
/// for graphics rendering.
|
|
||||||
///
|
|
||||||
/// \param requireGraphics
|
|
||||||
///
|
|
||||||
/// \return True if Vulkan is supported, false otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static bool isAvailable(bool requireGraphics = true);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get the address of a Vulkan function
|
|
||||||
///
|
|
||||||
/// \param name Name of the function to get the address of
|
|
||||||
///
|
|
||||||
/// \return Address of the Vulkan function, 0 on failure
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static VulkanFunctionPointer getFunction(const char* name);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Get Vulkan instance extensions required for graphics
|
|
||||||
///
|
|
||||||
/// \return Vulkan instance extensions required for graphics
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static const std::vector<const char*>& getGraphicsRequiredInstanceExtensions();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Create a Vulkan rendering surface
|
|
||||||
///
|
|
||||||
/// \param instance Vulkan instance
|
|
||||||
/// \param windowHandle Handle to the window to create the surface for
|
|
||||||
/// \param surface Created surface
|
|
||||||
/// \param allocator Allocator to use
|
|
||||||
///
|
|
||||||
/// \return True if surface creation was successful, false otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static bool createVulkanSurface(const VkInstance& instance,
|
|
||||||
WindowHandle windowHandle,
|
|
||||||
VkSurfaceKHR& surface,
|
|
||||||
const VkAllocationCallbacks* allocator);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sf::priv
|
|
@ -44,8 +44,7 @@
|
|||||||
#include <SFML/Window/Win32/WindowImplWin32.hpp>
|
#include <SFML/Window/Win32/WindowImplWin32.hpp>
|
||||||
using WindowImplType = sf::priv::WindowImplWin32;
|
using WindowImplType = sf::priv::WindowImplWin32;
|
||||||
|
|
||||||
#include <SFML/Window/Win32/VulkanImplWin32.hpp>
|
#include <SFML/Window/VulkanImpl.hpp>
|
||||||
using VulkanImplType = sf::priv::VulkanImplWin32;
|
|
||||||
|
|
||||||
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || \
|
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || \
|
||||||
defined(SFML_SYSTEM_NETBSD)
|
defined(SFML_SYSTEM_NETBSD)
|
||||||
@ -62,8 +61,7 @@ using WindowImplType = sf::priv::WindowImplDRM;
|
|||||||
#include <SFML/Window/Unix/WindowImplX11.hpp>
|
#include <SFML/Window/Unix/WindowImplX11.hpp>
|
||||||
using WindowImplType = sf::priv::WindowImplX11;
|
using WindowImplType = sf::priv::WindowImplX11;
|
||||||
|
|
||||||
#include <SFML/Window/Unix/VulkanImplX11.hpp>
|
#include <SFML/Window/VulkanImpl.hpp>
|
||||||
using VulkanImplType = sf::priv::VulkanImplX11;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -324,7 +322,7 @@ bool WindowImpl::createVulkanSurface([[maybe_unused]] const VkInstance&
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
return VulkanImplType::createVulkanSurface(instance, getNativeHandle(), surface, allocator);
|
return VulkanImpl::createVulkanSurface(instance, getNativeHandle(), surface, allocator);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user