ryujinx/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/GuestTextureDescriptor.cs
Mary 383c039037
shader cache: Fix invalid virtual address clean up (#1717)
* shader cache: Fix invalid virtual address clean up

This fix an issue causing the virtual address of texture descriptors to
not be cleaned up when caching and instead cleaning texture format and swizzle.

This should fix duplicate high duplication in the cache for certain
games and possible texture corruption issues.

**THIS WILL INVALIDATE ALL SHADER CACHE LEVELS CONSIDERING THE NATURE OF THE ISSUE**

* shader cache: Address gdk's comment
2020-11-17 22:20:17 +01:00

42 lines
1 KiB
C#

using Ryujinx.Graphics.Gpu.Image;
using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
{
/// <summary>
/// Contains part of TextureDescriptor from <see cref="Image"/> used for shader codegen.
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = 0xC, Pack = 1)]
struct GuestTextureDescriptor : ITextureDescriptor
{
public uint Handle;
public uint Format;
public TextureTarget Target;
[MarshalAs(UnmanagedType.I1)]
public bool IsSrgb;
[MarshalAs(UnmanagedType.I1)]
public bool IsTextureCoordNormalized;
public byte Reserved;
public uint UnpackFormat()
{
return Format;
}
public bool UnpackSrgb()
{
return IsSrgb;
}
public bool UnpackTextureCoordNormalized()
{
return IsTextureCoordNormalized;
}
public TextureTarget UnpackTextureTarget()
{
return Target;
}
}
}