aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs
blob: 7f27124ffde7338c067f06e5cf83d132f6003f37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
    {
        /// <summary>
        /// Count of constant buffer descriptors.
        /// </summary>
        public int CBuffersCount;

        /// <summary>
        /// Count of storage buffer descriptors.
        /// </summary>
        public int SBuffersCount;

        /// <summary>
        /// Count of texture descriptors.
        /// </summary>
        public int TexturesCount;

        /// <summary>
        /// Count of image descriptors.
        /// </summary>
        public int ImagesCount;

        /// <summary>
        /// Set to true if the shader uses instance id.
        /// </summary>
        [MarshalAs(UnmanagedType.I1)]
        public bool UsesInstanceId;

        /// <summary>
        /// Set to true if this entry is in use.
        /// </summary>
        [MarshalAs(UnmanagedType.I1)]
        public bool InUse;

        /// <summary>
        /// Mask of clip distances that are written to on the shader.
        /// </summary>
        public byte ClipDistancesWritten;

        /// <summary>
        /// Reserved / unused.
        /// </summary>
        public byte Reserved;

        /// <summary>
        /// Create a new host shader cache entry header.
        /// </summary>
        /// <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;
        }
    }
}