Creates an instance of the FramePass.
The graphics device.
Frame passes which need to be executed after this pass. This pass does not own them, and does not destroy them: whoever adds a pass to the list destroys it.
Frame passes which need to be executed before this pass. The engine does not change this list, so the passes in it execute every frame this pass executes. This pass does not own them, and does not destroy them: whoever adds a pass to the list destroys it.
The graphics device.
True if the frame pass is enabled and execute function will be called. Note that before and after functions are called regardless of this flag. Set it before the frame renders, at the latest in frameUpdate, as the frame graph decides which passes to merge from it.
Called when the pass renders, right after it executes: for a render pass once its GPU render pass has ended, and after FramePass#after. The results the pass writes can be read back here, as a read records its copy when it is requested, and so right after the pass. Reads should not be immediate, as that submits the work of the frame recorded so far. Like after, it is called even if FramePass#executeEnabled is false, but not when the pass is disabled. A render pass with this callback is not merged with the pass after it into a single GPU render pass, so the callback runs outside of one.
Called when the pass renders, right before it executes: after FramePass#before, and for a render pass before its GPU render pass starts. Work recorded here, such as setting the parameters of the pass, or clearing a buffer it writes to, executes right before the pass. Like before, it is called even if FramePass#executeEnabled is false, but not when the pass is disabled. A render pass with this callback is not merged with the pass before it into a single GPU render pass, so the callback runs outside of one.
Gets whether the frame pass is enabled.
Sets whether the frame pass is enabled. A disabled pass is skipped when the frame is built, together with its FramePass#beforePasses and FramePass#afterPasses, and its frameUpdate is not called. To skip only the execution of the pass, while still updating it and its before and after passes, use FramePass#executeEnabled instead. Change it before the frame is built: the frameUpdate of a pass, or of its before-passes, cannot disable the pass itself. Defaults to true.
Gets the name of the pass.
Sets the name of the pass, which identifies it in debug output, GPU profiling and graphics debuggers. Defaults to the name of its class, which minified builds can shorten, so set it explicitly for a readable name.
Called while the pass renders, after FramePass#execute. It is called even when FramePass#executeEnabled is false and the pass did not execute, so an override using the results of the execution can skip that work while executeEnabled is false.
Called while the pass renders, before FramePass#execute. It is called even when FramePass#executeEnabled is false and the pass does not execute, so an override preparing only for the execution can skip that work while executeEnabled is false.
Releases the resources the pass created. A pass owns only what it creates: it does not
destroy its FramePass#beforePasses and FramePass#afterPasses, which are
destroyed by whoever added them. The code which creates a pass destroys it, once, and the
pass is not used after that - in debug builds, adding a destroyed pass to a frame reports an
error. Subclasses releasing their own resources call super.destroy().
Records the work of the pass. Called while the frame renders, between FramePass#before and FramePass#after, and only while FramePass#executeEnabled is true. For a RenderPass, it runs inside the GPU render pass, which starts right before it.
Called each frame the pass is added to the frame, while the frame is built and before anything renders, and before its FramePass#beforePasses and FramePass#afterPasses are added. Override to update the pass for the frame, for example to resize its render targets, to set the textures it reads, to add or remove its before and after passes and enable or disable them, or to set its FramePass#executeEnabled. It cannot disable the pass itself. It is not called for a disabled pass, nor when the pass is rendered on its own with FramePass#render.
Called when the pass is disabled, by setting FramePass#enabled to false while it is true. Override to release what the pass does not need while it is disabled, such as its render targets.
Called when the pass is enabled, by setting FramePass#enabled to true while it is false. Override to recreate what FramePass#onDisable released.
Renders the pass: calls FramePass#before and FramePass#onBefore, then FramePass#execute while FramePass#executeEnabled is true, and then FramePass#after and FramePass#onAfter. It does nothing while the pass is disabled. The frame graph calls this for each pass in the frame.
It can also be called directly, to render the pass on its own, outside of a frame, for example to render into a texture once. The pass is then not prepared the way a frame prepares it: its FramePass#frameUpdate is not called, its before and after passes do not render, and the frame graph does not merge it with neighbouring passes, nor ask it to store the attachments a later pass loads. A RenderPass rendered on its own keeps the textures of its render target: its color buffers, resolved when multisampled, and its depth buffer texture. It does not keep the samples of a multisampled attachment, the stencil, or a depth buffer its render target creates internally, unless it is set to store them with RenderPass#setStoreColor, RenderPass#setStoreDepth and RenderPass#setStoreStencil.
A frame pass represents a node in the frame graph. It encapsulates a unit of work that executes during frame rendering. Subclasses include RenderPass for GPU render passes with render targets, and non-rendering passes for compute dispatches or other tasks.
In each frame a pass is part of, for example as a frame pass of a camera, or as a before or after pass of another pass, it goes through these steps:
A pass can also be rendered on its own, outside of a frame, by calling FramePass#render.