Skip to content
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
14 changes: 11 additions & 3 deletions attachments/05_window_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a bit tricky, but what do you think about

bool supportsGraphicsAndPresent =
    std::ranges::any_of(queueFamilies,
                        [&physicalDevice, &surface = this->surface](auto const &qfp) {
	                        static int qfpIndex = 0;
	                        return physicalDevice.getSurfaceSupportKHR(qfpIndex++, *surface) && (qfp.queueFlags & vk::QueueFlagBits::eGraphics);
                        });


// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -189,7 +197,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/06_swap_chain_creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -197,7 +205,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/07_image_views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -198,7 +206,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/08_graphics_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -199,7 +207,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/09_shader_modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -200,7 +208,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/10_fixed_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -202,7 +210,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/12_graphics_pipeline_complete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -203,7 +211,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/14_command_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -208,7 +216,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/15_hello_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -217,7 +225,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/16_frames_in_flight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -220,7 +228,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/17_swap_chain_recreation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -253,7 +261,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
14 changes: 11 additions & 3 deletions attachments/19_vertex_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,17 @@ class HelloTriangleApplication
// Check if the physicalDevice supports the Vulkan 1.3 API version
bool supportsVulkan1_3 = physicalDevice.getProperties().apiVersion >= VK_API_VERSION_1_3;

// Check if any of the queue families support graphics operations
// Check if any of the queue families support both graphics and presentation to our surface
auto queueFamilies = physicalDevice.getQueueFamilyProperties();
bool supportsGraphics = std::ranges::any_of(queueFamilies, [](auto const &qfp) { return !!(qfp.queueFlags & vk::QueueFlagBits::eGraphics); });
bool supportsGraphicsAndPresent = false;
for (uint32_t qfpIndex = 0; qfpIndex < queueFamilies.size(); qfpIndex++)
{
if ((queueFamilies[qfpIndex].queueFlags & vk::QueueFlagBits::eGraphics) && physicalDevice.getSurfaceSupportKHR(qfpIndex, *surface))
{
supportsGraphicsAndPresent = true;
break;
}
}

// Check if all required physicalDevice extensions are available
auto availableDeviceExtensions = physicalDevice.enumerateDeviceExtensionProperties();
Expand All @@ -281,7 +289,7 @@ class HelloTriangleApplication
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;

// Return true if the physicalDevice meets all the criteria
return supportsVulkan1_3 && supportsGraphics && supportsAllRequiredExtensions && supportsRequiredFeatures;
return supportsVulkan1_3 && supportsGraphicsAndPresent && supportsAllRequiredExtensions && supportsRequiredFeatures;
}

void pickPhysicalDevice()
Expand Down
Loading
Loading