public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0, int DepthLevel = 0) { uint blkHeight = STGenericTexture.GetBlockHeight(Format); uint blkDepth = STGenericTexture.GetBlockDepth(Format); uint blockHeight = TegraX1Swizzle.GetBlockHeight(TegraX1Swizzle.DIV_ROUND_UP(Height, blkHeight)); uint BlockHeightLog2 = (uint)Convert.ToString(blockHeight, 2).Length; // if (Format == TEX_FORMAT.ASTC_4x4_UNORM || Format == TEX_FORMAT.ASTC_6x6_UNORM || Format == TEX_FORMAT.BC5_SNORM) if (Format != TEX_FORMAT.ASTC_8x5_UNORM) { BlockHeightLog2 -= 1; } Console.WriteLine("blkHeight " + blkHeight); Console.WriteLine("blockHeight " + blockHeight); Console.WriteLine("BlockHeightLog2 " + BlockHeightLog2); return(TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, DepthLevel, BlockHeightLog2, 1)); }
public byte[] DecodeImage(STGenericTexture texture, byte[] data, uint width, uint height, int array, int mip) { if (data.Length == 0) { throw new Exception("Data is empty! Failed to swizzle image!"); } if (BlockHeightLog2 == 0) { uint blkHeight = TextureFormatHelper.GetBlockHeight(OutputFormat); uint blockHeight = TegraX1Swizzle.GetBlockHeight(TegraX1Swizzle.DIV_ROUND_UP(texture.Height, blkHeight)); BlockHeightLog2 = (uint)Convert.ToString(blockHeight, 2).Length; if (OutputFormat != TexFormat.ASTC_8x5_UNORM) { BlockHeightLog2 -= 1; } } return(TegraX1Swizzle.GetImageData(texture, data, array, mip, 0, BlockHeightLog2, Target, LinearMode)); }