示例#1
0
        private static VkDescriptorPool CreateDescriptorPool(VkDevice device, uint swapchainImageCount, uint textureCount)
        {
            VkDescriptorPoolSize[] sizes = new VkDescriptorPoolSize[2];
            sizes[0] = new VkDescriptorPoolSize();
            sizes[0].descriptorCount = swapchainImageCount * textureCount;
            sizes[0].type            = VkDescriptorType.CombinedImageSampler;

            sizes[1] = new VkDescriptorPoolSize();
            sizes[1].descriptorCount = swapchainImageCount * 1;
            sizes[1].type            = VkDescriptorType.UniformBuffer;

            VkDescriptorPoolCreateInfo createInfo = VkDescriptorPoolCreateInfo.New();

            createInfo.poolSizeCount = 2;

            fixed(VkDescriptorPoolSize *ptr = sizes)
            createInfo.pPoolSizes = ptr;

            createInfo.maxSets = swapchainImageCount;

            VkDescriptorPool pool = VkDescriptorPool.Null;

            Assert(vkCreateDescriptorPool(device, &createInfo, null, &pool));
            return(pool);
        }
        private VkDescriptorPool CreateDescriptorPool()
        {
            VkDescriptorPoolSize *descriptorPoolSizePtr = stackalloc VkDescriptorPoolSize[2]
            {
                new VkDescriptorPoolSize {
                    type = VkDescriptorType.UniformBuffer, descriptorCount = 1
                },
                new VkDescriptorPoolSize {
                    type = VkDescriptorType.CombinedImageSampler, descriptorCount = 1
                }
            };

            var createInfo = new VkDescriptorPoolCreateInfo()
            {
                sType         = VkStructureType.DescriptorPoolCreateInfo,
                pNext         = null,
                poolSizeCount = 2,
                pPoolSizes    = descriptorPoolSizePtr,
                maxSets       = 2
            };

            VkDescriptorPool descriptorPool;

            vkCreateDescriptorPool(Context.Device, &createInfo, null, out descriptorPool).CheckResult();

            return(descriptorPool);
        }
示例#3
0
        private unsafe PoolInfo CreateNewPool()
        {
            uint totalSets       = 1000;
            uint descriptorCount = 256;
            uint poolSizeCount   = MAX_DESCRIPTOR_COUNT;

            VkDescriptorPoolSize *sizes = stackalloc VkDescriptorPoolSize[(int)poolSizeCount];

            for (int i = 0; i < MAX_DESCRIPTOR_COUNT; i++)
            {
                sizes[i].type            = descriptorTypes[i];
                sizes[i].descriptorCount = descriptorCount;
            }

            VkDescriptorPoolInlineUniformBlockCreateInfoEXT descriptorPoolInlineUniformBlockCreateInfo = new VkDescriptorPoolInlineUniformBlockCreateInfoEXT
            {
                sType = VkStructureType.DescriptorPoolInlineUniformBlockCreateInfoEXT,
                maxInlineUniformBlockBindings = totalSets
            };

            var poolCI = new VkDescriptorPoolCreateInfo
            {
                sType         = VkStructureType.DescriptorPoolCreateInfo,
                flags         = VkDescriptorPoolCreateFlags.FreeDescriptorSet,
                poolSizeCount = poolSizeCount,
                maxSets       = totalSets,
                pPoolSizes    = sizes,
                pNext         = &descriptorPoolInlineUniformBlockCreateInfo
            };

            var descriptorPool = Device.CreateDescriptorPool(ref poolCI);

            return(new PoolInfo(descriptorPool, totalSets, descriptorCount));
        }
示例#4
0
 public DescriptorPool(Device dev, VkDescriptorPoolCreateFlag flags, uint maxSets,
                       Dictionary <VkDescriptorType, uint> countByType)
 {
     unsafe
     {
         var pools = stackalloc VkDescriptorPoolSize[countByType.Count];
         var i     = 0;
         foreach (var kv in countByType)
         {
             pools[i++] = new VkDescriptorPoolSize()
             {
                 Type            = kv.Key,
                 DescriptorCount = kv.Value
             }
         }
         ;
         Device = dev;
         var info = new VkDescriptorPoolCreateInfo()
         {
             SType         = VkStructureType.DescriptorPoolCreateInfo,
             Flags         = flags,
             MaxSets       = maxSets,
             PNext         = IntPtr.Zero,
             PoolSizeCount = (uint)countByType.Count,
             PPoolSizes    = pools
         };
         Handle = dev.Handle.CreateDescriptorPool(&info, dev.Instance.AllocationCallbacks);
     }
 }
        private unsafe PoolInfo CreateNewPool()
        {
            uint totalSets              = 1000;
            uint descriptorCount        = 100;
            uint poolSizeCount          = 7;
            VkDescriptorPoolSize *sizes = stackalloc VkDescriptorPoolSize[(int)poolSizeCount];

            sizes[0].type            = VkDescriptorType.UniformBuffer;
            sizes[0].descriptorCount = descriptorCount;
            sizes[1].type            = VkDescriptorType.SampledImage;
            sizes[1].descriptorCount = descriptorCount;
            sizes[2].type            = VkDescriptorType.Sampler;
            sizes[2].descriptorCount = descriptorCount;
            sizes[3].type            = VkDescriptorType.StorageBuffer;
            sizes[3].descriptorCount = descriptorCount;
            sizes[4].type            = VkDescriptorType.StorageImage;
            sizes[4].descriptorCount = descriptorCount;
            sizes[5].type            = VkDescriptorType.UniformBufferDynamic;
            sizes[5].descriptorCount = descriptorCount;
            sizes[6].type            = VkDescriptorType.StorageBufferDynamic;
            sizes[6].descriptorCount = descriptorCount;

            VkDescriptorPoolCreateInfo poolCI = VkDescriptorPoolCreateInfo.New();

            poolCI.flags         = VkDescriptorPoolCreateFlags.FreeDescriptorSet;
            poolCI.maxSets       = totalSets;
            poolCI.pPoolSizes    = sizes;
            poolCI.poolSizeCount = poolSizeCount;

            VkResult result = vkCreateDescriptorPool(_gd.Device, ref poolCI, null, out VkDescriptorPool descriptorPool);

            VulkanUtil.CheckResult(result);

            return(new PoolInfo(descriptorPool, totalSets, descriptorCount));
        }
        public VkResourceCache(VkDevice device, VkSamplerState defaultSamplerState)
        {
            _device = device;
            _defaultSamplerState = defaultSamplerState;

            VkDescriptorPoolSize *sizes = stackalloc VkDescriptorPoolSize[3];

            sizes[0].type            = VkDescriptorType.UniformBuffer;
            sizes[0].descriptorCount = 50000;
            sizes[1].type            = VkDescriptorType.SampledImage;
            sizes[1].descriptorCount = 15000;
            sizes[2].type            = VkDescriptorType.Sampler;
            sizes[2].descriptorCount = 15000;

            VkDescriptorPoolCreateInfo descriptorPoolCI = VkDescriptorPoolCreateInfo.New();

            descriptorPoolCI.flags         = VkDescriptorPoolCreateFlags.FreeDescriptorSet;
            descriptorPoolCI.maxSets       = 15000;
            descriptorPoolCI.pPoolSizes    = sizes;
            descriptorPoolCI.poolSizeCount = 3;

            VkResult result = vkCreateDescriptorPool(_device, ref descriptorPoolCI, null, out _descriptorPool);

            CheckResult(result);
        }
示例#7
0
        VkDescriptorSet CreateDescriptorSet(VkDevice device, VkDescriptorSetLayout descriptorSetLayout)
        {
            VkDescriptorPool descriptorPool;
            {
                // this pool can allocate one uniform descriptor.
                var info = new VkDescriptorPoolCreateInfo {
                    sType = VkStructureType.DescriptorPoolCreateInfo
                };
                var size = new VkDescriptorPoolSize(VkDescriptorType.UniformBuffer, 1);
                info.poolSizes = size;
                info.maxSets   = 1;
                vkAPI.vkCreateDescriptorPool(device, &info, null, &descriptorPool).Check();
                info.Free();
            }
            VkDescriptorSet descriptorSet;

            {
                var info = new VkDescriptorSetAllocateInfo {
                    sType = VkStructureType.DescriptorSetAllocateInfo
                };
                info.setLayouts     = descriptorSetLayout;
                info.descriptorPool = descriptorPool;
                vkAPI.vkAllocateDescriptorSets(device, &info, &descriptorSet).Check();
                info.Free();
            }

            return(descriptorSet);
        }
        public VkDescriptorPool CreateDescriptorPool(VkDevice device, VkDescriptorPoolSize[] descPoolSize, int maxSets)
        {
            var descriptorPoolCreateInfo = new VkDescriptorPoolCreateInfo()
            {
                poolSizes = descPoolSize,
                maxSets   = (uint)maxSets,
                flags     = VkDescriptorPoolCreateFlags.VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
            };

            VulkanAPI.vkCreateDescriptorPool(device, ref descriptorPoolCreateInfo, out m_descriptorPool);
            return(m_descriptorPool);
        }
        private void PrepareDescriptor(VkDevice device)
        {
            // 定数バッファを1つだけ持つものを作る.
            VkDescriptorPoolSize descriptorPoolSize = new VkDescriptorPoolSize()
            {
                descriptorCount = 1,
                type            = VkDescriptorType.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
            };
            var descriptorPoolCreateInfo = new VkDescriptorPoolCreateInfo()
            {
                poolSizes = new[] { descriptorPoolSize },
                maxSets   = 1,
                flags     = VkDescriptorPoolCreateFlags.VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
            };

            VulkanAPI.vkCreateDescriptorPool(device, ref descriptorPoolCreateInfo, out m_descriptorPool);

            // ディスクリプタセットレイアウトの作成.
            // 今は定数バッファを1つ持つだけのものを作成.
            var descriptorLayoutBinding = new VkDescriptorSetLayoutBinding();

            descriptorLayoutBinding.binding         = 0;
            descriptorLayoutBinding.descriptorCount = 1;
            descriptorLayoutBinding.descriptorType  = VkDescriptorType.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
            descriptorLayoutBinding.stageFlags      = VkShaderStageFlagBits.VK_SHADER_STAGE_VERTEX_BIT;

            var descriptorSetLayoutCreateInfo = new VkDescriptorSetLayoutCreateInfo();

            descriptorSetLayoutCreateInfo.bindings = new[] { descriptorLayoutBinding };
            VulkanAPI.vkCreateDescriptorSetLayout(device, ref descriptorSetLayoutCreateInfo, out m_descriptorSetLayout);

            // ディスクリプタセットを作成.
            VkDescriptorSet[] descriptorSets;
            var descriptorSetAllocateInfo = new VkDescriptorSetAllocateInfo(m_descriptorPool, new[] { m_descriptorSetLayout });

            VulkanAPI.vkAllocateDescriptorSets(device, ref descriptorSetAllocateInfo, out descriptorSets);
            m_descriptorSet = descriptorSets[0];

            // ディスクリプタを更新.
            // 定数バッファ1つを持つレイアウトでディスクリプタを作る.
            VkDescriptorBufferInfo descUniformBufferInfo = new VkDescriptorBufferInfo();

            descUniformBufferInfo.buffer = m_uniformBuffer;
            descUniformBufferInfo.range  = Marshal.SizeOf <Transform>();
            var descriptor = new VkWriteDescriptorSet();

            descriptor.descriptorCount = 1;
            descriptor.descriptorType  = VkDescriptorType.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
            descriptor.pBufferInfo     = new[] { descUniformBufferInfo };
            descriptor.dstBinding      = 0;
            descriptor.dstSet          = m_descriptorSet;
            VulkanAPI.vkUpdateDescriptorSets(device, new[] { descriptor }, null);
        }
示例#10
0
文件: Initializers.cs 项目: gomson/vk
        public static VkDescriptorPoolCreateInfo descriptorPoolCreateInfo(
            uint poolSizeCount,
            VkDescriptorPoolSize *pPoolSizes,
            uint maxSets)
        {
            VkDescriptorPoolCreateInfo descriptorPoolInfo = VkDescriptorPoolCreateInfo.New();

            descriptorPoolInfo.poolSizeCount = poolSizeCount;
            descriptorPoolInfo.pPoolSizes    = pPoolSizes;
            descriptorPoolInfo.maxSets       = maxSets;
            return(descriptorPoolInfo);
        }
示例#11
0
        void setupDescriptorPool()
        {
            // Example uses one ubo
            VkDescriptorPoolSize poolSizes = Initializers.descriptorPoolSize(VkDescriptorType.UniformBuffer, 1);

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    1,
                    &poolSizes,
                    2);

            Util.CheckResult(vkCreateDescriptorPool(device, &descriptorPoolInfo, null, out descriptorPool));
        }
示例#12
0
        public override void Activate()
        {
            if (state != ActivableState.Activated)
            {
                VkDescriptorPoolCreateInfo info = VkDescriptorPoolCreateInfo.New();
                info.poolSizeCount = (uint)PoolSizes.Count;
                info.pPoolSizes    = PoolSizes.Pin();
                info.maxSets       = MaxSets;

                Utils.CheckResult(vkCreateDescriptorPool(Dev.VkDev, ref info, IntPtr.Zero, out handle));
                PoolSizes.Unpin();
            }
            base.Activate();
        }
示例#13
0
        void setupDescriptorPool()
        {
            FixedArray2<VkDescriptorPoolSize> poolSizes = new FixedArray2<VkDescriptorPoolSize>(
                Initializers.descriptorPoolSize(VkDescriptorType.UniformBuffer, 2),
                Initializers.descriptorPoolSize(VkDescriptorType.CombinedImageSampler, 2));

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    poolSizes.Count,
                    &poolSizes.First,
                    2);

            Util.CheckResult(vkCreateDescriptorPool(device, &descriptorPoolInfo, null, out descriptorPool));
        }
        void setupDescriptorPool()
        {
            FixedArray2 <VkDescriptorPoolSize> poolSizes = new FixedArray2 <VkDescriptorPoolSize>(
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1),
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1));

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    (uint)(poolSizes.Count),
                    &poolSizes.First,
                    1);

            Util.CheckResult(vkCreateDescriptorPool(device, &descriptorPoolInfo, null, out descriptorPool));
        }
示例#15
0
        protected virtual void SetupDescriptorPool(Pipeline pipeline, GraphicsDevice device)
        {
            // Example uses one ubo and one combined image sampler
            FixedArray2 <VkDescriptorPoolSize> poolSizes = new FixedArray2 <VkDescriptorPoolSize>(
                Initializers.descriptorPoolSize(VkDescriptorType.UniformBuffer, 1),
                Initializers.descriptorPoolSize(VkDescriptorType.CombinedImageSampler, 1));

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    poolSizes.Count,
                    &poolSizes.First,
                    1);

            Util.CheckResult(vkCreateDescriptorPool(device.device, &descriptorPoolInfo, null, out pipeline.descriptorPool));
        }
示例#16
0
        void setupDescriptorPool()
        {
            // Example uses one ubo and one combined image sampler
            FixedArray2 <VkDescriptorPoolSize> poolSizes = new FixedArray2 <VkDescriptorPoolSize>(
                Initializers.descriptorPoolSize(VkDescriptorType.UniformBuffer, 1),
                Initializers.descriptorPoolSize(VkDescriptorType.CombinedImageSampler, 1));

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    poolSizes.Count,
                    &poolSizes.First,
                    1);

            Util.CheckResult(vkCreateDescriptorPool(Device, &descriptorPoolInfo, null, out descriptorPool));
        }
        void setupDescriptorPool()
        {
            // Example uses one ubo and one image sampler
            FixedArray3 <VkDescriptorPoolSize> poolSizes = new FixedArray3 <VkDescriptorPoolSize>(
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1),
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1),
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1));

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    (uint)(poolSizes.Count),
                    &poolSizes.First,
                    2);

            Util.CheckResult(vkCreateDescriptorPool(device, &descriptorPoolInfo, null, out descriptorPool));
        }
示例#18
0
        void CreateDescriptorPool()
        {
            var poolSize = new VkDescriptorPoolSize();

            poolSize.type            = VkDescriptorType.UniformBuffer;
            poolSize.descriptorCount = 1;

            var info = new VkDescriptorPoolCreateInfo();

            info.poolSizes = new List <VkDescriptorPoolSize> {
                poolSize
            };
            info.maxSets = 1;

            descriptorPool = new VkDescriptorPool(device, info);
        }
示例#19
0
        void setupDescriptorPool()
        {
            // Example uses one ubo and one image sampler
            FixedArray2 <VkDescriptorPoolSize> poolSizes = new FixedArray2 <VkDescriptorPoolSize>(
                Initializers.descriptorPoolSize(VkDescriptorType.UniformBuffer, 1),
                Initializers.descriptorPoolSize(VkDescriptorType.CombinedImageSampler, 1)
                );

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    poolSizes.Count,
                    (VkDescriptorPoolSize *)Unsafe.AsPointer(ref poolSizes),
                    2);

            Util.CheckResult(vkCreateDescriptorPool(device, &descriptorPoolInfo, null, out descriptorPool));
        }
示例#20
0
        void setupDescriptorPool()
        {
            VkDescriptorPoolSize poolSizes = new VkDescriptorPoolSize()
            {
                type = VkDescriptorType.UniformBuffer, descriptorCount = 1
            };

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                VkDescriptorPoolCreateInfo.New();

            descriptorPoolInfo.poolSizeCount = 1;
            descriptorPoolInfo.pPoolSizes    = &poolSizes;
            descriptorPoolInfo.maxSets       = 2;

            Util.CheckResult(vkCreateDescriptorPool(Device, &descriptorPoolInfo, null, out descriptorPool));
        }
示例#21
0
        void setupDescriptorPool()
        {
            // Example uses three ubos and one image sampler
            NativeList <VkDescriptorPoolSize> poolSizes = new NativeList <VkDescriptorPoolSize>
            {
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 4),
                Initializers.descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6)
            };

            VkDescriptorPoolCreateInfo descriptorPoolInfo =
                Initializers.descriptorPoolCreateInfo(
                    poolSizes.Count,
                    (VkDescriptorPoolSize *)poolSizes.Data,
                    2);

            Util.CheckResult(vkCreateDescriptorPool(device, &descriptorPoolInfo, null, out descriptorPool));
        }
示例#22
0
        void setupDescriptorPool()
        {
            // Example uses one ubo and one image sampler
            var poolSizes = new VkDescriptorPoolSize[2];

            poolSizes[0].type            = VkDescriptorType.UniformBuffer;
            poolSizes[0].descriptorCount = 1;
            poolSizes[1].type            = VkDescriptorType.CombinedImageSampler;
            poolSizes[1].descriptorCount = 1;

            var poolInfo = VkDescriptorPoolCreateInfo.Alloc();

            poolInfo[0].poolSizes = poolSizes;
            poolInfo[0].maxSets   = 2;
            {
                VkDescriptorPool pool;
                vkCreateDescriptorPool(device, poolInfo, null, &pool);
                descriptorPool = pool;
            }
        }
        void setupDescriptorPool()
        {
            // Example uses one ubo and one image sampler
            var poolSizes = new VkDescriptorPoolSize[] {
                new VkDescriptorPoolSize(VkDescriptorType.UniformBuffer, 1),
                new VkDescriptorPoolSize(VkDescriptorType.UniformBufferDynamic, 1),
                new VkDescriptorPoolSize(VkDescriptorType.CombinedImageSampler, 1),
            };

            var info = new VkDescriptorPoolCreateInfo();

            info.sType     = DescriptorPoolCreateInfo;
            info.poolSizes = poolSizes;
            info.maxSets   = 2;

            VkDescriptorPool pool;

            vkCreateDescriptorPool(device, &info, null, &pool);
            this.descriptorPool = pool;
        }
示例#24
0
        void setupDescriptorPool()
        {
            // Example uses three ubos and one image sampler
            var poolSizes = new VkDescriptorPoolSize[2];

            poolSizes[0].type            = VkDescriptorType.UniformBuffer;
            poolSizes[0].descriptorCount = 4;
            poolSizes[1].type            = VkDescriptorType.CombinedImageSampler;
            poolSizes[1].descriptorCount = 6;

            var descriptorPoolInfo = VkDescriptorPoolCreateInfo.Alloc();

            descriptorPoolInfo->poolSizes = poolSizes;
            descriptorPoolInfo->maxSets   = 2;

            VkDescriptorPool pool;

            vkCreateDescriptorPool(device, descriptorPoolInfo, null, &pool);
            this.descriptorPool = pool;
            Marshal.FreeHGlobal((IntPtr)descriptorPoolInfo);
        }
示例#25
0
        protected override unsafe VkDescriptorPool CreateObject()
        {
            // No allocator ready to be used, let's create a new one
            var poolSizes = GraphicsDevice.MaxDescriptorTypeCounts
                            .Select((count, index) => new VkDescriptorPoolSize {
                type = (VkDescriptorType)index, descriptorCount = count
            })
                            .Where(size => size.descriptorCount > 0)
                            .ToArray();

            var descriptorPoolCreateInfo = new VkDescriptorPoolCreateInfo
            {
                sType         = VkStructureType.DescriptorPoolCreateInfo,
                poolSizeCount = (uint)poolSizes.Length,
                pPoolSizes    = (VkDescriptorPoolSize *)Core.Interop.Fixed(poolSizes),
                maxSets       = GraphicsDevice.MaxDescriptorSetCount,
            };

            vkCreateDescriptorPool(GraphicsDevice.NativeDevice, &descriptorPoolCreateInfo, null, out var descriptorPool);
            return(descriptorPool);
        }
示例#26
0
        public DescriptorPool(Device dev, VkDescriptorPoolCreateFlag flags, uint maxSets,
                              Span <VkDescriptorPoolSize> pools)
        {
            unsafe
            {
                Device = dev;
                fixed(VkDescriptorPoolSize *pPools = &pools.DangerousGetPinnableReference())
                {
                    var info = new VkDescriptorPoolCreateInfo()
                    {
                        SType         = VkStructureType.DescriptorPoolCreateInfo,
                        Flags         = flags,
                        MaxSets       = maxSets,
                        PNext         = IntPtr.Zero,
                        PoolSizeCount = (uint)pools.Length,
                        PPoolSizes    = pPools
                    };

                    Handle = dev.Handle.CreateDescriptorPool(&info, dev.Instance.AllocationCallbacks);
                }
            }
        }
示例#27
0
        private void CreateDescriptorPool()
        {
            VkDescriptorPoolSize *sizes = stackalloc VkDescriptorPoolSize[3];

            sizes[0].type            = VkDescriptorType.UniformBuffer;
            sizes[0].descriptorCount = 5000;
            sizes[1].type            = VkDescriptorType.SampledImage;
            sizes[1].descriptorCount = 5000;
            sizes[2].type            = VkDescriptorType.Sampler;
            sizes[2].descriptorCount = 5000;

            VkDescriptorPoolCreateInfo descriptorPoolCI = VkDescriptorPoolCreateInfo.New();

            descriptorPoolCI.flags         = VkDescriptorPoolCreateFlags.FreeDescriptorSet;
            descriptorPoolCI.maxSets       = 5000;
            descriptorPoolCI.pPoolSizes    = sizes;
            descriptorPoolCI.poolSizeCount = 3;

            VkResult result = vkCreateDescriptorPool(_device, ref descriptorPoolCI, null, out _descriptorPool);

            CheckResult(result);
        }
示例#28
0
        void CreateDescriptorPool()
        {
            var size1 = new VkDescriptorPoolSize();

            size1.type            = VkDescriptorType.UniformBuffer;
            size1.descriptorCount = 1;

            var size2 = new VkDescriptorPoolSize();

            size2.type            = VkDescriptorType.CombinedImageSampler;
            size2.descriptorCount = 1;

            var poolSizes = new List <VkDescriptorPoolSize> {
                size1, size2
            };

            var info = new VkDescriptorPoolCreateInfo();

            info.poolSizes = poolSizes;
            info.maxSets   = 1;

            descriptorPool = new VkDescriptorPool(device, info);
        }
示例#29
0
        void CreateDescriptorPool(DescriptorPoolCreateInfo mInfo)
        {
            var info = new VkDescriptorPoolCreateInfo();

            info.sType   = VkStructureType.DescriptorPoolCreateInfo;
            info.flags   = mInfo.flags;
            info.maxSets = mInfo.maxSets;

            var poolSizesMarshalled = new NativeArray <VkDescriptorPoolSize>(mInfo.poolSizes);

            info.poolSizeCount = (uint)poolSizesMarshalled.Count;
            info.pPoolSizes    = poolSizesMarshalled.Address;

            using (poolSizesMarshalled) {
                var result = Device.Commands.createDescriptorPool(Device.Native, ref info, Device.Instance.AllocationCallbacks, out descriptorPool);
                if (result != VkResult.Success)
                {
                    throw new DescriptorPoolException(string.Format("Error creating descriptor pool: {0}", result));
                }
            }

            Flags = mInfo.flags;
        }
示例#30
0
 public static extern VkResult CreateDescriptorPool(
     VkDevice device,
     ref VkDescriptorPoolCreateInfo pCreateInfo,
     IntPtr pAllocator,
     out VkDescriptorPool pDescriptorPool
     );