VulkanRenderer: Fix 32bits compilation

This commit is contained in:
Lynix
2023-01-02 22:11:00 +01:00
parent ed9035318f
commit cc1246dcac
8 changed files with 20 additions and 12 deletions

View File

@@ -48,6 +48,8 @@ namespace Nz
inline VkVertexInputRate ToVulkan(VertexInputRate inputRate);
NAZARA_VULKANRENDERER_API std::string TranslateVulkanError(VkResult code);
template<typename T> UInt64 VulkanHandleToInteger(T handle);
}
#include <Nazara/VulkanRenderer/Utils.inl>

View File

@@ -497,6 +497,18 @@ namespace Nz
NazaraError("Unhandled VertexInputRate 0x" + NumberToString(UnderlyingCast(inputRate), 16));
return {};
}
template<typename T>
UInt64 VulkanHandleToInteger(T handle)
{
if constexpr (std::is_pointer_v<T>)
return static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(handle));
else
{
static_assert(std::is_integral_v<T>);
return static_cast<UInt64>(handle);
}
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@@ -86,13 +86,7 @@ namespace Nz::Vk
template<typename T>
void DeviceObject<C, VkType, CreateInfo, ObjectType>::SetDebugName(T&& name)
{
UInt64 objectHandle;
if constexpr (std::is_pointer_v<VkType>)
objectHandle = static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_handle));
else
objectHandle = static_cast<UInt64>(m_handle);
return m_device->SetDebugName(ObjectType, objectHandle, std::forward<T>(name));
return m_device->SetDebugName(ObjectType, VulkanHandleToInteger(m_handle), std::forward<T>(name));
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>

View File

@@ -61,7 +61,7 @@ namespace Nz
inline void Pipeline::SetDebugName(std::string_view name)
{
return m_device->SetDebugName(VK_OBJECT_TYPE_PIPELINE, static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_handle)), name);
return m_device->SetDebugName(VK_OBJECT_TYPE_PIPELINE, VulkanHandleToInteger(m_handle), name);
}
inline Pipeline::operator VkPipeline() const