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); }
public DescriptorSetCollection GetStorageBuffer(CommandBufferScoped cbs, ref BufferHandleSet key) { return(GetOrCreate(cbs, ref key, _sCache, CreateStorageBuffer)); }
private DescriptorSetCollection CreateStorageBuffer(CommandBufferScoped cbs, ref BufferHandleSet key) { return(CreateBuffer(cbs, ref key, PipelineBase.StorageSetIndex, DescriptorType.StorageBufferDynamic)); }
public DescriptorSetCollection GetUniformBuffer(CommandBufferScoped cbs, ref BufferHandleSet key) { return(GetOrCreate(cbs, ref key, _uCache, CreateUniformBuffer)); }