예제 #1
0
        void setupDescriptorPool()
        {
            // Example uses one ubo and one image sampler
            var descriptorPoolInfo = new MgDescriptorPoolCreateInfo
            {
                MaxSets   = 2,
                PoolSizes = new[]
                {
                    new MgDescriptorPoolSize
                    {
                        Type            = MgDescriptorType.UNIFORM_BUFFER,
                        DescriptorCount = 1,
                    },
                    new MgDescriptorPoolSize
                    {
                        Type            = MgDescriptorType.COMBINED_IMAGE_SAMPLER,
                        DescriptorCount = 1,
                    },
                },
            };

            var device = mManager.Configuration.Device;

            Debug.Assert(device != null);
            var err = device.CreateDescriptorPool(descriptorPoolInfo, null, out mDescriptorPool);

            Debug.Assert(err == Result.SUCCESS);
        }
예제 #2
0
        public AmtDescriptorPool(MgDescriptorPoolCreateInfo createInfo)
        {
            if (createInfo == null)
            {
                throw new ArgumentNullException(nameof(createInfo));
            }

            PoolSize     = createInfo.MaxSets;
            FreeSets     = new ConcurrentBag <AmtDescriptorSet> ();
            AttachedSets = new AmtDescriptorSet[PoolSize];

            for (var i = 0; i < PoolSize; ++i)
            {
                var descriptorSet = new AmtDescriptorSet(i);
                AttachedSets[i] = descriptorSet;
                FreeSets.Add(descriptorSet);
            }
        }
예제 #3
0
        void SetupDescriptorPool()
        {
            var descriptorPoolInfo = new MgDescriptorPoolCreateInfo
            {
                PoolSizes = new MgDescriptorPoolSize[]
                {
                    new MgDescriptorPoolSize
                    {
                        Type            = MgDescriptorType.UNIFORM_BUFFER,
                        DescriptorCount = 1,
                    },
                },
                MaxSets = 1,
            };
            var err = mConfiguration.Device.CreateDescriptorPool(descriptorPoolInfo, null, out mDescriptorPool);

            Debug.Assert(err == Result.SUCCESS);
        }
예제 #4
0
        public GLNextDescriptorPool(MgDescriptorPoolCreateInfo createInfo, IGLImageDescriptorEntrypoint entrypoint)
        {
            MaxSets        = createInfo.MaxSets;
            mAvailableSets = new ConcurrentBag <IGLDescriptorSet>();
            for (var i = 1U; i <= MaxSets; i += 1)
            {
                // STARTING FROM 1 - 0 == (default) uint
                mAvailableSets.Add(new GLNextDescriptorSet(i, this));
            }
            AllocatedSets = new Dictionary <uint, IGLDescriptorSet>();

            var  noOfUniformBlocks         = 0U;
            uint noOfStorageBuffers        = 0U;
            uint noOfCombinedImageSamplers = 0U;

            foreach (var pool in createInfo.PoolSizes)
            {
                switch (pool.Type)
                {
                case MgDescriptorType.UNIFORM_BUFFER:
                case MgDescriptorType.UNIFORM_BUFFER_DYNAMIC:
                    noOfUniformBlocks += pool.DescriptorCount;
                    break;

                case MgDescriptorType.STORAGE_BUFFER:
                case MgDescriptorType.STORAGE_BUFFER_DYNAMIC:
                    noOfStorageBuffers += pool.DescriptorCount;
                    break;

                case MgDescriptorType.COMBINED_IMAGE_SAMPLER:
                    noOfCombinedImageSamplers += pool.DescriptorCount;
                    break;
                }
            }

            SetupCombinedImageSamplers(entrypoint, noOfCombinedImageSamplers);
            SetupUniformBlocks(noOfUniformBlocks);
            SetupStorageBuffers(noOfStorageBuffers);
        }
예제 #5
0
 public Result CreateDescriptorPool(MgDescriptorPoolCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgDescriptorPool pDescriptorPool)
 {
     pDescriptorPool = new AmtDescriptorPool(pCreateInfo);
     return(Result.SUCCESS);
 }
예제 #6
0
 public IGLNextDescriptorPool CreatePool(MgDescriptorPoolCreateInfo createInfo)
 {
     return(new GLNextDescriptorPool(createInfo, mImgDescriptor));
 }
예제 #7
0
 public Result CreateDescriptorPool(MgDescriptorPoolCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgDescriptorPool pDescriptorPool)
 {
     throw new NotImplementedException();
 }