Class GraphicsStateObject

Synopsis

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

class dlldecl GraphicsStateObject

Description

No description yet.

Classes

Desc

Methods

~GraphicsStateObject
createCreate a graphics state object.
getApiHandle
getDesc

Source

Lines 40-133 in Source/Falcor/Core/API/GraphicsStateObject.h.

class dlldecl GraphicsStateObject
{
public:
    using SharedPtr = std::shared_ptr<GraphicsStateObject>;
    using SharedConstPtr = std::shared_ptr<const GraphicsStateObject>;
    using ApiHandle = GraphicsStateHandle;
    static const uint32_t kSampleMaskAll = -1;
    /** Primitive topology
    */
    enum class PrimitiveType
    {
        Undefined,
        Point,
        Line,
        Triangle,
        Patch,
    };
    class dlldecl Desc
    {
    public:
        Desc& setRootSignature(RootSignature::SharedPtr pSignature) { mpRootSignature = pSignature; return *this; }
        Desc& setVertexLayout(VertexLayout::SharedConstPtr pLayout) { mpLayout = pLayout; return *this; }
        Desc& setFboFormats(const Fbo::Desc& fboFormats) { mFboDesc = fboFormats; return *this; }
        Desc& setProgramKernels(ProgramKernels::SharedConstPtr pProgram) { mpProgram = pProgram; return *this; }
        Desc& setBlendState(BlendState::SharedPtr pBlendState) { mpBlendState = pBlendState; return *this; }
        Desc& setRasterizerState(RasterizerState::SharedPtr pRasterizerState) { mpRasterizerState = pRasterizerState; return *this; }
        Desc& setDepthStencilState(DepthStencilState::SharedPtr pDepthStencilState) { mpDepthStencilState = pDepthStencilState; return *this; }
        Desc& setSampleMask(uint32_t sampleMask) { mSampleMask = sampleMask; return *this; }
        Desc& setPrimitiveType(PrimitiveType type) { mPrimType = type; return *this; }
        BlendState::SharedPtr getBlendState() const { return mpBlendState; }
        RasterizerState::SharedPtr getRasterizerState() const { return mpRasterizerState; }
        DepthStencilState::SharedPtr getDepthStencilState() const { return mpDepthStencilState; }
        ProgramKernels::SharedConstPtr getProgramKernels() const { return mpProgram; }
        ProgramVersion::SharedConstPtr getProgramVersion() const { return mpProgram->getProgramVersion(); }
        RootSignature::SharedPtr getRootSignature() const { return mpRootSignature; }
        uint32_t getSampleMask() const { return mSampleMask; }
        VertexLayout::SharedConstPtr getVertexLayout() const { return mpLayout; }
        PrimitiveType getPrimitiveType() const { return mPrimType; }
        Fbo::Desc getFboDesc() const { return mFboDesc; }
        bool operator==(const Desc& other) const;
    private:
        friend class GraphicsStateObject;
        Fbo::Desc mFboDesc;
        VertexLayout::SharedConstPtr mpLayout;
        ProgramKernels::SharedConstPtr mpProgram;
        RasterizerState::SharedPtr mpRasterizerState;
        DepthStencilState::SharedPtr mpDepthStencilState;
        BlendState::SharedPtr mpBlendState;
        uint32_t mSampleMask = kSampleMaskAll;
        RootSignature::SharedPtr mpRootSignature;
        PrimitiveType mPrimType = PrimitiveType::Undefined;
ef FALCOR_VK
    public:
        Desc& setVao(const Vao::SharedConstPtr& pVao) { mpVao = pVao; return *this; }
        Desc& setRenderPass(VkRenderPass renderPass) { mRenderPass = renderPass; return *this; }
        const Vao::SharedConstPtr& getVao() const { return mpVao; }
        VkRenderPass getRenderPass() const {return mRenderPass;}
    private:
        Vao::SharedConstPtr mpVao;
        VkRenderPass mRenderPass;
if
    };
    ~GraphicsStateObject();
    /** Create a graphics state object.
        \param[in] desc State object description.
        \return New object, or throws an exception if creation failed.
    */
    static SharedPtr create(const Desc& desc);
    const ApiHandle& getApiHandle() { return mApiHandle; }
    const Desc& getDesc() const { return mDesc; }
private:
    GraphicsStateObject(const Desc& desc);
    void apiInit();
    Desc mDesc;
    ApiHandle mApiHandle;
    // Default state objects
    static BlendState::SharedPtr spDefaultBlendState;
    static RasterizerState::SharedPtr spDefaultRasterizerState;
    static DepthStencilState::SharedPtr spDefaultDepthStencilState;
};





Add Discussion as Guest

Log in to DocsForge