Пример #1
0
        /// <summary>
        /// Creates a new instance of the GPU resource pool.
        /// </summary>
        /// <param name="context">GPU context that the pool belongs to</param>
        /// <param name="physicalMemory">Physical memory where the resource descriptors are mapped</param>
        /// <param name="address">Address of the pool in physical memory</param>
        /// <param name="maximumId">Maximum index of an item on the pool (inclusive)</param>
        public Pool(GpuContext context, PhysicalMemory physicalMemory, ulong address, int maximumId)
        {
            Context        = context;
            PhysicalMemory = physicalMemory;
            MaximumId      = maximumId;

            int count = maximumId + 1;

            ulong size = (ulong)(uint)count * DescriptorSize;

            Items           = new T1[count];
            DescriptorCache = new T2[count];

            Address = address;
            Size    = size;

            _memoryTracking   = physicalMemory.BeginGranularTracking(address, size);
            _modifiedDelegate = RegionModified;
        }