Class DescriptorSet

Synopsis

#include <Source/Falcor/Core/API/DescriptorSet.h>

class dlldecl DescriptorSet

Description

No description yet.

Classes

Layout

Mentioned in

Methods

~DescriptorSet
bindForCompute
bindForGraphics
createCreate a new descriptor set.
getApiData
getApiHandle
getCpuHandle
getGpuHandle
getRange
getRangeCount
getVisibility
setCbv
setSampler
setSrv
setUav

Source

Lines 55-120 in Source/Falcor/Core/API/DescriptorSet.h.

class dlldecl DescriptorSet
{
public:
    using SharedPtr = std::shared_ptr<DescriptorSet>;
    using Type = DescriptorPool::Type;
    using CpuHandle = DescriptorPool::CpuHandle;
    using GpuHandle = DescriptorPool::GpuHandle;
    using ApiHandle = DescriptorSetApiHandle;
    using ApiData = DescriptorSetApiData;
    ~DescriptorSet();
    class dlldecl Layout
    {
    public:
        struct Range
        {
            Type type;
            uint32_t baseRegIndex;
            uint32_t descCount;
            uint32_t regSpace;
        };
        Layout(ShaderVisibility visibility = ShaderVisibility::All) : mVisibility(visibility) {}
        Layout& addRange(Type type, uint32_t baseRegIndex, uint32_t descriptorCount, uint32_t regSpace = 0);
        size_t getRangeCount() const { return mRanges.size(); }
        const Range& getRange(size_t index) const { return mRanges[index]; }
        ShaderVisibility getVisibility() const { return mVisibility; }
    private:
        std::vector<Range> mRanges;
        ShaderVisibility mVisibility;
    };
    /** Create a new descriptor set.
        \param[in] pPool The descriptor pool.
        \param[in] layout The layout.
        \return A new object, or throws an exception if creation failed.
    */
    static SharedPtr create(const DescriptorPool::SharedPtr& pPool, const Layout& layout);
    size_t getRangeCount() const { return mLayout.getRangeCount(); }
    const Layout::Range& getRange(uint32_t range) const { return mLayout.getRange(range); }
    ShaderVisibility getVisibility() const { return mLayout.getVisibility(); }
    CpuHandle getCpuHandle(uint32_t rangeIndex, uint32_t descInRange = 0) const;
    GpuHandle getGpuHandle(uint32_t rangeIndex, uint32_t descInRange = 0) const;
    const ApiHandle& getApiHandle() const { return mApiHandle; }
    const ApiData* getApiData() const { return mpApiData.get(); }
    void setSrv(uint32_t rangeIndex, uint32_t descIndex, const ShaderResourceView* pSrv);
    void setUav(uint32_t rangeIndex, uint32_t descIndex, const UnorderedAccessView* pUav);
    void setSampler(uint32_t rangeIndex, uint32_t descIndex, const Sampler* pSampler);
    void setCbv(uint32_t rangeIndex, uint32_t descIndex, ConstantBufferView* pView);
    void bindForGraphics(CopyContext* pCtx, const RootSignature* pRootSig, uint32_t rootIndex);
    void bindForCompute(CopyContext* pCtx, const RootSignature* pRootSig, uint32_t rootIndex);
private:
    DescriptorSet(DescriptorPool::SharedPtr pPool, const Layout& layout);
    void apiInit();
    Layout mLayout;
    std::shared_ptr<ApiData> mpApiData;
    DescriptorPool::SharedPtr mpPool;
    ApiHandle mApiHandle = {};
};





Add Discussion as Guest

Log in