Ejemplo n.º 1
0
        public IMgThreadPartition CreatePartition(MgCommandPoolCreateFlagBits flags, MgDescriptorPoolCreateInfo descPoolCreateInfo)
        {
            if (descPoolCreateInfo == null)
            {
                throw new ArgumentNullException(nameof(descPoolCreateInfo));
            }

            if (descPoolCreateInfo.MaxSets <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(descPoolCreateInfo.MaxSets) + "must be > 0");
            }

            if (descPoolCreateInfo.PoolSizes == null)
            {
                throw new ArgumentNullException(nameof(descPoolCreateInfo.PoolSizes));
            }

            if (descPoolCreateInfo.PoolSizes.Length <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(descPoolCreateInfo.PoolSizes) + "must be > 0");
            }


            IMgCommandPool commandPool;
            var            cmdPoolCreateInfo = new MgCommandPoolCreateInfo {
                QueueFamilyIndex = this.QueueFamilyIndex,
                Flags            = flags
            };

            var errCode = Device.CreateCommandPool(cmdPoolCreateInfo, null, out commandPool);

            Debug.Assert(errCode == Result.SUCCESS);

            IMgDescriptorPool descPool;

            errCode = Device.CreateDescriptorPool(descPoolCreateInfo, null, out descPool);
            Debug.Assert(errCode == Result.SUCCESS);

            MgPhysicalDeviceMemoryProperties prop;

            mParent.GetPhysicalDeviceMemoryProperties(out prop);

            var result = new MgThreadPartition(mParent, Device, this.Queue, commandPool, descPool, prop);

            return(result);
        }
Ejemplo n.º 2
0
        public IMgThreadPartition CreatePartition(MgCommandPoolCreateFlagBits flags)
        {
            IMgCommandPool commandPool;
            var            cmdPoolCreateInfo = new MgCommandPoolCreateInfo {
                QueueFamilyIndex = this.QueueFamilyIndex,
                Flags            = flags
            };

            var errCode = Device.CreateCommandPool(cmdPoolCreateInfo, null, out commandPool);

            Debug.Assert(errCode == Result.SUCCESS);

            MgPhysicalDeviceMemoryProperties prop;

            mParent.GetPhysicalDeviceMemoryProperties(out prop);

            var result = new MgThreadPartition(mParent, Device, this.Queue, commandPool, prop);

            return(result);
        }