Suppress Invalid-texture-format log spam from uninitialized pool slots

UpdateFromPool iterates the full texture pool (sized by the guest's
MaximumId), which can exceed the slot range the guest has actually
populated. The trailing slots hold whatever was in guest memory at
allocation time; for pools filled with a poison byte (e.g. 0x5A) every
descriptor word is identical, the format lookup misses, and the existing
error log fires once per slot.

Skip the log when all eight descriptor words are bitwise equal. No real
descriptor has that shape, so this is a structural uninitialized-memory
test rather than a behaviour change; the lookup still falls back to
FormatInfo.Default as before.
This commit is contained in:
Jakob Linke 2026-05-22 15:57:12 +02:00
parent e2952ee6db
commit ada52eb61c

View file

@ -529,6 +529,19 @@ namespace Ryujinx.Graphics.Gpu.Image
}
}
private static bool IsUninitializedDescriptor(in TextureDescriptor descriptor)
{
uint w = descriptor.Word0;
return descriptor.Word1 == w
&& descriptor.Word2 == w
&& descriptor.Word3 == w
&& descriptor.Word4 == w
&& descriptor.Word5 == w
&& descriptor.Word6 == w
&& descriptor.Word7 == w;
}
/// <summary>
/// Gets texture information from a texture descriptor.
/// </summary>
@ -586,7 +599,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (!FormatTable.TryGetTextureFormat(format, srgb, out FormatInfo formatInfo))
{
if (gpuVa != 0 && format != 0)
if (gpuVa != 0 && format != 0 && !IsUninitializedDescriptor(descriptor))
{
Logger.Error?.Print(LogClass.Gpu, $"Invalid texture format 0x{format:X} (sRGB: {srgb}).");
}