From eaa92b5a655a504d6899ae028966185853e75bfd Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:05:16 -0700 Subject: [PATCH] vulkan: Upgrade format queries to use format feature flags 2. (#941) --- .../renderer_vulkan/vk_instance.cpp | 19 ++++++++++++------- src/video_core/renderer_vulkan/vk_instance.h | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_instance.cpp b/src/video_core/renderer_vulkan/vk_instance.cpp index d88d4329..0ea814e1 100644 --- a/src/video_core/renderer_vulkan/vk_instance.cpp +++ b/src/video_core/renderer_vulkan/vk_instance.cpp @@ -33,11 +33,16 @@ std::vector GetSupportedExtensions(vk::PhysicalDevice physical) { return supported_extensions; } -std::unordered_map GetFormatProperties( +std::unordered_map GetFormatProperties( vk::PhysicalDevice physical) { - std::unordered_map format_properties; + std::unordered_map format_properties; for (const auto& format : LiverpoolToVK::GetAllFormats()) { - format_properties.emplace(format, physical.getFormatProperties(format)); + vk::FormatProperties3 properties3{}; + vk::FormatProperties2 properties2 = { + .pNext = &properties3, + }; + physical.getFormatProperties2(format, &properties2); + format_properties.emplace(format, properties3); } return format_properties; } @@ -496,9 +501,9 @@ bool Instance::IsImageFormatSupported(const vk::Format format) const { UNIMPLEMENTED_MSG("Properties of format {} have not been queried.", vk::to_string(format)); } - constexpr vk::FormatFeatureFlags optimal_flags = vk::FormatFeatureFlagBits::eTransferSrc | - vk::FormatFeatureFlagBits::eTransferDst | - vk::FormatFeatureFlagBits::eSampledImage; + constexpr vk::FormatFeatureFlags2 optimal_flags = vk::FormatFeatureFlagBits2::eTransferSrc | + vk::FormatFeatureFlagBits2::eTransferDst | + vk::FormatFeatureFlagBits2::eSampledImage; return (it->second.optimalTilingFeatures & optimal_flags) == optimal_flags; } @@ -512,7 +517,7 @@ bool Instance::IsVertexFormatSupported(const vk::Format format) const { UNIMPLEMENTED_MSG("Properties of format {} have not been queried.", vk::to_string(format)); } - constexpr vk::FormatFeatureFlags optimal_flags = vk::FormatFeatureFlagBits::eVertexBuffer; + constexpr vk::FormatFeatureFlags2 optimal_flags = vk::FormatFeatureFlagBits2::eVertexBuffer; return (it->second.bufferFeatures & optimal_flags) == optimal_flags; } diff --git a/src/video_core/renderer_vulkan/vk_instance.h b/src/video_core/renderer_vulkan/vk_instance.h index 61687ac2..3b354bab 100644 --- a/src/video_core/renderer_vulkan/vk_instance.h +++ b/src/video_core/renderer_vulkan/vk_instance.h @@ -264,7 +264,7 @@ private: vk::Queue graphics_queue; std::vector physical_devices; std::vector available_extensions; - std::unordered_map format_properties; + std::unordered_map format_properties; TracyVkCtx profiler_context{}; u32 queue_family_index{0}; bool image_view_reinterpretation{true};