Ejemplo n.º 1
0
        private unsafe void CreateDescriptorPool(uint maxSets)
        {
            Device device = _renderer.Params.Device;
            AllocationCallbacks *allocator = (AllocationCallbacks *)_renderer.Params.AllocationCallbacks.ToPointer();
            Vk vk = _renderer.Vk;

            DescriptorPoolSize *descriptorPoolSizes = stackalloc DescriptorPoolSize[]
            {
                new DescriptorPoolSize()
                {
                    DescriptorCount = 2, // vertex and fragment shader
                    Type            = DescriptorType.UniformBuffer
                },
                new DescriptorPoolSize()
                {
                    DescriptorCount = 1, // Image
                    Type            = DescriptorType.CombinedImageSampler
                }
            };

            DescriptorPoolCreateInfo descriptorPoolCreateInfo = new()
            {
                SType = StructureType.DescriptorPoolCreateInfo,

                MaxSets = maxSets,

                PoolSizeCount = 2,
                PPoolSizes    = descriptorPoolSizes
            };

            _renderer.AssertVulkan(vk.CreateDescriptorPool(device, descriptorPoolCreateInfo, allocator, out _pool));
        }
Ejemplo n.º 2
0
 internal void ToNative(out Native native, DescriptorPoolSize *poolSizes)
 {
     native.Type          = StructureType.DescriptorPoolCreateInfo;
     native.Next          = IntPtr.Zero;
     native.Flags         = Flags;
     native.MaxSets       = MaxSets;
     native.PoolSizeCount = PoolSizes?.Length ?? 0;
     native.PoolSizes     = poolSizes;
 }
Ejemplo n.º 3
0
 public DescriptorPoolCreateInfo
 (
     StructureType sType             = StructureType.DescriptorPoolCreateInfo,
     void *pNext                     = default,
     DescriptorPoolCreateFlags flags = default,
     uint maxSets                    = default,
     uint poolSizeCount              = default,
     DescriptorPoolSize *pPoolSizes  = default
 )
 {
     SType         = sType;
     PNext         = pNext;
     Flags         = flags;
     MaxSets       = maxSets;
     PoolSizeCount = poolSizeCount;
     PPoolSizes    = pPoolSizes;
 }
Ejemplo n.º 4
0
        public DescriptorPoolCreateInfo
        (
            StructureType?sType             = StructureType.DescriptorPoolCreateInfo,
            void *pNext                     = null,
            DescriptorPoolCreateFlags?flags = null,
            uint?maxSets                    = null,
            uint?poolSizeCount              = null,
            DescriptorPoolSize *pPoolSizes  = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (flags is not null)
            {
                Flags = flags.Value;
            }

            if (maxSets is not null)
            {
                MaxSets = maxSets.Value;
            }

            if (poolSizeCount is not null)
            {
                PoolSizeCount = poolSizeCount.Value;
            }

            if (pPoolSizes is not null)
            {
                PPoolSizes = pPoolSizes;
            }
        }