diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs index 91cadde3..a990528e 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs @@ -738,7 +738,22 @@ namespace Ryujinx.Graphics.Gpu.Image TexturePool texturePool = _texturePoolCache.FindOrCreate(_channel, poolAddress, maximumId); - return texturePool.GetDescriptor(textureId); + TextureDescriptor descriptor; + + if (texturePool.IsValidId(textureId)) + { + descriptor = texturePool.GetDescriptor(textureId); + } + else + { + // If the ID is not valid, we just return a default descriptor with the most common state. + // Since this is used for shader specialization, doing so might avoid the need for recompilations. + descriptor = new TextureDescriptor(); + descriptor.Word4 |= (uint)TextureTarget.Texture2D << 23; + descriptor.Word5 |= 1u << 31; // Coords normalized. + } + + return descriptor; } /// <summary> |