Add support for Vulkan 1.1 & 1.2

This commit is contained in:
Lynix
2020-03-26 20:42:57 +01:00
parent 42d58bd77c
commit d892e8eaff
12 changed files with 143 additions and 45 deletions

View File

@@ -21,6 +21,8 @@ namespace Nz
return false;
}
m_apiVersion = createInfo.pApplicationInfo->apiVersion;
// Store the allocator to access them when needed
if (allocator)
m_allocator = *allocator;
@@ -43,15 +45,22 @@ namespace Nz
#define NAZARA_VULKANRENDERER_INSTANCE_EXT_END() }
#define NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(func) func = reinterpret_cast<PFN_##func>(GetProcAddr(#func));
#define NAZARA_VULKANRENDERER_INSTANCE_CORE_EXT_FUNCTION(func, coreVersion, suffix, extName) \
if (m_apiVersion >= coreVersion) \
func = reinterpret_cast<PFN_##func>(GetProcAddr(#func)); \
else if (IsExtensionLoaded("VK_" #suffix "_" #extName)) \
func = reinterpret_cast<PFN_##func##suffix>(GetProcAddr(#func #suffix));
#include <Nazara/VulkanRenderer/Wrapper/InstanceFunctions.hpp>
#undef NAZARA_VULKANRENDERER_INSTANCE_CORE_EXT_FUNCTION
#undef NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN
#undef NAZARA_VULKANRENDERER_INSTANCE_EXT_END
#undef NAZARA_VULKANRENDERER_INSTANCE_FUNCTION
}
catch (const std::exception& e)
{
NazaraError(String("Failed to query instance function: ") + e.what());
NazaraError(std::string("Failed to query instance function: ") + e.what());
return false;
}
@@ -87,8 +96,8 @@ namespace Nz
{
NazaraAssert(extensionProperties, "Invalid extension properties vector");
// First, query physical device count
UInt32 extensionPropertyCount = 0; // Remember, Nz::UInt32 is a typedef on uint32_t
// First, query extension count
UInt32 extensionPropertyCount = 0;
m_lastErrorCode = vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionPropertyCount, nullptr);
if (m_lastErrorCode != VkResult::VK_SUCCESS)
{
@@ -99,7 +108,7 @@ namespace Nz
if (extensionPropertyCount == 0)
return true; //< No extension available
// Now we can get the list of the available physical device
// Now we can get the list of the available extensions
extensionProperties->resize(extensionPropertyCount);
m_lastErrorCode = vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionPropertyCount, extensionProperties->data());
if (m_lastErrorCode != VkResult::VK_SUCCESS)
@@ -139,9 +148,11 @@ namespace Nz
#define NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN(ext)
#define NAZARA_VULKANRENDERER_INSTANCE_EXT_END()
#define NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(func) func = nullptr;
#define NAZARA_VULKANRENDERER_INSTANCE_CORE_EXT_FUNCTION(func, ...) NAZARA_VULKANRENDERER_INSTANCE_FUNCTION(func)
#include <Nazara/VulkanRenderer/Wrapper/InstanceFunctions.hpp>
#undef NAZARA_VULKANRENDERER_INSTANCE_CORE_EXT_FUNCTION
#undef NAZARA_VULKANRENDERER_INSTANCE_EXT_BEGIN
#undef NAZARA_VULKANRENDERER_INSTANCE_EXT_END
#undef NAZARA_VULKANRENDERER_INSTANCE_FUNCTION