Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrenderextensions.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
7#include "private/qssgassert_p.h"
8#include "private/qssglayerrenderdata_p.h"
9#include "private/qssgrenderimage_p.h"
10#include "private/qssgrenderbuffer_p.h"
11#include "private/qssgrenderbuffermanager_p.h"
12#include "private/qssgrhicontext_p.h"
15
17
18/*!
19 \class QSSGFrameData
20 \inmodule QtQuick3D
21 \since 6.7
22
23 \brief Storage class containing data collected for a frame.
24*/
25
26/*!
27 \enum QSSGFrameData::AttachmentSelector
28
29 Selects an attachment of a \l {QtQuick3D::RenderPass}{RenderPass}.
30
31 \value Attachment0 The first color attachment.
32 \value Attachment1 The second color attachment.
33 \value Attachment2 The third color attachment.
34 \value Attachment3 The fourth color attachment.
35 \value [since 6.13] DepthAttachment The depth attachment. This is a
36 texture when the render pass uses a DepthTextureAttachment, otherwise
37 the depth-stencil render buffer.
38
39 \sa getRhiResource()
40*/
41
43{
44 return QSSGRhiContextPrivate::get(ctx.rhiContext().get())->resourceRegistry();
45}
46
47// The render target of the user pass with the given id in the layer being
48// rendered, or null.
50{
51 QSSGRenderUserPass *userPassNode = QSSGRenderGraphObjectUtils::getResource<QSSGRenderUserPass>(userPassId);
52 QSSG_ASSERT(userPassNode && userPassNode->type == QSSGRenderGraphObject::Type::RenderPass, return {});
53
54 auto *data = QSSGLayerRenderData::getCurrent(*ctx.renderer());
55 if (QSSG_GUARD(data))
56 return data->requestUserRenderPassManager()->getUserPassTexureResult(*userPassNode);
57
58 return {};
59}
60
61#if QT_DEPRECATED_SINCE(6, 13)
62/*!
63 \deprecated [6.13] Use getRhiResource() instead.
64
65 \return The renderable texture result from \a id. \nullptr if no matching \a id was found.
66
67 \note Even if the function returns a non-null result, the returned QSSGRhiRenderableTexture
68 might not be ready unless the pass rendering to the texture has been executed.
69
70 \note The returned value is only valid within the current frame. On each new frame
71 the renderable will be reset and should therefore be queried again.
72
73 \sa getRhiResource()
74*/
75QT_WARNING_PUSH
76QT_WARNING_DISABLE_DEPRECATED
77QSSGFrameData::Result QSSGFrameData::getRenderResult(RenderResult id) const
78{
79 const QSSGRhiRenderableTexture *res = nullptr;
80 auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
81 const auto resultKey = QSSGRenderResult::toInternalRenderResultKey(id);
82 if (QSSG_GUARD(data && (std::size(data->renderResults) > size_t(resultKey))))
83 res = data->getRenderResult(resultKey);
84
85 return res ? Result{ res->texture, res->depthStencil } : Result{};
86}
87QT_WARNING_POP
88#endif // QT_DEPRECATED_SINCE(6, 13)
89
90/*!
91 Schedule the given \a results to be made available for this frame.
92
93 This function should only be called during the prepare phase in \l QSSGRenderExtension::prepareData().
94
95 \note The requested results might not be available if the underlying layer does not support
96 them or if the layer does not contain any data that would make it necessary to produce the
97 requested results, in which case \l getRhiResource() returns an invalid handle.
98
99 \sa getRhiResource()
100*/
101
102void QSSGFrameData::scheduleRenderResults(RenderResults results) const
103{
104 auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
105 QSSG_ASSERT(data, return);
106
107 auto &prepResult = data->layerPrepResult;
108
109 if (prepResult.getState() != QSSGLayerRenderPreparationResult::State::DataPrep) {
110 qWarning("QSSGFrameData::requestRenderResults: "
111 "Requesting render results should only be done during the prepare phase in prepareData().");
112 return;
113 }
114
115 if (results.testFlag(QSSGFrameData::RenderResult::DepthTexture))
116 prepResult.flags.setRequiresDepthTexture(true);
117 if (results.testFlag(QSSGFrameData::RenderResult::ScreenTexture))
118 prepResult.flags.setRequiresScreenTexture(true);
119 if (results.testFlag(RenderResult::AoTexture)) {
120 // NOTE: AO depends on the depth texture
121 prepResult.flags.setRequiresSsaoPass(true);
122 prepResult.flags.setRequiresDepthTexture(true);
123 }
124 if (results.testFlag(RenderResult::NormalTexture))
125 prepResult.flags.setRequiresNormalTexture(true);
126}
127
128qsizetype QSSGFrameData::getAttachmentCount(QSSGResourceId userPassId) const
129{
130 QSSGRenderUserPass *userPassNode = QSSGRenderGraphObjectUtils::getResource<QSSGRenderUserPass>(userPassId);
131 QSSG_ASSERT(userPassNode && userPassNode->type == QSSGRenderGraphObject::Type::RenderPass, return 0);
132
133 QSSGRhiRenderableTextureV2Ptr res;
134 auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
135 if (QSSG_GUARD(data))
136 res = data->requestUserRenderPassManager()->getUserPassTexureResult(*userPassNode);
137
138 // There is no render target until the render pass has been prepared.
139 return res ? qsizetype(res->colorAttachmentCount()) : 0;
140}
141
142#if QT_DEPRECATED_SINCE(6, 13)
143/*!
144 \deprecated [6.13] Use getRhiResource() instead.
145
146 \return The renderable texture result from a user defined render pass with the given \a userPassId.
147 If no matching user pass could be found, or if the user pass did not produce any renderable textures,
148 an invalid Result is returned. Returns only depth texture and depth-stencil buffer if \a attachment
149 is \c AttachmentSelector::DepthAttachment.
150
151 \note Even if the function returns a non-null result, the returned QSSGRhiRenderableTexture
152 might not be ready unless the pass rendering to the texture has been executed.
153
154 \note The returned value is only valid within the current frame. On each new frame
155 the renderable will be reset and should therefore be queried again.
156
157 \sa getRhiResource()
158*/
159QT_WARNING_PUSH
160QT_WARNING_DISABLE_DEPRECATED
161QSSGFrameData::Result QSSGFrameData::getRenderResult(QSSGResourceId userPassId, AttachmentSelector attachment) const
162{
163 const QSSGRhiRenderableTextureV2Ptr res = userPassRenderTarget(*m_ctx, userPassId);
164 if (!res || !res->isValid())
165 return {};
166
167 if (attachment == AttachmentSelector::DepthAttachment)
168 return { res->getDepthTexture().texture(), res->getDepthStencil().get() };
169
170 const quint32 attachmentSelector = static_cast<quint32>(attachment);
171 if (const qsizetype attachmentCount = res->colorAttachmentCount(); attachmentCount > qsizetype(attachmentSelector))
172 return { res->getColorTexture(attachmentSelector).texture(), res->getDepthStencil().get() };
173
174 qWarning() << "Requested attachment" << attachmentSelector << "but user pass only has" << res->colorAttachmentCount() << "attachments.";
175 return {};
176}
177QT_WARNING_POP
178#endif // QT_DEPRECATED_SINCE(6, 13)
179
180// Whether the result is produced in the current frame, either because it was
181// scheduled or because the renderer needs it itself.
182static bool isRenderResultRequired(const QSSGLayerRenderPreparationResultFlags &flags,
183 QSSGFrameData::RenderResult id)
184{
185 switch (id) {
186 case QSSGFrameData::RenderResult::AoTexture:
187 return flags.requiresSsaoPass();
188 case QSSGFrameData::RenderResult::DepthTexture:
189 return flags.requiresDepthTexture();
190 case QSSGFrameData::RenderResult::ScreenTexture:
191 return flags.requiresScreenTexture();
192 case QSSGFrameData::RenderResult::NormalTexture:
193 return flags.requiresNormalTexture();
194 case QSSGFrameData::RenderResult::MotionVectorTexture:
195 return flags.requiresMotionVectorPass();
196 }
197 return false;
198}
199
200/*!
201 \return A handle to the texture of the render result \a id, or an invalid
202 handle if the result is not produced in the current frame.
203
204 The renderer only produces the results that something in the frame needs,
205 so request the result with scheduleRenderResults() during
206 \l QSSGRenderExtension::prepareData(), in every frame it is needed, and
207 before calling this function. The texture contains the result once the
208 pass producing it has run, so it is typically read by an extension with
209 the \c Main \l {QSSGRenderExtension::RenderMode}{render mode}.
210
211 The handle can be kept across frames. The renderer can replace or rebuild
212 the texture, for example when the size of the View3D changes, and can
213 release it once the result is no longer produced. The handle then becomes
214 invalid, so compare it with the result of a new call to find out whether
215 the texture has changed, see QSSGRhiResourceHandle. In a frame where the
216 result is not produced, this function returns an invalid handle even if a
217 handle kept from an earlier frame is still valid, and the content of the
218 texture is undefined.
219
220 \since 6.13
221 \sa scheduleRenderResults(), QSSGRhiResourceHandle
222*/
223QSSGRhiResourceHandle QSSGFrameData::getRhiResource(RenderResult id) const
224{
225 const auto resultKey = QSSGRenderResult::toInternalRenderResultKey(id);
226 if (size_t(resultKey) > size_t(QSSGRenderResult::Key::MotionVectorTexture)) {
227 qWarning("QSSGFrameData::getRhiResource: Unknown render result %u.", quint32(id));
228 return {};
229 }
230
231 auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
232 if (!QSSG_GUARD(data))
233 return {};
234
235 // The texture of a result is not released as soon as the result is no
236 // longer produced, so only hand it out in the frames where it is, and a
237 // valid handle never refers to the result of an earlier frame.
238 if (!isRenderResultRequired(data->layerPrepResult.getFlags(), id))
239 return {};
240
241 return resourceRegistry(*m_ctx).handle(data->getRenderResult(resultKey)->texture);
242}
243
244/*!
245 \return A handle to the \a attachment of the
246 \l {QtQuick3D::RenderPass}{RenderPass} with the given \a userPassId, or
247 an invalid handle if the render pass has no such attachment.
248
249 For a color attachment, QSSGRhiResourceHandle::texture() returns the
250 texture. For \l {QSSGFrameData::AttachmentSelector}{DepthAttachment}, the
251 handle refers to a texture if the render pass has a DepthTextureAttachment,
252 and to a render buffer, returned by QSSGRhiResourceHandle::renderBuffer(),
253 otherwise.
254
255 The handle can be kept across frames. It becomes invalid when the render
256 pass replaces the attachment, for example when the size of the View3D
257 changes, or when the render pass is destroyed. Compare it with the result
258 of a new call to find out whether the attachment has changed, see
259 QSSGRhiResourceHandle.
260
261 \since 6.13
262 \sa getAttachmentCount(), QSSGRhiResourceHandle
263*/
264QSSGRhiResourceHandle QSSGFrameData::getRhiResource(QSSGResourceId userPassId, AttachmentSelector attachment) const
265{
266 const QSSGRhiRenderableTextureV2Ptr res = userPassRenderTarget(*m_ctx, userPassId);
267 if (!res || !res->isValid())
268 return {};
269
270 auto &registry = resourceRegistry(*m_ctx);
271 if (attachment == AttachmentSelector::DepthAttachment) {
272 if (const auto &depthTexture = res->getDepthTexture(); depthTexture.isValid())
273 return registry.handle(depthTexture.texture());
274 return registry.handle(res->getDepthStencil().get());
275 }
276
277 const size_t index = static_cast<size_t>(attachment);
278 if (index < res->colorAttachmentCount())
279 return registry.handle(res->getColorTexture(int(index)).texture());
280
281 qWarning("QSSGFrameData::getRhiResource: Requested attachment %zu, but the render pass only has %zu.",
282 index, res->colorAttachmentCount());
283 return {};
284}
285
286/*!
287 \return A handle to the RHI resource currently backing the scene resource
288 with the given \a resourceId, or an invalid handle if there is none.
289
290 \a resourceId identifies the scene resource, a
291 \l {QtQuick3D::ShaderImage}{ShaderImage} or a
292 \l {QtQuick3D::ShaderStorageBuffer}{ShaderStorageBuffer}; use
293 \l QQuick3DExtensionHelpers::getResourceId() to get it. For the
294 attachments of a \l {QtQuick3D::RenderPass}{RenderPass}, use the overload
295 that takes an AttachmentSelector instead. The returned handle refers to
296 the QRhiTexture or QRhiBuffer the renderer created for it, see
297 QSSGRhiResourceHandle::texture() and QSSGRhiResourceHandle::buffer().
298 The scene resource keeps its id when the renderer replaces that RHI
299 resource, so call this function again rather than storing the result; see
300 \l {QSSGRhiResourceHandle#Scene resources and RHI resources}{Scene resources and RHI resources}.
301
302 The resource is shared by every View3D in the window, independent of which
303 one uses it. When called from \l QSSGRenderExtension::prepareData(), the
304 resource is created, or recreated if the scene resource changed, before the
305 handle is returned, so the handle refers to the resource used for the rest
306 of the frame. For a ShaderStorageBuffer, new content from
307 \l {QtQuick3D::ShaderStorageBuffer::bufferData}{bufferData} and a
308 \l {QtQuick3D::ShaderStorageBuffer::requestClear()}{requestClear()} are
309 applied then as well. When called later in the frame, the function only
310 looks up the resource and returns an invalid handle if no pass has used it
311 yet. Pending changes are not applied then, and until a pass uses the
312 resource, it can still have its previous size and content.
313
314 If the ShaderStorageBuffer has a
315 \l {QtQuick3D::ShaderStorageBuffer::bufferProvider}{buffer provider} that
316 has registered a buffer with
317 \l QSSGRenderExtensionHelpers::registerRenderResultBuffer(), the handle
318 refers to that buffer. It becomes invalid when the provider registers a
319 different buffer, unregisters it or is destroyed. How long the buffer
320 itself lives depends on its
321 \l {QSSGRenderExtensionHelpers::ResultOwnership}{ownership}.
322
323 The handle does not keep the resource alive. Check
324 QSSGRhiResourceHandle::isValid() before using a handle kept from an
325 earlier frame, and compare it with the result of a new call to find out
326 whether the resource has been replaced.
327
328 \note The content of the resource is only what the passes using it have
329 written so far. To see what a ComputePass in the same View3D wrote this
330 frame, read the resource from an extension that runs after the user
331 passes, such as one with the \c Main
332 \l {QSSGRenderExtension::RenderMode}{render mode} and the \c PostColor
333 \l {QSSGRenderExtension::RenderStage}{render stage}. The order in which
334 different View3Ds are rendered is not defined.
335
336 \since 6.13
337 \sa QSSGRhiResourceHandle
338*/
339QSSGRhiResourceHandle QSSGFrameData::getRhiResource(QSSGResourceId resourceId) const
340{
341 if (resourceId == QSSGResourceId::Invalid)
342 return {};
343
344 auto *object = QSSGRenderGraphObjectUtils::getResource<QSSGRenderGraphObject>(resourceId);
345 QSSG_ASSERT(object, return {});
346
347 // Only create or recreate the resource during the data preparation, which
348 // runs outside of any render pass, so buffer uploads can be committed.
349 const auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
350 const bool load = data && data->layerPrepResult.getState() == QSSGLayerRenderPreparationResult::State::DataPrep;
351
352 const auto &bufferManager = m_ctx->bufferManager();
353 switch (object->type) {
354 case QSSGRenderGraphObject::Type::Image2D:
355 case QSSGRenderGraphObject::Type::ImageCube:
356 return bufferManager->shaderImageRhiResource(static_cast<QSSGRenderImage &>(*object), load);
357 case QSSGRenderGraphObject::Type::ShaderStorageBuffer: {
358 QSSGRhiResourceHandle resource = bufferManager->storageBufferRhiResource(static_cast<QSSGRenderBuffer &>(*object), load);
359 // Loading can queue an upload of the buffer data. Nothing else is
360 // guaranteed to commit it before an extension uses the buffer, so do
361 // it here, as the mesh uploads earlier in the preparation do.
362 if (load)
363 bufferManager->commitBufferResourceUpdates();
364 return resource;
365 }
366 default:
367 break;
368 }
369
370 if (object->type == QSSGRenderGraphObject::Type::RenderPass)
371 qWarning("QSSGFrameData::getRhiResource: The resource is a RenderPass; use the overload that takes an AttachmentSelector.");
372 else
373 qWarning("QSSGFrameData::getRhiResource: The resource is not a ShaderImage or a ShaderStorageBuffer.");
374 return {};
375}
376
377/*!
378 \internal
379*/
380void QSSGFrameData::scheduleRenderResults(QSSGResourceId userPassId) const
381{
382 QSSGRenderUserPassBase *userPassNode = QSSGRenderGraphObjectUtils::getResource<QSSGRenderUserPassBase>(userPassId);
383 QSSG_ASSERT(userPassNode && QSSGRenderGraphObjectUtils::isUserRenderPass(userPassNode->type), return);
384
385 QSSGLayerRenderData *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
386 if (QSSG_GUARD(data))
387 data->requestUserRenderPassManager()->scheduleUserPass(userPassNode);
388}
389
390/*!
391 \return Base pipeline state for this frame
392 */
393QSSGRhiGraphicsPipelineState QSSGFrameData::getPipelineState() const
394{
395 auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
396 QSSG_ASSERT(data, return {});
397 return data->getPipelineState();
398}
399
400/*!
401 \return The active camera for the scene, or null if non could be found.
402*/
403QSSGCameraId QSSGFrameData::activeCamera() const
404{
405 QSSGCameraId ret { QSSGCameraId::Invalid };
406 auto *data = QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
407 QSSG_ASSERT(data, return ret);
408 if (auto *ac = data->activeCamera())
409 ret = QSSGRenderGraphObjectUtils::getCameraId(*ac);
410
411 return ret;
412}
413
414QSSGRenderContextInterface *QSSGFrameData::contextInterface() const
415{
416 return m_ctx;
417}
418
419/*!
420 \return A list of layer nodes that match the \a layerMask and \a typeMask.
421 */
422QSSGNodeIdList QSSGFrameData::getLayerNodes(quint32 layerMask, TypeMask typeMask) const
423{
424 QSSG_ASSERT(m_ctx, return {});
425
426 auto *layer = getCurrent();
427 QSSG_ASSERT_X(layer, "No active layer for renderer!", return {});
428 const auto &layerNodes = layer->layerNodes;
429
430 return QSSGLayerRenderData::filter(layerNodes, layerMask, typeMask);;
431}
432
433/*!
434 \return A list of layer nodes for the given \a cameraId that match the \a typeMask.
435 If the camera does not have a layer mask, an empty list is returned.
436*/
437QSSGNodeIdList QSSGFrameData::getLayerNodes(QSSGCameraId cameraId, TypeMask typeMask) const
438{
439 auto *camera = QSSGRenderGraphObjectUtils::getNode<QSSGRenderCamera>(QSSGNodeId(cameraId));
440 const quint32 layerMask = camera ? camera->tag.value() : 0 /* LayerNone */;
441
442 return (layerMask != 0) ? getLayerNodes(layerMask, typeMask) : QSSGNodeIdList{};
443}
444
445void QSSGFrameData::clear()
446{
447
448}
449
450QSSGLayerRenderData *QSSGFrameData::getCurrent() const
451{
452 return QSSGLayerRenderData::getCurrent(*m_ctx->renderer());
453}
454
455QSSGFrameData::QSSGFrameData(QSSGRenderContextInterface *ctx)
456 : m_ctx(ctx)
457{
458
459}
460
461/*!
462 \class QSSGRenderExtension
463 \inmodule QtQuick3D
464 \since 6.7
465
466 \brief Base class for extension backend node implementations.
467
468 \sa QQuick3DRenderExtension
469*/
470
471/*!
472 Constructor that allows users to specifying a user-type and flags for an extension.
473
474 \note For user-defined extensions the type must be a combination of QSSGRenderGraphObject::BaseType::User
475 and a value between 0 and 4095.
476
477 \note The QSSGRenderGraphObject::BaseType::Extension type is automatically added to the given \a inType.
478
479 \note The \a inFlags must include Flags::HasGraphicsResources if the extension
480 allocates graphics resources.
481
482 */
483QSSGRenderExtension::QSSGRenderExtension(Type inType, FlagT inFlags)
484 : QSSGRenderGraphObject(static_cast<Type>(TypeT(inType) | TypeT(QSSGRenderGraphObject::BaseType::Extension)), inFlags)
485{
486 Q_ASSERT_X((QSSGRenderGraphObjectUtils::getBaseType(type) == QSSGRenderGraphObject::BaseType::Extension) ||
487 (QSSGRenderGraphObjectUtils::getBaseType(type) == (QSSGRenderGraphObject::BaseType::Extension | QSSGRenderGraphObject::BaseType::User)),
488 "QSSGRenderExtension()",
489 "The type must be a combination of QSSGRenderGraphObject::BaseType::Extension "
490 "and optionally QSSGRenderGraphObject::BaseType::User.");
491}
492
493QSSGRenderExtension::QSSGRenderExtension()
494 : QSSGRenderGraphObject(QSSGRenderGraphObject::Type::RenderExtension, FlagT(Flags::HasGraphicsResources))
495{
496
497}
498
499QSSGRenderExtension::~QSSGRenderExtension()
500{
501
502}
503
504/*!
505 \enum QSSGRenderExtension::RenderMode
506
507 Specifies the render extension mode.
508
509 \value Standalone The rendering code is recorded in full during the render prepare phase.
510 This will usually imply that there are some output crated for a preceding render extension(s).
511 When this mode is used the \l prepareRender() and \l render() functions are both called during
512 the frame's prepare phase.
513
514 \value Main The rendering code is recorded within the main render pass. In this mode the
515 \l prepareRender() is called in the frame's prepare phase while \l render() is called the frame's render phase.
516
517*/
518
519/*!
520 \enum QSSGRenderExtension::RenderStage
521
522 Specifies the order the extension will be called.
523
524 \value PreColor The rendering code is recorded and executed before the main (color) pass.
525 \value PostColor The rendering code is recorded and executed after the main (color) pass.
526
527 \note The \l RenderStage is only relevant when the \l RenderMode is set to \l {RenderMode::Main}{Main}.
528*/
529
530
531/*!
532 Called after scene \a data is collected, but before any render data or rendering in the current
533 frame has been done.
534
535 \return Dirty state. Return \c true if the there are dirty data
536 that needs to be rendered.
537
538 \note Much of the data created/collected from the engine during the prepare and render phases
539 is per-frame and should be released or assumed released at the start of the next frame
540
541 \sa QSSGFrameData
542*/
543bool QSSGRenderExtension::prepareData(QSSGFrameData &data)
544{
545 Q_UNUSED(data);
546 return false;
547}
548
549/*!
550 Prepare data for rendering. Build and collect \a data needed for rendering. Any render extension
551 scheduled before this one has been processed. In addition; any render extension of
552 mode \l RenderMode::Standalone will, if successful, have been completed in full.
553
554 \note Much of the data created/collected from the engine during the prepare and render phases
555 is per-frame and should be released or assumed released at the start of the next frame
556
557 \sa QSSGFrameData
558*/
559void QSSGRenderExtension::prepareRender(QSSGFrameData &data)
560{
561 Q_UNUSED(data);
562}
563
564/*!
565 Record the render pass. Depending on the extensions \l {RenderMode}{mode} this function will be called
566 during the frame's prepare or render phase.
567
568 Use \a data to gain access to the render context from which the active QRhi object can be queried.
569
570 \sa QSSGRenderExtension::RenderMode
571*/
572void QSSGRenderExtension::render(QSSGFrameData &data)
573{
574 Q_UNUSED(data);
575}
576
577/*!
578 Called each time a new frame starts. Any data from the previous frame should be cleared at
579 this point.
580*/
581void QSSGRenderExtension::resetForFrame()
582{
583
584}
585
586/*!
587 \return The render mode used for this extension.
588 */
589QSSGRenderExtension::RenderMode QSSGRenderExtension::mode() const
590{
591 return RenderMode::Main;
592}
593
594/*!
595 \return The stage in which this render extension will be used.
596*/
597QSSGRenderExtension::RenderStage QSSGRenderExtension::stage() const
598{
599 return RenderStage::PostColor;
600}
601
602/*!
603 \class QSSGRenderTextureProviderExtension
604 \inmodule QtQuick3D
605 \since 6.11
606
607 \brief Base class for texture providers backend node implementations.
608
609 \note This class is meant to be used together with \l QQuick3DTextureProviderExtension.
610 and the \l mode and \l stage is always \c Standalone and \c PostColor respectively.
611
612 \sa QQuick3DTextureProviderExtension
613*/
614
615QSSGRenderTextureProviderExtension::QSSGRenderTextureProviderExtension()
616 : QSSGRenderExtension(QSSGRenderGraphObject::Type::TextureProvider, FlagT(Flags::HasGraphicsResources) | FlagT(QSSGRenderGraphObjectUtils::InternalFlags::AutoRegisterExtension))
617{
618
619}
620
621QSSGRenderTextureProviderExtension::~QSSGRenderTextureProviderExtension()
622{
623
624}
625
626QSSGRenderExtension::RenderStage QSSGRenderTextureProviderExtension::stage() const { return QSSGRenderExtension::RenderStage::PreColor; }
627
628QSSGRenderExtension::RenderMode QSSGRenderTextureProviderExtension::mode() const { return QSSGRenderExtension::RenderMode::Standalone; }
629
630QT_END_NAMESPACE
friend class QSSGRenderContextInterface
Combined button and popup list for selecting options.
static QSSGRhiResourceRegistry & resourceRegistry(const QSSGRenderContextInterface &ctx)
static bool isRenderResultRequired(const QSSGLayerRenderPreparationResultFlags &flags, QSSGFrameData::RenderResult id)
static QSSGRhiRenderableTextureV2Ptr userPassRenderTarget(const QSSGRenderContextInterface &ctx, QSSGResourceId userPassId)