/// <summary>
 /// Initializes a new instance of the <see cref="DescriptorHeapDescription"/> struct.
 /// </summary>
 /// <param name="type">The heap type.</param>
 /// <param name="descriptorCount">The descriptor count.</param>
 /// <param name="flags">The optional heap flags.</param>
 /// <param name="nodeMask">Multi GPU node mask.</param>
 public DescriptorHeapDescription(DescriptorHeapType type, int descriptorCount, DescriptorHeapFlags flags = DescriptorHeapFlags.None, int nodeMask = 0)
 {
     Type            = type;
     DescriptorCount = descriptorCount;
     Flags           = flags;
     NodeMask        = nodeMask;
 }
        public DescriptorAllocator(GraphicsDevice device, DescriptorHeapType descriptorHeapType, int descriptorCount = DescriptorsPerHeap, DescriptorHeapFlags descriptorHeapFlags = DescriptorHeapFlags.None)
        {
            if (descriptorCount < 1 || descriptorCount > DescriptorsPerHeap)
            {
                throw new ArgumentOutOfRangeException(nameof(descriptorCount), $"Descriptor count must be between 1 and {DescriptorsPerHeap}.");
            }

            Type  = descriptorHeapType;
            Flags = descriptorHeapFlags;

            DescriptorHandleIncrementSize = device.NativeDevice.GetDescriptorHandleIncrementSize((Vortice.Direct3D12.DescriptorHeapType)descriptorHeapType);

            DescriptorHeapDescription descriptorHeapDescription = new DescriptorHeapDescription((Vortice.Direct3D12.DescriptorHeapType)descriptorHeapType, descriptorCount, (Vortice.Direct3D12.DescriptorHeapFlags)descriptorHeapFlags);

            DescriptorHeap = device.NativeDevice.CreateDescriptorHeap(descriptorHeapDescription);

            DescriptorCapacity = descriptorCount;
        }
Example #3
0
        public D3D12TextureView(DX12GraphicsDevice graphicsDevice,
                                int descriptorCount,
                                DescriptorHeapFlags descriptorHeapFlags,
                                DescriptorHeapType descriptorHeapType)
        {
            var descriptorHeapDescription = new DescriptorHeapDescription
            {
                DescriptorCount = descriptorCount,
                Flags           = descriptorHeapFlags,
                Type            = descriptorHeapType
            };

            if (descriptorHeapType == DescriptorHeapType.RenderTargetView)
            {
                _rtvDescriptorHeap = graphicsDevice.CreateDescriptorHeap(descriptorHeapDescription);
            }
            else if (descriptorHeapType == DescriptorHeapType.ConstantBufferViewShaderResourceViewUnorderedAccessView)
            {
                _dsvDescriptorHeap = graphicsDevice.CreateDescriptorHeap(descriptorHeapDescription);
            }
        }