Make Vk::Device store a reference to Vk::PhysicalDevice info
This commit is contained in:
@@ -429,7 +429,7 @@ namespace Nz
|
||||
};
|
||||
|
||||
std::shared_ptr<VulkanDevice> device = std::make_shared<VulkanDevice>(s_instance);
|
||||
if (!device->Create(gpu, createInfo))
|
||||
if (!device->Create(GetPhysicalDeviceInfo(gpu), createInfo))
|
||||
{
|
||||
NazaraError("Failed to create Vulkan Device: " + TranslateVulkanError(device->GetLastErrorCode()));
|
||||
return {};
|
||||
|
||||
@@ -12,23 +12,16 @@ namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
bool Device::Create(VkPhysicalDevice device, const VkDeviceCreateInfo& createInfo, const VkAllocationCallbacks* allocator)
|
||||
bool Device::Create(const Vk::PhysicalDevice& deviceInfo, const VkDeviceCreateInfo& createInfo, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
std::vector<VkQueueFamilyProperties> queuesProperties;
|
||||
if (!m_instance.GetPhysicalDeviceQueueFamilyProperties(device, &queuesProperties))
|
||||
{
|
||||
NazaraError("Failed to query queue family properties");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_lastErrorCode = m_instance.vkCreateDevice(device, &createInfo, allocator, &m_device);
|
||||
m_lastErrorCode = m_instance.vkCreateDevice(deviceInfo.device, &createInfo, allocator, &m_device);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
NazaraError("Failed to create Vulkan device");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_physicalDevice = device;
|
||||
m_physicalDevice = &deviceInfo;
|
||||
|
||||
// Store the allocator to access them when needed
|
||||
if (allocator)
|
||||
@@ -76,7 +69,7 @@ namespace Nz
|
||||
if (info.familyIndex > maxFamilyIndex)
|
||||
maxFamilyIndex = info.familyIndex;
|
||||
|
||||
const VkQueueFamilyProperties& queueProperties = queuesProperties[info.familyIndex];
|
||||
const VkQueueFamilyProperties& queueProperties = deviceInfo.queues[info.familyIndex];
|
||||
info.flags = queueProperties.queueFlags;
|
||||
info.minImageTransferGranularity = queueProperties.minImageTransferGranularity;
|
||||
info.timestampValidBits = queueProperties.timestampValidBits;
|
||||
|
||||
Reference in New Issue
Block a user