コード例 #1
0
        private DescriptorSet(GraphicsDevice graphicsDevice, DescriptorPool pool, DescriptorSetLayout desc)
        {
            if (pool.SrvOffset + desc.SrvCount > pool.SrvCount || pool.SamplerOffset + desc.SamplerCount > pool.SamplerCount)
            {
                // Eearly exit if OOM, IsValid should return false (TODO: different mechanism?)
                Device         = null;
                BindingOffsets = null;
                Description    = null;
                SrvStart       = new CpuDescriptorHandle();
                SamplerStart   = new CpuDescriptorHandle();
                return;
            }

            Device         = graphicsDevice;
            BindingOffsets = desc.BindingOffsets;
            Description    = desc;

            // Store start CpuDescriptorHandle
            SrvStart     = desc.SrvCount > 0 ? (pool.SrvStart + graphicsDevice.SrvHandleIncrementSize * pool.SrvOffset) : new CpuDescriptorHandle();
            SamplerStart = desc.SamplerCount > 0 ? (pool.SamplerStart + graphicsDevice.SamplerHandleIncrementSize * pool.SamplerOffset) : new CpuDescriptorHandle();

            // Allocation is done, bump offsets
            // TODO D3D12 thread safety?
            pool.SrvOffset     += desc.SrvCount;
            pool.SamplerOffset += desc.SamplerCount;
        }
コード例 #2
0
        protected override void Destroy()
        {
            foreach (var descriptorPool in descriptorPools)
            {
                descriptorPool.Dispose();
            }
            descriptorPools.Clear();
            currentDescriptorPool = null;

            foreach (var bufferPool in bufferPools)
            {
                bufferPool.Dispose();
            }
            bufferPools.Clear();
            currentBufferPool = null;

            base.Destroy();
        }
コード例 #3
0
 private void SetupNextDescriptorPool()
 {
     currentDescriptorPoolIndex++;
     if (currentDescriptorPoolIndex >= descriptorPools.Count)
     {
         descriptorPools.Add(currentDescriptorPool = DescriptorPool.New(
                                 graphicsDevice,
                                 new[]
         {
             new DescriptorTypeCount(EffectParameterClass.ConstantBuffer, 16384),
             new DescriptorTypeCount(EffectParameterClass.ShaderResourceView, 65536),
             new DescriptorTypeCount(EffectParameterClass.UnorderedAccessView, 4096),
             new DescriptorTypeCount(EffectParameterClass.Sampler, 16384),
         }));
     }
     else
     {
         currentDescriptorPool = descriptorPools[currentDescriptorPoolIndex];
     }
 }
コード例 #4
0
        public void Reset(CommandList commandList)
        {
            this.commandList = commandList;

            foreach (var descriptorPool in descriptorPools)
            {
                descriptorPool.Reset();
            }

            foreach (var bufferPool in bufferPools)
            {
                bufferPool.Reset();
            }

            currentResourceGroupPoolIndex = -1;

            currentDescriptorPool      = descriptorPools[0];
            currentDescriptorPoolIndex = 0;

            currentBufferPool      = null;
            currentBufferPoolIndex = -1;
        }
コード例 #5
0
ファイル: DescriptorSet.cs プロジェクト: vvvv/stride
 private DescriptorSet(GraphicsDevice graphicsDevice, DescriptorPool pool, DescriptorSetLayout desc)
 {
     this.HeapObjects           = pool.Entries;
     this.DescriptorStartOffset = pool.Allocate(desc.ElementCount);
 }
コード例 #6
0
ファイル: DescriptorSet.cs プロジェクト: vvvv/stride
 public static DescriptorSet New(GraphicsDevice graphicsDevice, DescriptorPool pool, DescriptorSetLayout desc)
 {
     return(new DescriptorSet(graphicsDevice, pool, desc));
 }
コード例 #7
0
ファイル: DescriptorSet.Vulkan.cs プロジェクト: Aggror/Stride
 private DescriptorSet(GraphicsDevice graphicsDevice, DescriptorPool pool, DescriptorSetLayout desc)
 {
     GraphicsDevice      = graphicsDevice;
     NativeDescriptorSet = pool.AllocateDescriptorSet(desc);
 }