示例#1
0
        public BlockLinearLayout(
            int width,
            int height,
            int depth,
            int gobBlocksInY,
            int gobBlocksInZ,
            int bpp)
        {
            _texBpp = bpp;

            _bppShift = BitUtils.CountTrailingZeros32(bpp);

            _bhMask = gobBlocksInY - 1;
            _bdMask = gobBlocksInZ - 1;

            _bhShift = BitUtils.CountTrailingZeros32(gobBlocksInY);
            _bdShift = BitUtils.CountTrailingZeros32(gobBlocksInZ);

            _xShift = BitUtils.CountTrailingZeros32(GobSize * gobBlocksInY * gobBlocksInZ);

            RobAndSliceSizes rsSizes = GetRobAndSliceSizes(width, height, gobBlocksInY, gobBlocksInZ);

            _robSize   = rsSizes.RobSize;
            _sliceSize = rsSizes.SliceSize;
        }
示例#2
0
        public BlockLinearSwizzle(
            int width,
            int height,
            int depth,
            int gobBlockHeight,
            int gobBlockDepth,
            int bpp)
        {
            _texWidth          = width;
            _texHeight         = height;
            _texDepth          = depth;
            _texGobBlockHeight = gobBlockHeight;
            _texGobBlockDepth  = gobBlockDepth;
            _texBpp            = bpp;

            _bppShift = BitUtils.CountTrailingZeros32(bpp);

            SetMipLevel(0);
        }
示例#3
0
        public void SetMipLevel(int level)
        {
            _baseOffset = GetMipOffset(level);

            int width  = Math.Max(1, _texWidth >> level);
            int height = Math.Max(1, _texHeight >> level);
            int depth  = Math.Max(1, _texDepth >> level);

            GobBlockSizes gbSizes = AdjustGobBlockSizes(height, depth);

            _bhMask = gbSizes.Height - 1;
            _bdMask = gbSizes.Depth - 1;

            _bhShift = BitUtils.CountTrailingZeros32(gbSizes.Height);
            _bdShift = BitUtils.CountTrailingZeros32(gbSizes.Depth);

            _xShift = BitUtils.CountTrailingZeros32(GobSize * gbSizes.Height * gbSizes.Depth);

            RobAndSliceSizes gsSizes = GetRobAndSliceSizes(width, height, gbSizes);

            _robSize   = gsSizes.RobSize;
            _sliceSize = gsSizes.SliceSize;
        }