Class ComputeState


#include <Source/Falcor/Core/State/ComputeState.h>

class dlldecl ComputeState


Compute state. This class contains the entire state required by a single dispatch call. It's not an immutable object - you can change it dynamically during rendering. The recommended way to use it is to create multiple ComputeState objects (ideally, a single object per program)


createCreate a new state object.
getCSOGet the active compute state object
getProgramGet the currently bound program
operator=Copy constructor
setProgramBind a program to the pipeline


Lines 41-83 in Source/Falcor/Core/State/ComputeState.h.

class dlldecl ComputeState
    using SharedPtr = std::shared_ptr<ComputeState>;
    using SharedConstPtr = std::shared_ptr<const ComputeState>;
    ~ComputeState() = default;
    /** Create a new state object.
        \return A new object, or an exception is thrown if creation failed.
    static SharedPtr create() { return SharedPtr(new ComputeState()); }
    /** Copy constructor. Useful if you need to make minor changes to an already existing object
    SharedPtr operator=(const SharedPtr& other);
    /** Bind a program to the pipeline
    ComputeState& setProgram(const ComputeProgram::SharedPtr& pProgram) { mpProgram = pProgram; return *this; }
    /** Get the currently bound program
    ComputeProgram::SharedPtr getProgram() const { return mpProgram; }
    /** Get the active compute state object
    ComputeStateObject::SharedPtr getCSO(const ComputeVars* pVars);

    ComputeProgram::SharedPtr mpProgram;
    ComputeStateObject::Desc mDesc;
    struct CachedData
        const ProgramKernels* pProgramKernels = nullptr;
        const RootSignature* pRootSig = nullptr;
    CachedData mCachedData;
    using StateGraph = StateGraph<ComputeStateObject::SharedPtr, void*>;
    StateGraph::SharedPtr mpCsoGraph;

Add Discussion as Guest

Log in to DocsForge