Ryujinx/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/GuestShaderCacheEntryHeader.cs
gdkchan d9d18439f6
Use a new approach for shader BRX targets (#2532)
* Use a new approach for shader BRX targets

* Make shader cache actually work

* Improve the shader pattern matching a bit

* Extend LDC search to predecessor blocks, catches more cases

* Nit

* Only save the amount of constant buffer data actually used. Avoids crashes on partially mapped buffers

* Ignore Rd on predicate instructions, as they do not have a Rd register (catches more cases)
2021-08-11 20:59:42 +02:00

69 lines
2.1 KiB
C#

using Ryujinx.Graphics.Shader;
using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
{
/// <summary>
/// The header of a guest shader entry in a guest shader program.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 0x1, Size = 0x30)]
struct GuestShaderCacheEntryHeader
{
/// <summary>
/// The stage of this shader.
/// </summary>
public ShaderStage Stage;
/// <summary>
/// Unused/reserved.
/// </summary>
public byte Reserved1;
/// <summary>
/// Unused/reserved.
/// </summary>
public byte Reserved2;
/// <summary>
/// Unused/reserved.
/// </summary>
public byte Reserved3;
/// <summary>
/// The size of the code section.
/// </summary>
public int Size;
/// <summary>
/// The size of the code2 section if present. (Vertex A)
/// </summary>
public int SizeA;
/// <summary>
/// Constant buffer 1 data size.
/// </summary>
public int Cb1DataSize;
/// <summary>
/// The header of the cached gpu accessor.
/// </summary>
public GuestGpuAccessorHeader GpuAccessorHeader;
/// <summary>
/// Create a new guest shader entry header.
/// </summary>
/// <param name="stage">The stage of this shader</param>
/// <param name="size">The size of the code section</param>
/// <param name="sizeA">The size of the code2 section if present (Vertex A)</param>
/// <param name="cb1DataSize">Constant buffer 1 data size</param>
/// <param name="gpuAccessorHeader">The header of the cached gpu accessor</param>
public GuestShaderCacheEntryHeader(ShaderStage stage, int size, int sizeA, int cb1DataSize, GuestGpuAccessorHeader gpuAccessorHeader) : this()
{
Stage = stage;
Size = size;
SizeA = sizeA;
Cb1DataSize = cb1DataSize;
GpuAccessorHeader = gpuAccessorHeader;
}
}
}