Example #1
0
        /// <summary>Initializes a new instance of the <see cref="GraphicsMemoryBlock" /> class.</summary>
        /// <param name="device">The device for which the memory block is being created</param>
        /// <param name="collection">The memory block collection which contains the block.</param>
        /// <exception cref="ArgumentNullException"><paramref name="device" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="collection" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="collection" /> was not created for <paramref name="device" />.</exception>
        protected GraphicsMemoryBlock(GraphicsDevice device, GraphicsMemoryBlockCollection collection)
            : base(device)
        {
            ThrowIfNull(collection, nameof(collection));

            if (collection.Device != device)
            {
                ThrowForInvalidParent(collection.Device, nameof(collection));
            }

            _collection = collection;
        }
Example #2
0
 /// <summary>Initializes a new instance of the <see cref="GraphicsMemoryBlock{TMetadata}" /> class.</summary>
 /// <param name="collection">The block collection which contains the memory block.</param>
 /// <param name="size">The size of the memory block, in bytes.</param>
 /// <param name="marginSize">The minimum size of free regions to keep on either side of an allocated region, in bytes.</param>
 /// <param name="minimumFreeRegionSizeToRegister">The minimum size of a free region for it to be registered as available, in bytes.</param>
 /// <exception cref="ArgumentNullException"><paramref name="collection" /> is <c>null</c>.</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="size" /> is zero.</exception>
 protected GraphicsMemoryBlock(GraphicsMemoryBlockCollection collection, ulong size, ulong marginSize, ulong minimumFreeRegionSizeToRegister)
     : base(collection)
 {
     _metadata = new TMetadata();
     _metadata.Initialize(this, size, marginSize, minimumFreeRegionSizeToRegister);
 }
Example #3
0
 /// <summary>Initializes a new instance of the <see cref="GraphicsMemoryBlock" /> class.</summary>
 /// <param name="collection">The block collection which contains the memory block.</param>
 /// <exception cref="ArgumentNullException"><paramref name="collection" /> is <c>null</c>.</exception>
 internal GraphicsMemoryBlock(GraphicsMemoryBlockCollection collection)
 {
     ThrowIfNull(collection, nameof(collection));
     _collection = collection;
 }