aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/GuestTextureDescriptor.cs
blob: 9491496d63d5b7754d4af6ddb6e7d82bc0d37e05 (plain) (blame)
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
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;
        }
    }
}