aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Graphics3d/Texture/LinearSwizzle.cs
blob: e6509baa6a2233f54c96a36bb226db375bf8a591 (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
using System;

namespace Ryujinx.Graphics.Texture
{
    class LinearSwizzle : ISwizzle
    {
        private int Pitch;
        private int Bpp;

        private int SliceSize;

        public LinearSwizzle(int Pitch, int Bpp, int Width, int Height)
        {
            this.Pitch  = Pitch;
            this.Bpp    = Bpp;
            SliceSize   = Width * Height * Bpp;
        }

        public void SetMipLevel(int Level)
        {
            throw new NotImplementedException();
        }

        public int GetMipOffset(int Level)
        {
            if (Level == 1)
                return SliceSize;
            throw new NotImplementedException();
        }

        public int GetImageSize(int MipsCount)
        {
            int Size = GetMipOffset(MipsCount);

            Size = (Size + 0x1fff) & ~0x1fff;

            return Size;
        }

        public int GetSwizzleOffset(int X, int Y, int Z)
        {
            return Z * SliceSize + X * Bpp + Y * Pitch;
        }
    }
}