diff options
author | GPUCode <geoster3d@gmail.com> | 2023-09-21 20:17:30 +0200 |
---|---|---|
committer | GPUCode <geoster3d@gmail.com> | 2023-09-21 20:46:35 +0200 |
commit | b6ad7e263bd922142df73e77d78a4abde5a71cc8 (patch) | |
tree | be9c97d33b26dd3fcb506d97c66394657baee3b2 /src/video_core/renderer_vulkan/vk_texture_cache.cpp | |
parent | Merge pull request #11542 from t895/touch-offset-fix (diff) | |
download | yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.tar yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.tar.gz yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.tar.bz2 yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.tar.lz yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.tar.xz yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.tar.zst yuzu-b6ad7e263bd922142df73e77d78a4abde5a71cc8.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_texture_cache.cpp')
-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 b3e17c332..d935dd43e 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) { return usage; } -/// Returns the preferred format for a VkImage -[[nodiscard]] PixelFormat StorageFormat(PixelFormat format) { - switch (format) { - case PixelFormat::A8B8G8R8_SRGB: - return PixelFormat::A8B8G8R8_UNORM; - default: - return format; - } -} - [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) { - const PixelFormat format = StorageFormat(info.format); - const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); + const auto format_info = + MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, info.format); VkImageCreateFlags flags{}; if (info.type == ImageType::e2D && info.resources.layers >= 6 && info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { @@ -157,7 +147,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { .arrayLayers = static_cast<u32>(info.resources.layers), .samples = ConvertSampleCount(info.num_samples), .tiling = VK_IMAGE_TILING_OPTIMAL, - .usage = ImageUsageFlags(format_info, format), + .usage = ImageUsageFlags(format_info, info.format), .sharingMode = VK_SHARING_MODE_EXCLUSIVE, .queueFamilyIndexCount = 0, .pQueueFamilyIndices = nullptr, @@ -1626,8 +1616,8 @@ bool Image::NeedsScaleHelper() const { return true; } static constexpr auto OPTIMAL_FORMAT = FormatType::Optimal; - const PixelFormat format = StorageFormat(info.format); - const auto vk_format = MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, format).format; + const auto vk_format = + MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, info.format).format; const auto blit_usage = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; const bool needs_blit_helper = !device.IsFormatSupported(vk_format, blit_usage, OPTIMAL_FORMAT); return needs_blit_helper; |