Skip to content
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

QueueFamilyIndices VulkanEngine::find_queue_families(VkPhysicalDevice device) #2

Open
EssenOH opened this issue Aug 1, 2022 · 3 comments

Comments

@EssenOH
Copy link

EssenOH commented Aug 1, 2022

it should be updated as following.

int i = 0;
for (const auto& queueFamily : queue_families) {

	if (queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
		indices.graphics_family = i;
	}
	
	if (queueFamily.queueFlags & VK_QUEUE_COMPUTE_BIT) {
		indices.compute_family = i;
	}
	
	if (queueFamily.queueFlags & VK_QUEUE_TRANSFER_BIT) {
		indices.transfer_family = i;
	}

	if (indices.is_complete()) {
		break;
	}

	i++;
}
@hooyuser
Copy link
Owner

hooyuser commented Aug 1, 2022

Thanks for your suggestions. Sorry I haven't spent enough time on vendor-specific problems. Here is the queue family information of my device. https://vulkan.gpuinfo.org/displayreport.php?id=11642#queuefamilies
queue family

For now, given the objective of asynchronous computing, I use the GRAPHICS|COMPUTE|TRANSFER queue family for graphics and the COMPUTE|TRANSFER queue family for computing. I guess the following treatment works for my purpose as well as produces a fallback.

int i = 0;
for (const auto& queueFamily : queue_families) {
        const VkQueueFlags queue_flags = queueFamily.queueFlags;

        if (queue_flags & VK_QUEUE_TRANSFER_BIT) {
	        if (!indices.transfer_family.has_value() || !(queue_flags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT))) {
		        indices.transfer_family = i;
	        }
        }

        if (queue_flags & VK_QUEUE_COMPUTE_BIT) {
	        if (!indices.compute_family.has_value() || !(queue_flags & VK_QUEUE_GRAPHICS_BIT)) {
		        indices.compute_family = i;
	        }
        }

        if (queue_flags & VK_QUEUE_GRAPHICS_BIT) {
	        indices.graphics_family = i;
        }

        if (indices.is_complete()) {
	        break;
        }
        
        i++;
}

I don't know your queue family information. Most of them are available on https://vulkan.gpuinfo.org. With that information, there may be better ways to handle your case.

@EssenOH
Copy link
Author

EssenOH commented Aug 1, 2022 via email

@hooyuser
Copy link
Owner

hooyuser commented Aug 1, 2022

I have updated the logic for queue family selection. You can pull the latest changes and check whether the fallback works as I expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants