From 9a212e37b673b319b687ac6aa57980a3ab840c83 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Mon, 2 Feb 2026 16:35:46 -0300 Subject: [PATCH] [DONOTMERGE] Signed-off-by: Caio Oliveira --- .../renderer_vulkan/vk_texture_cache.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 39a43d5950..b8383fc566 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1255,13 +1255,25 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im switch (dst_view.format) { case PixelFormat::D24_UNORM_S8_UINT: - if (src_view.format == PixelFormat::A8B8G8R8_UNORM - || src_view.format == PixelFormat::B8G8R8A8_UNORM - || src_view.format == PixelFormat::A8B8G8R8_SRGB - || src_view.format == PixelFormat::B8G8R8A8_SRGB) { + // Handle sRGB source formats + if (src_view.format == PixelFormat::A8B8G8R8_SRGB || + src_view.format == PixelFormat::B8G8R8A8_SRGB) { + // Verify format support before conversion + if (device.IsFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT, + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT, + FormatType::Optimal)) { + return blit_image_helper.ConvertABGR8SRGBToD24S8(dst, src_view); + } else { + // Fallback to regular ABGR8 conversion if sRGB not supported + return blit_image_helper.ConvertABGR8ToD24S8(dst, src_view); + } + } + if (src_view.format == PixelFormat::A8B8G8R8_UNORM || + src_view.format == PixelFormat::B8G8R8A8_UNORM) { return blit_image_helper.ConvertABGR8ToD24S8(dst, src_view); } break; + case PixelFormat::A8B8G8R8_UNORM: case PixelFormat::A8B8G8R8_SNORM: case PixelFormat::A8B8G8R8_SINT: