- Qt 6.12
- Qt Quick 3D
- C++ Classes
- QSSGRenderExtension
- Qt Quick 3D | Commercial or GPLv3

# QSSGRenderExtension Class

Base class for extension backend node implementations. More...

Header: | `#include <qssgrenderextensions.h>`
Since: | Qt 6.7
Inherited By: | QSSGRenderTextureProviderExtension

- List of all members, including inherited members

## Public Types

enum class | RenderMode { Standalone, Main }
enum class | RenderStage { PreColor, PostColor }

## Public Functions

virtual QSSGRenderExtension::RenderMode | mode() const = 0
virtual bool | prepareData(QSSGFrameData &data) = 0
virtual void | prepareRender(QSSGFrameData &data) = 0
virtual void | render(QSSGFrameData &data) = 0
virtual void | resetForFrame() = 0
virtual QSSGRenderExtension::RenderStage | stage() const = 0

## Protected Functions

| QSSGRenderExtension(QSSGRenderGraphObject::Type inType, QSSGRenderGraphObject::FlagT inFlags)

## Detailed Description

See also QQuick3DRenderExtension.

## Member Type Documentation

### enum class QSSGRenderExtension::RenderMode

Specifies the render extension mode.

Constant | Value | Description
--- | --- | ---
`QSSGRenderExtension::RenderMode::Standalone` | `0` | The rendering code is recorded in full during the render prepare phase. This will usually imply that there are some output crated for a preceding render extension(s). When this mode is used the prepareRender() and render() functions are both called during the frame's prepare phase.
`QSSGRenderExtension::RenderMode::Main` | `1` | The rendering code is recorded within the main render pass. In this mode the prepareRender() is called in the frame's prepare phase while render() is called the frame's render phase.

### enum class QSSGRenderExtension::RenderStage

Specifies the order the extension will be called.

Constant | Value | Description
--- | --- | ---
`QSSGRenderExtension::RenderStage::PreColor` | `0` | The rendering code is recorded and executed before the main (color) pass.
`QSSGRenderExtension::RenderStage::PostColor` | `1` | The rendering code is recorded and executed after the main (color) pass. Note: The RenderStage is only relevant when the RenderMode is set to Main.

## Member Function Documentation

### `[protected]` QSSGRenderExtension::QSSGRenderExtension(QSSGRenderGraphObject::Type inType, QSSGRenderGraphObject::FlagT inFlags)

Constructor that allows users to specifying a user-type and flags for an extension.

Note: For user-defined extensions the type must be a combination of QSSGRenderGraphObject::BaseType::User and a value between 0 and 4095.

Note: The QSSGRenderGraphObject::BaseType::Extension type is automatically added to the given inType.

Note: The inFlags must include Flags::HasGraphicsResources if the extension allocates graphics resources.

### `[pure virtual]` QSSGRenderExtension::RenderMode QSSGRenderExtension::mode() const

Returns The render mode used for this extension.

### `[pure virtual]` bool QSSGRenderExtension::prepareData(QSSGFrameData &data)

Called after scene data is collected, but before any render data or rendering in the current frame has been done.

Returns Dirty state. Return `true` if the there are dirty data that needs to be rendered.

Note: Much of the data created/collected from the engine during the prepare and render phases is per-frame and should be released or assumed released at the start of the next frame

See also QSSGFrameData.

### `[pure virtual]` void QSSGRenderExtension::prepareRender(QSSGFrameData &data)

Prepare data for rendering. Build and collect data needed for rendering. Any render extension scheduled before this one has been processed. In addition; any render extension of mode RenderMode::Standalone will, if successful, have been completed in full.

Note: Much of the data created/collected from the engine during the prepare and render phases is per-frame and should be released or assumed released at the start of the next frame

See also QSSGFrameData.

### `[pure virtual]` void QSSGRenderExtension::render(QSSGFrameData &data)

Record the render pass. Depending on the extensions mode this function will be called during the frame's prepare or render phase.

Use data to gain access to the render context from which the active QRhi object can be queried.

See also QSSGRenderExtension::RenderMode.

### `[pure virtual]` void QSSGRenderExtension::resetForFrame()

Called each time a new frame starts. Any data from the previous frame should be cleared at this point.

### `[pure virtual]` QSSGRenderExtension::RenderStage QSSGRenderExtension::stage() const

Returns The stage in which this render extension will be used.