コード例 #1
0
        private DescriptorSetCollection CreateBuffer(CommandBufferScoped cbs, ref BufferHandleSet key, int setIndex, DescriptorType type)
        {
            var dsc = _gd.DescriptorSetManager.AllocateDescriptorSet(_gd.Api, _descriptorSetLayouts[setIndex]).Get(cbs);

            Span <DescriptorBufferInfo> bufferInfos = stackalloc DescriptorBufferInfo[key.Count];

            for (int i = 0; i < key.Count; i++)
            {
                uint size = key.Sizes[i];

                if (type == DescriptorType.UniformBufferDynamic)
                {
                    size = Math.Min(size, 0x10000);
                }

                bufferInfos[i] = new DescriptorBufferInfo()
                {
                    Buffer = new VkBuffer(key.Handles[i]),
                    Offset = 0,
                    Range  = size
                };
            }

            dsc.UpdateBuffers(0, 0, bufferInfos, type);

            return(dsc);
        }
コード例 #2
0
 public DescriptorSetCollection GetStorageBuffer(CommandBufferScoped cbs, ref BufferHandleSet key)
 {
     return(GetOrCreate(cbs, ref key, _sCache, CreateStorageBuffer));
 }
コード例 #3
0
 private DescriptorSetCollection CreateStorageBuffer(CommandBufferScoped cbs, ref BufferHandleSet key)
 {
     return(CreateBuffer(cbs, ref key, PipelineBase.StorageSetIndex, DescriptorType.StorageBufferDynamic));
 }
コード例 #4
0
 public DescriptorSetCollection GetUniformBuffer(CommandBufferScoped cbs, ref BufferHandleSet key)
 {
     return(GetOrCreate(cbs, ref key, _uCache, CreateUniformBuffer));
 }