mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Allow forcing on a graphics or compute-only queue in demos
* This creates multiple queues and can be useful for testing, when the test only uses one or the other as its primary queue.
This commit is contained in:
@@ -580,6 +580,20 @@ void VulkanGraphicsTest::Prepare(int argc, char **argv)
|
||||
std::vector<VkQueueFamilyProperties> queueProps;
|
||||
vkh::getQueueFamilyProperties(queueProps, phys);
|
||||
|
||||
for(uint32_t q = 0; q < queueProps.size(); q++)
|
||||
{
|
||||
if(queueProps[q].queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||
{
|
||||
if(graphicsQueueFamilyIndex == ~0U)
|
||||
graphicsQueueFamilyIndex = q;
|
||||
}
|
||||
else if(queueProps[q].queueFlags & VK_QUEUE_COMPUTE_BIT)
|
||||
{
|
||||
if(computeQueueFamilyIndex == ~0U)
|
||||
computeQueueFamilyIndex = q;
|
||||
}
|
||||
}
|
||||
|
||||
// if no queue has been selected, find it now
|
||||
if(queueFamilyIndex == ~0U)
|
||||
{
|
||||
@@ -652,10 +666,24 @@ bool VulkanGraphicsTest::Init()
|
||||
devExts.push_back(search);
|
||||
}
|
||||
|
||||
const std::vector<float> priorities = {
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
};
|
||||
|
||||
std::vector<VkDeviceQueueCreateInfo> queueCreates = {
|
||||
vkh::DeviceQueueCreateInfo(queueFamilyIndex, queueCount, priorities),
|
||||
};
|
||||
|
||||
if(queueFamilyIndex != graphicsQueueFamilyIndex && forceGraphicsQueue)
|
||||
queueCreates.push_back(vkh::DeviceQueueCreateInfo(graphicsQueueFamilyIndex, 1, priorities));
|
||||
if(queueFamilyIndex != computeQueueFamilyIndex &&
|
||||
(graphicsQueueFamilyIndex != computeQueueFamilyIndex || !forceGraphicsQueue) &&
|
||||
forceComputeQueue)
|
||||
queueCreates.push_back(vkh::DeviceQueueCreateInfo(computeQueueFamilyIndex, 1, priorities));
|
||||
|
||||
CHECK_VKR(vkCreateDevice(
|
||||
phys, vkh::DeviceCreateInfo({vkh::DeviceQueueCreateInfo(queueFamilyIndex, queueCount)},
|
||||
enabledLayers, devExts, features)
|
||||
.next(devInfoNext),
|
||||
phys, vkh::DeviceCreateInfo(queueCreates, enabledLayers, devExts, features).next(devInfoNext),
|
||||
NULL, &device));
|
||||
|
||||
volkLoadDevice(device);
|
||||
|
||||
@@ -271,6 +271,11 @@ struct VulkanGraphicsTest : public GraphicsTest
|
||||
VkQueueFlags queueFlagsRequired = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT;
|
||||
VkQueueFlags queueFlagsBanned = 0;
|
||||
|
||||
bool forceGraphicsQueue = false;
|
||||
bool forceComputeQueue = false;
|
||||
uint32_t graphicsQueueFamilyIndex = ~0U;
|
||||
uint32_t computeQueueFamilyIndex = ~0U;
|
||||
|
||||
bool hasExt(const char *ext);
|
||||
|
||||
// a custom struct to pass to vkDeviceCreateInfo::pNext
|
||||
|
||||
Reference in New Issue
Block a user