コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonTextureLockData"/> class.
        /// </summary>
        /// <param name="graphics">The graphics context that owns this lock.</param>
        /// <param name="texture">The texture that owns this lock.</param>
        /// <param name="cache">Lock cache that will contain this lock.</param>
        /// <param name="data">The data returned from the lock.</param>
        /// <param name="mipLevel">The mip level of the sub resource.</param>
        /// <param name="arrayIndex">Array index of the sub resource.</param>
        internal GorgonTextureLockData(GorgonGraphics graphics, GorgonTexture texture, GorgonTextureLockCache cache, DX.DataBox data, int mipLevel, int arrayIndex)
            : base(mipLevel, arrayIndex, 0)
        {
            Graphics = graphics;
            Texture  = texture;
            _cache   = cache;

            Width  = Texture.Settings.Width;
            Height = Texture.Settings.Height;
            Depth  = Texture.Settings.Depth;

            // Calculate the current size at the given mip level.
            for (int mip = 0; mip < mipLevel; ++mip)
            {
                if (Width > 1)
                {
                    Width >>= 1;
                }
                if (Height > 1)
                {
                    Height >>= 1;
                }
                if (Depth > 1)
                {
                    Depth >>= 1;
                }
            }

            PitchInformation = new GorgonFormatPitch(data.RowPitch, data.SlicePitch);
            Data             = new GorgonDataStream(data.DataPointer.ToPointer(), data.SlicePitch);
        }
コード例 #2
0
ファイル: GorgonImageBuffer.cs プロジェクト: tmp7701/Gorgon
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonImageBuffer" /> class.
 /// </summary>
 /// <param name="dataStart">The data start.</param>
 /// <param name="pitchInfo">The pitch info.</param>
 /// <param name="mipLevel">Mip map level.</param>
 /// <param name="arrayIndex">Array index.</param>
 /// <param name="sliceIndex">Slice index.</param>
 /// <param name="width">The width for the buffer.</param>
 /// <param name="height">The height for the buffer.</param>
 /// <param name="depth">The depth for the buffer.</param>
 /// <param name="format">Format of the buffer.</param>
 internal unsafe GorgonImageBuffer(void *dataStart, GorgonFormatPitch pitchInfo, int mipLevel, int arrayIndex, int sliceIndex, int width, int height, int depth, BufferFormat format)
 {
     Data             = new GorgonDataStream(dataStart, pitchInfo.SlicePitch);
     PitchInformation = pitchInfo;
     MipLevel         = mipLevel;
     ArrayIndex       = arrayIndex;
     SliceIndex       = sliceIndex;
     Width            = width;
     Height           = height;
     Depth            = depth;
     Format           = format;
 }