Skip to content

[FIXED] transferQueue queueFamilyIndex #965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vsg/app/CompileTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ CompileTraversal::~CompileTraversal()

void CompileTraversal::add(ref_ptr<Device> device, const ResourceRequirements& resourceRequirements)
{
// TODO : need to ensure queueFamily matches the main queue's queueFamily, or implement queue family ownership transfer, or defer copy and transfer commands to TransferTask?
auto queueFamily = device->getPhysicalDevice()->getQueueFamily(queueFlags);
auto context = Context::create(device, resourceRequirements);
context->commandPool = CommandPool::create(device, queueFamily, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
Expand All @@ -71,6 +72,7 @@ void CompileTraversal::add(Window& window, ref_ptr<ViewportState> viewport, cons
{
auto device = window.getOrCreateDevice();
auto renderPass = window.getOrCreateRenderPass();
// TODO : need to ensure queueFamily matches the main queue's queueFamily, or implement queue family ownership transfer, or defer copy and transfer commands to TransferTask?
auto queueFamily = device->getPhysicalDevice()->getQueueFamily(queueFlags);
auto context = Context::create(device, resourceRequirements);
context->renderPass = renderPass;
Expand All @@ -91,6 +93,7 @@ void CompileTraversal::add(Window& window, ref_ptr<View> view, const ResourceReq
{
auto device = window.getOrCreateDevice();
auto renderPass = window.getOrCreateRenderPass();
// TODO : need to ensure queueFamily matches the main queue's queueFamily, or implement queue family ownership transfer, or defer copy and transfer commands to TransferTask?
auto queueFamily = device->getPhysicalDevice()->getQueueFamily(queueFlags);
auto context = Context::create(device, resourceRequirements);
context->renderPass = renderPass;
Expand All @@ -117,6 +120,7 @@ void CompileTraversal::add(Framebuffer& framebuffer, ref_ptr<View> view, const R
{
auto device = framebuffer.getDevice();
auto renderPass = framebuffer.getRenderPass();
// TODO : need to ensure queueFamily matches the main queue's queueFamily, or implement queue family ownership transfer, or defer copy and transfer commands to TransferTask?
auto queueFamily = device->getPhysicalDevice()->getQueueFamily(VK_QUEUE_GRAPHICS_BIT);
auto context = Context::create(device, resourceRequirements);
context->renderPass = renderPass;
Expand Down
8 changes: 7 additions & 1 deletion src/vsg/app/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr
// get main queue used for RecordAndSubmitTask
ref_ptr<Queue> mainQueue = device->getQueue(deviceQueueFamily.queueFamily);

// get presentat queue if required/supported
// get presentation queue if required/supported
ref_ptr<Queue> presentQueue;
if (deviceQueueFamily.presentFamily >= 0) presentQueue = device->getQueue(deviceQueueFamily.presentFamily);

Expand All @@ -485,6 +485,12 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr
VkQueueFlags transferQueueFlags = VK_QUEUE_TRANSFER_BIT | VK_QUEUE_GRAPHICS_BIT; // use VK_QUEUE_GRAPHICS_BIT to ensure we can blit images
for (auto& queue : device->getQueues())
{
if (mainQueue->queueFamilyIndex() != queue->queueFamilyIndex())
{
// need to implement queue family ownership transfer to use a different queue family
// see Vulkan spec 7.4.4, "Queue Family Ownership Transfer"
continue;
}
if ((queue->queueFlags() & transferQueueFlags) == transferQueueFlags)
{
if (queue != mainQueue)
Expand Down