Vulkan: Look up multisampled framebuffers through a CLUT by their first sample

With MSAA, a framebuffer textured as CLUT indices was read resolved, so the
indices along edges were averages of the samples and looked up wrong colors.
Dragon Ball Z: Tenkaichi Tag Team draws its outlines from a CLUT32 lookup of
its framebuffer, and they came out noisy and miscolored. Copy each pixel's
first sample with texelFetch into a temporary buffer and look up that.

This needs the multisampled color images to be sampled, and transitioned
back to attachment layout before rendering to them again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-09 15:49:15 +02:00
1 parent 70c5b8f07f
commit 4202368b1e
14 files changed
+122 -8

No files matched your search

+2 -1
View File
@@ -178,7 +178,8 @@ void VKRFramebuffer::CreateImage(VulkanContext *vulkan, VulkanBarrierBatch *barr
ici.tiling = VK_IMAGE_TILING_OPTIMAL;
ici.format = format;
ici.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
if (sampleCount == VK_SAMPLE_COUNT_1_BIT) {
// Multisampled color is sampled too, to read single samples where averaging them would be wrong.
if (sampleCount == VK_SAMPLE_COUNT_1_BIT || color) {
ici.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
if (color) {