using System.Runtime.InteropServices;
using Ryujinx.Graphics.Shader;
namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
{
/// <summary>
/// Host shader entry header used for binding information.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x14)]
struct HostShaderCacheEntryHeader
/// Count of constant buffer descriptors.
public int CBuffersCount;
/// Count of storage buffer descriptors.
public int SBuffersCount;
/// Count of texture descriptors.
public int TexturesCount;
/// Count of image descriptors.
public int ImagesCount;
/// Set to true if the shader uses instance id.
[MarshalAs(UnmanagedType.I1)]
public bool UsesInstanceId;
/// Set to true if this entry is in use.
public bool InUse;
/// Mask of clip distances that are written to on the shader.
public byte ClipDistancesWritten;
/// Reserved / unused.
public byte Reserved;
/// Create a new host shader cache entry header.
/// <param name="cBuffersCount">Count of constant buffer descriptors</param>
/// <param name="sBuffersCount">Count of storage buffer descriptors</param>
/// <param name="texturesCount">Count of texture descriptors</param>
/// <param name="imagesCount">Count of image descriptors</param>
/// <param name="usesInstanceId">Set to true if the shader uses instance id</param>
public HostShaderCacheEntryHeader(
int cBuffersCount,
int sBuffersCount,
int texturesCount,
int imagesCount,
bool usesInstanceId,
byte clipDistancesWritten) : this()
CBuffersCount = cBuffersCount;
SBuffersCount = sBuffersCount;
TexturesCount = texturesCount;
ImagesCount = imagesCount;
UsesInstanceId = usesInstanceId;
ClipDistancesWritten = clipDistancesWritten;
InUse = true;
}