Ejemplo n.º 1
0
        public void VerifyParametersSetData <T>(int mipLevel, T[] source, int sourceStartIndex = 0) where T : struct
        {
            VerifyNotDisposed();
            int num  = Utilities.SizeOf <T>();
            int size = ColorFormat.GetSize();
            int num2 = MathUtils.Max(Width >> mipLevel, 1);
            int num3 = MathUtils.Max(Height >> mipLevel, 1);
            int num4 = size * num2 * num3;

            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (mipLevel < 0 || mipLevel >= MipLevelsCount)
            {
                throw new ArgumentOutOfRangeException("mipLevel");
            }
            if (num > size)
            {
                throw new ArgumentNullException("Source array element size is larger than pixel size.");
            }
            if (size % num != 0)
            {
                throw new ArgumentNullException("Pixel size is not an integer multiple of source array element size.");
            }
            if (sourceStartIndex < 0 || (source.Length - sourceStartIndex) * num < num4)
            {
                throw new InvalidOperationException("Not enough data in source array.");
            }
        }
Ejemplo n.º 2
0
        public override int GetGpuMemoryUsage()
        {
            int num = 0;

            for (int i = 0; i < MipLevelsCount; i++)
            {
                int num2 = MathUtils.Max(Width >> i, 1);
                int num3 = MathUtils.Max(Height >> i, 1);
                num += ColorFormat.GetSize() * num2 * num3;
            }
            return(num);
        }