engine_vulkan: Fixes of queue allocation
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 8m48s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 8m48s
- Avoid to allocate dedicated queue for presentation and use graphics queue for it - Use queueCount of Queue Family Properties for queue support checking
This commit is contained in:
parent
4676b1b5b8
commit
d10212ac3b
1 changed files with 16 additions and 15 deletions
|
@ -45,7 +45,6 @@ impl From<Option<&DisplayHandleWrapper>> for VulkanQueueFamilyStatus {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct VulkanQueueFamilyIndices {
|
||||
pub present_queue_family_index: VulkanQueueFamilyStatus,
|
||||
pub graphics_queue_family_index: VulkanQueueFamilyStatus,
|
||||
pub compute_queue_family_index: VulkanQueueFamilyStatus,
|
||||
pub transfer_queue_family_index: VulkanQueueFamilyStatus,
|
||||
|
@ -54,7 +53,6 @@ pub struct VulkanQueueFamilyIndices {
|
|||
impl From<VulkanQueueFamilyIndices> for Vec<VulkanQueueFamilyStatus> {
|
||||
fn from(indices: VulkanQueueFamilyIndices) -> Self {
|
||||
vec![
|
||||
indices.present_queue_family_index,
|
||||
indices.graphics_queue_family_index,
|
||||
indices.compute_queue_family_index,
|
||||
indices.transfer_queue_family_index,
|
||||
|
@ -93,7 +91,6 @@ impl From<VulkanQueueFamilyIndices> for Vec<QueueCreateInfo> {
|
|||
impl<'a> From<&'a VulkanQueuesQuery<'a>> for VulkanQueueFamilyIndices {
|
||||
fn from(query: &'a VulkanQueuesQuery<'a>) -> Self {
|
||||
VulkanQueueFamilyIndices {
|
||||
present_queue_family_index: query.with_surface.into(),
|
||||
graphics_queue_family_index: query.with_graphics_queue.into(),
|
||||
compute_queue_family_index: query.with_compute_queue.into(),
|
||||
transfer_queue_family_index: query.with_transfer_queue.into(),
|
||||
|
@ -116,36 +113,40 @@ pub fn find_queues_family_indices(
|
|||
|
||||
for (i, queue_family_properties) in physical_device.queue_family_properties().iter().enumerate()
|
||||
{
|
||||
if indices.present_queue_family_index.can_be_set()
|
||||
&& check_presentation_support(
|
||||
let mut available_queue_count = queue_family_properties.queue_count;
|
||||
|
||||
if indices.graphics_queue_family_index.can_be_set()
|
||||
&& check_queue_support(queue_family_properties, QueueFlags::GRAPHICS)
|
||||
&& available_queue_count > 0
|
||||
{
|
||||
if query.with_surface.is_none()
|
||||
|| check_presentation_support(
|
||||
physical_device,
|
||||
i as u32,
|
||||
&query.with_surface.as_ref().unwrap(),
|
||||
)
|
||||
{
|
||||
indices.present_queue_family_index = VulkanQueueFamilyStatus::Supported(i as u32);
|
||||
}
|
||||
|
||||
if indices.graphics_queue_family_index.can_be_set()
|
||||
&& check_queue_support(queue_family_properties, QueueFlags::GRAPHICS)
|
||||
{
|
||||
indices.graphics_queue_family_index = VulkanQueueFamilyStatus::Supported(i as u32);
|
||||
available_queue_count -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if indices.compute_queue_family_index.can_be_set()
|
||||
&& check_queue_support(queue_family_properties, QueueFlags::COMPUTE)
|
||||
&& available_queue_count > 0
|
||||
{
|
||||
indices.compute_queue_family_index = VulkanQueueFamilyStatus::Supported(i as u32);
|
||||
available_queue_count -= 1;
|
||||
}
|
||||
|
||||
if indices.transfer_queue_family_index.can_be_set()
|
||||
&& check_queue_support(queue_family_properties, QueueFlags::TRANSFER)
|
||||
&& available_queue_count > 0
|
||||
{
|
||||
indices.transfer_queue_family_index = VulkanQueueFamilyStatus::Supported(i as u32);
|
||||
}
|
||||
|
||||
if !indices.present_queue_family_index.can_be_set()
|
||||
&& !indices.graphics_queue_family_index.can_be_set()
|
||||
if !indices.graphics_queue_family_index.can_be_set()
|
||||
&& !indices.compute_queue_family_index.can_be_set()
|
||||
&& !indices.transfer_queue_family_index.can_be_set()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue