diff options
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index f25842476..1f9e7acaa 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -120,19 +120,9 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | |||
| 120 | return usage; | 120 | return usage; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | /// Returns the preferred format for a VkImage | ||
| 124 | [[nodiscard]] PixelFormat StorageFormat(PixelFormat format) { | ||
| 125 | switch (format) { | ||
| 126 | case PixelFormat::A8B8G8R8_SRGB: | ||
| 127 | return PixelFormat::A8B8G8R8_UNORM; | ||
| 128 | default: | ||
| 129 | return format; | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) { | 123 | [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) { |
| 134 | const PixelFormat format = StorageFormat(info.format); | 124 | const auto format_info = |
| 135 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); | 125 | MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, info.format); |
| 136 | VkImageCreateFlags flags{}; | 126 | VkImageCreateFlags flags{}; |
| 137 | if (info.type == ImageType::e2D && info.resources.layers >= 6 && | 127 | if (info.type == ImageType::e2D && info.resources.layers >= 6 && |
| 138 | info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { | 128 | info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { |
| @@ -157,7 +147,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | |||
| 157 | .arrayLayers = static_cast<u32>(info.resources.layers), | 147 | .arrayLayers = static_cast<u32>(info.resources.layers), |
| 158 | .samples = ConvertSampleCount(info.num_samples), | 148 | .samples = ConvertSampleCount(info.num_samples), |
| 159 | .tiling = VK_IMAGE_TILING_OPTIMAL, | 149 | .tiling = VK_IMAGE_TILING_OPTIMAL, |
| 160 | .usage = ImageUsageFlags(format_info, format), | 150 | .usage = ImageUsageFlags(format_info, info.format), |
| 161 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, | 151 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, |
| 162 | .queueFamilyIndexCount = 0, | 152 | .queueFamilyIndexCount = 0, |
| 163 | .pQueueFamilyIndices = nullptr, | 153 | .pQueueFamilyIndices = nullptr, |
| @@ -1643,8 +1633,8 @@ bool Image::NeedsScaleHelper() const { | |||
| 1643 | return true; | 1633 | return true; |
| 1644 | } | 1634 | } |
| 1645 | static constexpr auto OPTIMAL_FORMAT = FormatType::Optimal; | 1635 | static constexpr auto OPTIMAL_FORMAT = FormatType::Optimal; |
| 1646 | const PixelFormat format = StorageFormat(info.format); | 1636 | const auto vk_format = |
| 1647 | const auto vk_format = MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, format).format; | 1637 | MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, info.format).format; |
| 1648 | const auto blit_usage = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; | 1638 | const auto blit_usage = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; |
| 1649 | const bool needs_blit_helper = !device.IsFormatSupported(vk_format, blit_usage, OPTIMAL_FORMAT); | 1639 | const bool needs_blit_helper = !device.IsFormatSupported(vk_format, blit_usage, OPTIMAL_FORMAT); |
| 1650 | return needs_blit_helper; | 1640 | return needs_blit_helper; |