aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Translation/IoUsage.cs
blob: 8ce2da4a031259b7e9ed5c04e0bccc2936398822 (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
namespace Ryujinx.Graphics.Shader.Translation
{
    readonly struct IoUsage
    {
        private readonly FeatureFlags _usedFeatures;

        public readonly bool UsesRtLayer => _usedFeatures.HasFlag(FeatureFlags.RtLayer);
        public readonly bool UsesViewportIndex => _usedFeatures.HasFlag(FeatureFlags.ViewportIndex);
        public readonly bool UsesViewportMask => _usedFeatures.HasFlag(FeatureFlags.ViewportMask);
        public readonly byte ClipDistancesWritten { get; }
        public readonly int UserDefinedMap { get; }

        public IoUsage(FeatureFlags usedFeatures, byte clipDistancesWritten, int userDefinedMap)
        {
            _usedFeatures = usedFeatures;
            ClipDistancesWritten = clipDistancesWritten;
            UserDefinedMap = userDefinedMap;
        }

        public readonly IoUsage Combine(IoUsage other)
        {
            return new IoUsage(
                _usedFeatures | other._usedFeatures,
                (byte)(ClipDistancesWritten | other.ClipDistancesWritten),
                UserDefinedMap | other.UserDefinedMap);
        }
    }
}