Skip to content

LiteFX::Rendering::Backends::DirectX12PipelineLayout::rootParameterIndex

Returns the root parameter index for a descriptor set.

Synopsis

Declared in <litefx/backends/dx12.hpp>

[[dllimport, dllexport]] Optional<UInt32> rootParameterIndex(
    DirectX12DescriptorSetLayout const& layout,
    DescriptorHeapType heapType) const noexcept;

Description

Note that root parameter mapping is done by matching the descriptor set space. For example, providing any descriptor set layout for register space 1 will return the same root parameter index, even if a different descriptor set layout was provided for space 1 during pipeline layout construction. This allows for descriptor sets and layouts to be shared over multiple pipeline layouts, even if they are unrelated, as long as they are compatible. Compatibility must be ensured by the application.

Only if no descriptor set layout was provided for register space 1 in the example above, this method will return std::nullopt.

The heapType determines the target descriptor heap, for which to obtain the root parameter index. This is required, as samplers bind to another descriptor heap as all other resources. If the descriptor set does not contain descriptors that bind to the desired descriptor heap, the method will also return std::nullopt.

Return Value

The root parameter index for the descriptor set layout, or std::nullopt, if the descriptor set is not part of the pipeline layout or does not contain descriptors that bind to heapType.

Parameters

NameDescription
layoutThe layout of the descriptor set.
heapTypeThe type of the descriptor heap for which to obtain the root parameter index.