Fix the set of queues made available to initial state CONCURRENT buffers

* We don't want to enable all queues on the physical device because not all of
  them are necessarily enabled in the device itself.
This commit is contained in:
baldurk
2019-04-04 13:11:18 +01:00
parent ff5f946e1e
commit fb826ee724
3 changed files with 10 additions and 7 deletions
+3 -2
View File
@@ -396,8 +396,9 @@ private:
vector<bool> m_ReplayPhysicalDevicesUsed;
// the queue families (an array of count for each) for the created device
vector<VkQueue *> m_QueueFamilies;
vector<uint32_t> m_QueueFamilyCounts;
std::vector<VkQueue *> m_QueueFamilies;
std::vector<uint32_t> m_QueueFamilyCounts;
std::vector<uint32_t> m_QueueFamilyIndices;
// a small amount of helper code during capture for handling resources on different queues in init
// states
+2 -5
View File
@@ -550,11 +550,8 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
// we make the buffer concurrently accessible by all queue families to not invalidate the
// contents of the memory we're reading back from.
bufInfo.sharingMode = VK_SHARING_MODE_CONCURRENT;
bufInfo.queueFamilyIndexCount = m_PhysicalDeviceData.queueCount;
std::vector<uint32_t> queues;
for(uint32_t i = 0; i < bufInfo.queueFamilyIndexCount; i++)
queues.push_back(i);
bufInfo.pQueueFamilyIndices = queues.data();
bufInfo.queueFamilyIndexCount = (uint32_t)m_QueueFamilyIndices.size();
bufInfo.pQueueFamilyIndices = m_QueueFamilyIndices.data();
// spec requires that CONCURRENT must specify more than one queue family. If there is only one
// queue family, we can safely use exclusive.
@@ -2191,6 +2191,7 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
m_QueueFamilies.resize(createInfo.queueCreateInfoCount);
m_QueueFamilyCounts.resize(createInfo.queueCreateInfoCount);
m_QueueFamilyIndices.clear();
for(size_t i = 0; i < createInfo.queueCreateInfoCount; i++)
{
uint32_t family = createInfo.pQueueCreateInfos[i].queueFamilyIndex;
@@ -2202,6 +2203,10 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
m_QueueFamilyCounts[family] = count;
for(uint32_t q = 0; q < count; q++)
m_QueueFamilies[family][q] = VK_NULL_HANDLE;
if(std::find(m_QueueFamilyIndices.begin(), m_QueueFamilyIndices.end(), family) ==
m_QueueFamilyIndices.end())
m_QueueFamilyIndices.push_back(family);
}
VkLayerDeviceCreateInfo *layerCreateInfo = (VkLayerDeviceCreateInfo *)pCreateInfo->pNext;