Example #1
0
        private unsafe static byte[] Read16Bpt4x4(AMemory Memory, Texture Texture)
        {
            int Width  = (Texture.Width + 3) / 4;
            int Height = (Texture.Height + 3) / 4;

            byte[] Output = new byte[Width * Height * 16];

            ISwizzle Swizzle = GetSwizzle(Texture, 16);

            fixed(byte *BuffPtr = Output)
            {
                long OutOffs = 0;

                for (int Y = 0; Y < Height; Y++)
                {
                    for (int X = 0; X < Width; X++)
                    {
                        long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);

                        long Tile0 = Memory.ReadInt64Unchecked(Texture.Position + Offset + 0);
                        long Tile1 = Memory.ReadInt64Unchecked(Texture.Position + Offset + 8);

                        *(long *)(BuffPtr + OutOffs + 0) = Tile0;
                        *(long *)(BuffPtr + OutOffs + 8) = Tile1;

                        OutOffs += 16;
                    }
                }
            }

            return(Output);
        }