diff --git a/src/video_core/renderer_vulkan/vk_instance.cpp b/src/video_core/renderer_vulkan/vk_instance.cpp index fb05dae04..21d4dd66c 100644 --- a/src/video_core/renderer_vulkan/vk_instance.cpp +++ b/src/video_core/renderer_vulkan/vk_instance.cpp @@ -398,6 +398,7 @@ bool Instance::CreateDevice() { push_descriptors = AddExtension(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); custom_border_color = AddExtension(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); index_type_uint8 = AddExtension(VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME); + image_format_list = AddExtension(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME); // Search queue families for graphics and present queues auto family_properties = physical_device.getQueueFamilyProperties(); @@ -475,7 +476,7 @@ bool Instance::CreateDevice() { feature_chain.get(), feature_chain.get(), feature_chain.get(), - feature_chain.get(), + feature_chain.get() }; if (!extended_dynamic_state) { @@ -490,14 +491,12 @@ bool Instance::CreateDevice() { device_chain.unlink(); } -#if VK_KHR_portability_subset const vk::StructureChain portability_chain = physical_device.getFeatures2(); const vk::PhysicalDevicePortabilitySubsetFeaturesKHR portability_features = portability_chain.get(); triangle_fan_supported = portability_features.triangleFans; -#endif try { device = physical_device.createDevice(device_chain.get()); diff --git a/src/video_core/renderer_vulkan/vk_instance.h b/src/video_core/renderer_vulkan/vk_instance.h index 635b605f2..0a9609984 100644 --- a/src/video_core/renderer_vulkan/vk_instance.h +++ b/src/video_core/renderer_vulkan/vk_instance.h @@ -130,6 +130,11 @@ public: return index_type_uint8; } + /// Returns true when VK_KHR_image_format_list is supported + bool IsImageFormatListSupported() const { + return image_format_list; + } + /// Returns the vendor ID of the physical device u32 GetVendorID() const { return properties.vendorID; @@ -233,6 +238,7 @@ private: bool push_descriptors{}; bool custom_border_color{}; bool index_type_uint8{}; + bool image_format_list{}; bool enable_validation{}; bool dump_command_buffers{}; }; diff --git a/src/video_core/renderer_vulkan/vk_texture_runtime.cpp b/src/video_core/renderer_vulkan/vk_texture_runtime.cpp index f9c4f7a77..03a9ba429 100644 --- a/src/video_core/renderer_vulkan/vk_texture_runtime.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_runtime.cpp @@ -223,7 +223,15 @@ ImageAlloc TextureRuntime::Allocate(u32 width, u32 height, VideoCore::PixelForma flags |= vk::ImageCreateFlagBits::eMutableFormat; } + const bool need_format_list = create_storage_view && instance.IsImageFormatListSupported(); + const vk::Format storage_format = vk::Format::eR32Uint; + const vk::ImageFormatListCreateInfo image_format_list = { + .viewFormatCount = 1, + .pViewFormats = &storage_format, + }; + const vk::ImageCreateInfo image_info = { + .pNext = need_format_list ? &image_format_list : nullptr, .flags = flags, .imageType = vk::ImageType::e2D, .format = format,