From bdb235716a07bd9f45a894e567b038b2ce6477f3 Mon Sep 17 00:00:00 2001 From: psucien Date: Sat, 15 Jun 2024 10:21:07 +0200 Subject: [PATCH] texture_cache: don't set color attachment usage flag for packed images --- src/video_core/texture_cache/image.cpp | 13 ++++++++++++- src/video_core/texture_cache/image.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/video_core/texture_cache/image.cpp b/src/video_core/texture_cache/image.cpp index b464f3d7..727e89e4 100644 --- a/src/video_core/texture_cache/image.cpp +++ b/src/video_core/texture_cache/image.cpp @@ -57,6 +57,17 @@ bool ImageInfo::IsBlockCoded() const { } } +bool ImageInfo::IsPacked() const { + switch (pixel_format) { + case vk::Format::eB5G5R5A1UnormPack16: + [[fallthrough]]; + case vk::Format::eB5G6R5UnormPack16: + return true; + default: + return false; + } +} + bool ImageInfo::IsDepthStencil() const { switch (pixel_format) { case vk::Format::eD16Unorm: @@ -76,7 +87,7 @@ static vk::ImageUsageFlags ImageUsageFlags(const ImageInfo& info) { if (info.IsDepthStencil()) { usage |= vk::ImageUsageFlagBits::eDepthStencilAttachment; } else { - if (!info.IsBlockCoded()) { + if (!info.IsBlockCoded() && !info.IsPacked()) { usage |= vk::ImageUsageFlagBits::eColorAttachment; } } diff --git a/src/video_core/texture_cache/image.h b/src/video_core/texture_cache/image.h index 1b577046..5ba68726 100644 --- a/src/video_core/texture_cache/image.h +++ b/src/video_core/texture_cache/image.h @@ -43,6 +43,7 @@ struct ImageInfo { explicit ImageInfo(const AmdGpu::Image& image) noexcept; bool IsBlockCoded() const; + bool IsPacked() const; bool IsDepthStencil() const; bool is_tiled = false;