Class RenderPass

Synopsis

#include <Source/Falcor/RenderGraph/RenderPass.h>

class dlldecl RenderPass : public std::enable_shared_from_this<RenderPass>

Description

Base class for render passes.

Render passes are expected to implement a static create() function that returns a shared pointer to a new object, or throws an exception if creation failed. The constructor should be private to force creation of shared pointers.

Render passes are inserted in a render graph, which is executed at runtime. Each render pass declares its I/O requirements in the reflect() function, and as part of the render graph compilation their compile() function is called. At runtime, execute() is called each frame to generate the pass outputs.

Mentioned in

Inheritance

Ancestors: std::enable_shared_from_this< RenderPass >

Decsendents: PathTracer, ResolvePass

Structures

CompileData

Mentioned in

  • Tutorials / 02 Implementing A Render Pass / reflect()

Methods

RenderPass
~RenderPass
compileWill be called during graph compilation
executeExecutes the pass.
getDescGet a string describing what the pass is doing
getNameGet the current pass' name as defined in the graph
getScriptingDictionaryGet a dictionary that can be used to reconstruct the object
onHotReloadCalled upon hot reload (by pressing F5).
onKeyEventKeyboard event handler Returns true if the event was handled by the object, false otherwise
onMouseEventMouse event handler
reflectCalled once before compilation
renderUIRender the pass's UI
setSceneSet a scene into the render-pass

Source

Lines 90-156 in Source/Falcor/RenderGraph/RenderPass.h.

class dlldecl RenderPass : public std::enable_shared_from_this<RenderPass>
{
public:
    using SharedPtr = std::shared_ptr<RenderPass>;
    virtual ~RenderPass() = default;
    struct CompileData
    {
        RenderPassReflection connectedResources;
        uint2 defaultTexDims;
        ResourceFormat defaultTexFormat;
    };
    /** Called once before compilation. Describes I/O requirements of the pass.
        The requirements can't change after the graph is compiled. If the IO requests are dynamic, you'll need to trigger compilation of the render-graph yourself.
    */
    virtual RenderPassReflection reflect(const CompileData& compileData) = 0;
    /** Will be called during graph compilation. You should throw an exception in case the compilation failed
    */
    virtual void compile(RenderContext* pContext, const CompileData& compileData) {}
    /** Executes the pass.
    */
    virtual void execute(RenderContext* pRenderContext, const RenderData& renderData) = 0;
    /** Get a dictionary that can be used to reconstruct the object
    */
    virtual Dictionary getScriptingDictionary() { return {}; }
    /** Get a string describing what the pass is doing
    */
    virtual std::string getDesc() = 0;
    /** Render the pass's UI
    */
    virtual void renderUI(Gui::Widgets& widget) {}
    /** Set a scene into the render-pass
    */
    virtual void setScene(RenderContext* pRenderContext, const std::shared_ptr<Scene>& pScene) {}
    /** Mouse event handler.
        Returns true if the event was handled by the object, false otherwise
    */
    virtual bool onMouseEvent(const MouseEvent& mouseEvent) { return false; }
    /** Keyboard event handler
        Returns true if the event was handled by the object, false otherwise
    */
    virtual bool onKeyEvent(const KeyboardEvent& keyEvent) { return false; }
    /** Called upon hot reload (by pressing F5).
        \param[in] reloaded Resources that have been reloaded.
    */
    virtual void onHotReload(HotReloadFlags reloaded) {}
    /** Get the current pass' name as defined in the graph
    */
    const std::string& getName() const { return mName; }
protected:
    friend class RenderGraph;
    RenderPass() = default;
    std::string mName;
    std::function<void(void)> mPassChangedCB = [] {};
};





Add Discussion as Guest

Log in to DocsForge