示例#1
0
        /// <summary>
        /// Determine if a buffer-to-texture region covers the entirety of a texture.
        /// </summary>
        /// <param name="tex">Texture to compare</param>
        /// <param name="linear">True if the texture is linear, false if block linear</param>
        /// <param name="bpp">Texture bytes per pixel</param>
        /// <param name="stride">Texture stride</param>
        /// <param name="xCount">Number of pixels to be copied</param>
        /// <param name="yCount">Number of lines to be copied</param>
        /// <returns></returns>
        private static bool IsTextureCopyComplete(DmaTexture tex, bool linear, int bpp, int stride, int xCount, int yCount)
        {
            if (linear)
            {
                // If the stride is negative, the texture has to be flipped, so
                // the fast copy is not trivial, use the slow path.
                if (stride <= 0)
                {
                    return(false);
                }

                int alignWidth = Constants.StrideAlignment / bpp;
                return(tex.RegionX == 0 &&
                       tex.RegionY == 0 &&
                       stride / bpp == BitUtils.AlignUp(xCount, alignWidth));
            }
            else
            {
                int alignWidth = Constants.GobAlignment / bpp;
                return(tex.RegionX == 0 &&
                       tex.RegionY == 0 &&
                       tex.Width == BitUtils.AlignUp(xCount, alignWidth) &&
                       tex.Height == yCount);
            }
        }
示例#2
0
 /// <summary>
 /// Determine if a buffer-to-texture region covers the entirety of a texture.
 /// </summary>
 /// <param name="tex">Texture to compare</param>
 /// <param name="linear">True if the texture is linear, false if block linear</param>
 /// <param name="bpp">Texture bytes per pixel</param>
 /// <param name="stride">Texture stride</param>
 /// <param name="xCount">Number of pixels to be copied</param>
 /// <param name="yCount">Number of lines to be copied</param>
 /// <returns></returns>
 private static bool IsTextureCopyComplete(DmaTexture tex, bool linear, int bpp, int stride, int xCount, int yCount)
 {
     if (linear)
     {
         int alignWidth = Constants.StrideAlignment / bpp;
         return(tex.RegionX == 0 &&
                tex.RegionY == 0 &&
                stride / bpp == BitUtils.AlignUp(xCount, alignWidth));
     }
     else
     {
         int alignWidth = Constants.GobAlignment / bpp;
         return(tex.RegionX == 0 &&
                tex.RegionY == 0 &&
                tex.Width == BitUtils.AlignUp(xCount, alignWidth) &&
                tex.Height == yCount);
     }
 }