[Gpu] Materialize every fixed DCC clear code on a sampled image

A DCC fast clear stays pending until the surface binds as a colour target;
when a shader samples the surface first, only the clear-to-zero code was
materialized. The other fixed codes (alpha 1, rgb 1, rgba 1) carry their
own colour too. Silent Hill fast-clears UE's separate-translucency target
to (0,0,0,1) and only samples it, so the post composite read stale zeros
and the whole title-menu scene came out black.
This commit is contained in:
kuba 2026-10-03 23:08:41 +02:00
parent ecf019f23b
commit c52d31d73b
1 changed files with 6 additions and 1 deletions

View File

@ -585,8 +585,13 @@ internal static unsafe partial class VulkanVideoPresenter
var view = binding.Request.View;
for (var layer = view.BaseLayer; layer < view.BaseLayer + view.LayerCount; layer++)
{
var tracked = _imageCache.IsMetadataCleared(metadataAddress, layer, out var metadataValue) && (byte)metadataValue == DccClearToZero;
// Every fixed clear code carries its own colour; only the register code (0x20) needs
// the CB clear word, which is known when the surface binds as a target. Silent Hill
// fast-clears UE's separate-translucency target to (0,0,0,1) and only samples it:
// skipping that clear left stale zeros that blacked out the whole title-menu scene.
var clearValue = default(ClearColorValue);
var tracked = _imageCache.IsMetadataCleared(metadataAddress, layer, out var metadataValue) &&
TryDecodeDccClear((byte)metadataValue, false, (byte)metadataValue == DccClearToZero || fixedClearSupported, default, out clearValue);
ulong guestSlice = 0;
if (!tracked &&
(sliceSize == 0 || !_imageCache.TryReadGuestDccClear(metadataAddress, sliceSize, layer, out guestSlice, out var code) ||