mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 15:24:34 +00:00
Compare against feature flags
This commit is contained in:
parent
8d4ac0db50
commit
617123254a
@ -1606,7 +1606,7 @@ Result<SurfaceSupportDetails> query_surface_support_details(VkPhysicalDevice phy
|
|||||||
VkSurfaceFormatKHR find_surface_format(VkPhysicalDevice phys_device,
|
VkSurfaceFormatKHR find_surface_format(VkPhysicalDevice phys_device,
|
||||||
std::vector<VkSurfaceFormatKHR> const& available_formats,
|
std::vector<VkSurfaceFormatKHR> const& available_formats,
|
||||||
std::vector<VkSurfaceFormatKHR> const& desired_formats,
|
std::vector<VkSurfaceFormatKHR> const& desired_formats,
|
||||||
VkImageUsageFlags usage_flags) {
|
VkFormatFeatureFlags feature_flags) {
|
||||||
for (auto const& desired_format : desired_formats) {
|
for (auto const& desired_format : desired_formats) {
|
||||||
for (auto const& available_format : available_formats) {
|
for (auto const& available_format : available_formats) {
|
||||||
// finds the first format that is desired and available
|
// finds the first format that is desired and available
|
||||||
@ -1615,7 +1615,7 @@ VkSurfaceFormatKHR find_surface_format(VkPhysicalDevice phys_device,
|
|||||||
VkFormatProperties properties;
|
VkFormatProperties properties;
|
||||||
detail::vulkan_functions().fp_vkGetPhysicalDeviceFormatProperties(
|
detail::vulkan_functions().fp_vkGetPhysicalDeviceFormatProperties(
|
||||||
phys_device, desired_format.format, &properties);
|
phys_device, desired_format.format, &properties);
|
||||||
if ((properties.optimalTilingFeatures & usage_flags) == usage_flags)
|
if ((properties.optimalTilingFeatures & feature_flags) == feature_flags)
|
||||||
return desired_format;
|
return desired_format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1891,6 +1891,18 @@ SwapchainBuilder& SwapchainBuilder::use_default_image_usage_flags() {
|
|||||||
info.image_usage_flags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
info.image_usage_flags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
SwapchainBuilder& SwapchainBuilder::set_format_feature_flags(VkFormatFeatureFlags feature_flags) {
|
||||||
|
info.format_feature_flags = feature_flags;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
SwapchainBuilder& SwapchainBuilder::add_format_feature_flags(VkFormatFeatureFlags feature_flags) {
|
||||||
|
info.format_feature_flags = info.format_feature_flags | feature_flags;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
SwapchainBuilder& SwapchainBuilder::use_default_format_feature_flags() {
|
||||||
|
info.format_feature_flags = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
SwapchainBuilder& SwapchainBuilder::set_image_array_layer_count(uint32_t array_layer_count) {
|
SwapchainBuilder& SwapchainBuilder::set_image_array_layer_count(uint32_t array_layer_count) {
|
||||||
info.array_layer_count = array_layer_count;
|
info.array_layer_count = array_layer_count;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -634,6 +634,14 @@ class SwapchainBuilder {
|
|||||||
// are provided. The default is VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
|
// are provided. The default is VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
|
||||||
SwapchainBuilder& use_default_image_usage_flags();
|
SwapchainBuilder& use_default_image_usage_flags();
|
||||||
|
|
||||||
|
// Set the bitmask of the format feature flag for acquired swapchain images.
|
||||||
|
SwapchainBuilder& set_format_feature_flags(VkFormatFeatureFlags feature_flags);
|
||||||
|
// Add a format feature to the bitmask for acquired swapchain images.
|
||||||
|
SwapchainBuilder& add_format_feature_flags(VkFormatFeatureFlags feature_flags);
|
||||||
|
// Use the default format feature bitmask values. This is the default if no format features
|
||||||
|
// are provided. The default is VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|
||||||
|
SwapchainBuilder& use_default_format_feature_flags();
|
||||||
|
|
||||||
// Set the number of views in for multiview/stereo surface
|
// Set the number of views in for multiview/stereo surface
|
||||||
SwapchainBuilder& set_image_array_layer_count(uint32_t array_layer_count);
|
SwapchainBuilder& set_image_array_layer_count(uint32_t array_layer_count);
|
||||||
|
|
||||||
@ -676,6 +684,7 @@ class SwapchainBuilder {
|
|||||||
uint32_t desired_height = 256;
|
uint32_t desired_height = 256;
|
||||||
uint32_t array_layer_count = 1;
|
uint32_t array_layer_count = 1;
|
||||||
VkImageUsageFlags image_usage_flags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
VkImageUsageFlags image_usage_flags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
|
VkFormatFeatureFlags format_feature_flags = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
|
||||||
uint32_t graphics_queue_index = 0;
|
uint32_t graphics_queue_index = 0;
|
||||||
uint32_t present_queue_index = 0;
|
uint32_t present_queue_index = 0;
|
||||||
VkSurfaceTransformFlagBitsKHR pre_transform = static_cast<VkSurfaceTransformFlagBitsKHR>(0);
|
VkSurfaceTransformFlagBitsKHR pre_transform = static_cast<VkSurfaceTransformFlagBitsKHR>(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user