On this page

QSSGFrameData Class

Storage class containing data collected for a frame. More...

Header: #include <qssgrenderextensions.h>
Since: Qt 6.7

Public Types

enum class AttachmentSelector { Attachment0, Attachment1, Attachment2, Attachment3, DepthAttachment }

Public Functions

QSSGCameraId activeCamera() const
QSSGNodeIdList getLayerNodes(QSSGCameraId cameraId, QSSGFrameData::TypeMask typeMask = NodeMask) const
QSSGNodeIdList getLayerNodes(quint32 layerMask, QSSGFrameData::TypeMask typeMask = NodeMask) const
QSSGRhiGraphicsPipelineState getPipelineState() const
(since 6.13) QSSGRhiResourceHandle getRhiResource(QSSGFrameData::RenderResult id) const
(since 6.13) QSSGRhiResourceHandle getRhiResource(QSSGResourceId resourceId) const
(since 6.13) QSSGRhiResourceHandle getRhiResource(QSSGResourceId userPassId, QSSGFrameData::AttachmentSelector attachment) const
void scheduleRenderResults(QSSGFrameData::RenderResults results) const

Detailed Description

Member Type Documentation

enum class QSSGFrameData::AttachmentSelector

Selects an attachment of a RenderPass.

ConstantValueDescription
QSSGFrameData::AttachmentSelector::Attachment00The first color attachment.
QSSGFrameData::AttachmentSelector::Attachment11The second color attachment.
QSSGFrameData::AttachmentSelector::Attachment22The third color attachment.
QSSGFrameData::AttachmentSelector::Attachment33The fourth color attachment.
QSSGFrameData::AttachmentSelector::DepthAttachment (since Qt 6.13)0x8000The depth attachment. This is a texture when the render pass uses a DepthTextureAttachment, otherwise the depth-stencil render buffer.

See also getRhiResource().

Member Function Documentation

QSSGCameraId QSSGFrameData::activeCamera() const

Returns The active camera for the scene, or null if non could be found.

QSSGNodeIdList QSSGFrameData::getLayerNodes(QSSGCameraId cameraId, QSSGFrameData::TypeMask typeMask = NodeMask) const

Returns A list of layer nodes for the given cameraId that match the typeMask. If the camera does not have a layer mask, an empty list is returned.

QSSGNodeIdList QSSGFrameData::getLayerNodes(quint32 layerMask, QSSGFrameData::TypeMask typeMask = NodeMask) const

Returns A list of layer nodes that match the layerMask and typeMask.

QSSGRhiGraphicsPipelineState QSSGFrameData::getPipelineState() const

Returns Base pipeline state for this frame

[since 6.13] QSSGRhiResourceHandle QSSGFrameData::getRhiResource(QSSGFrameData::RenderResult id) const

Returns A handle to the texture of the render result id, or an invalid handle if the result is not produced in the current frame.

The renderer only produces the results that something in the frame needs, so request the result with scheduleRenderResults() during QSSGRenderExtension::prepareData(), in every frame it is needed, and before calling this function. The texture contains the result once the pass producing it has run, so it is typically read by an extension with the Main render mode.

The handle can be kept across frames. The renderer can replace or rebuild the texture, for example when the size of the View3D changes, and can release it once the result is no longer produced. The handle then becomes invalid, so compare it with the result of a new call to find out whether the texture has changed, see QSSGRhiResourceHandle. In a frame where the result is not produced, this function returns an invalid handle even if a handle kept from an earlier frame is still valid, and the content of the texture is undefined.

This function was introduced in Qt 6.13.

See also scheduleRenderResults() and QSSGRhiResourceHandle.

[since 6.13] QSSGRhiResourceHandle QSSGFrameData::getRhiResource(QSSGResourceId resourceId) const

Returns A handle to the RHI resource currently backing the scene resource with the given resourceId, or an invalid handle if there is none.

resourceId identifies the scene resource, a ShaderImage or a ShaderStorageBuffer; use QQuick3DExtensionHelpers::getResourceId() to get it. For the attachments of a RenderPass, use the overload that takes an AttachmentSelector instead. The returned handle refers to the QRhiTexture or QRhiBuffer the renderer created for it, see QSSGRhiResourceHandle::texture() and QSSGRhiResourceHandle::buffer(). The scene resource keeps its id when the renderer replaces that RHI resource, so call this function again rather than storing the result; see Scene resources and RHI resources.

The resource is shared by every View3D in the window, independent of which one uses it. When called from QSSGRenderExtension::prepareData(), the resource is created, or recreated if the scene resource changed, before the handle is returned, so the handle refers to the resource used for the rest of the frame. For a ShaderStorageBuffer, new content from bufferData and a requestClear() are applied then as well. When called later in the frame, the function only looks up the resource and returns an invalid handle if no pass has used it yet. Pending changes are not applied then, and until a pass uses the resource, it can still have its previous size and content.

If the ShaderStorageBuffer has a buffer provider that has registered a buffer with QSSGRenderExtensionHelpers::registerRenderResultBuffer(), the handle refers to that buffer. It becomes invalid when the provider registers a different buffer, unregisters it or is destroyed. How long the buffer itself lives depends on its ownership.

The handle does not keep the resource alive. Check QSSGRhiResourceHandle::isValid() before using a handle kept from an earlier frame, and compare it with the result of a new call to find out whether the resource has been replaced.

Note: The content of the resource is only what the passes using it have written so far. To see what a ComputePass in the same View3D wrote this frame, read the resource from an extension that runs after the user passes, such as one with the Main render mode and the PostColor render stage. The order in which different View3Ds are rendered is not defined.

This function was introduced in Qt 6.13.

See also QSSGRhiResourceHandle.

[since 6.13] QSSGRhiResourceHandle QSSGFrameData::getRhiResource(QSSGResourceId userPassId, QSSGFrameData::AttachmentSelector attachment) const

Returns A handle to the attachment of the RenderPass with the given userPassId, or an invalid handle if the render pass has no such attachment.

For a color attachment, QSSGRhiResourceHandle::texture() returns the texture. For DepthAttachment, the handle refers to a texture if the render pass has a DepthTextureAttachment, and to a render buffer, returned by QSSGRhiResourceHandle::renderBuffer(), otherwise.

The handle can be kept across frames. It becomes invalid when the render pass replaces the attachment, for example when the size of the View3D changes, or when the render pass is destroyed. Compare it with the result of a new call to find out whether the attachment has changed, see QSSGRhiResourceHandle.

This function was introduced in Qt 6.13.

See also getAttachmentCount() and QSSGRhiResourceHandle.

void QSSGFrameData::scheduleRenderResults(QSSGFrameData::RenderResults results) const

Schedule the given results to be made available for this frame.

This function should only be called during the prepare phase in QSSGRenderExtension::prepareData().

Note: The requested results might not be available if the underlying layer does not support them or if the layer does not contain any data that would make it necessary to produce the requested results, in which case getRhiResource() returns an invalid handle.

See also getRhiResource().

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.