17#include <QtQuick3DUtils/private/qquick3dprofiler_p.h>
19#include <QtQuick3DRuntimeRender/private/qssgrendererutil_p.h>
20#include <QtQuick3DRuntimeRender/private/qssgrenderer_p.h>
22#include <QtQuick/private/qquickwindow_p.h>
23#include <QtQuick/private/qsgdefaultrendercontext_p.h>
24#include <QtQuick/private/qsgtexture_p.h>
25#include <QtQuick/private/qsgplaintexture_p.h>
26#include <QtQuick/private/qsgrendernode_p.h>
28#include <QtQuick3DRuntimeRender/private/qssgrendereffect_p.h>
29#include <QtQuick3DRuntimeRender/private/qssgrhieffectsystem_p.h>
30#include <QtQuick3DRuntimeRender/private/qssglayerrenderdata_p.h>
31#include <QtQuick3DRuntimeRender/private/qssgrhiquadrenderer_p.h>
32#include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h>
33#include <QtQuick3DRuntimeRender/private/qssgcputonemapper_p.h>
34#include <QtQuick3DUtils/private/qssgutils_p.h>
35#include <QtQuick3DUtils/private/qssgassert_p.h>
38#include <qtquick3d_tracepoints_p.h>
40#include <QtCore/QObject>
41#include <QtCore/qqueue.h>
46 "QT_BEGIN_NAMESPACE" \
47 "class QQuick3DViewport;" \
62#if QT_CONFIG(qml_debug)
68 for (
const auto &pass :
info.renderPasses)
74#define STAT_PAYLOAD(stats) \
75 (statDrawCallCount(stats) | (quint64(stats.perLayerInfo[stats.layerKey].renderPasses.size()) << 32))
79template <
typename In,
typename Out>
80static void bfs(In *inExtension, QList<Out *> &outList)
84 QQueue<In *>
queue { { inExtension } };
85 while (
queue.size() > 0) {
86 if (
auto cur =
queue.dequeue()) {
88 outList.push_back(ext);
89 for (
auto &chld : cur->childItems())
90 queue.enqueue(qobject_cast<In *>(chld));
99 , invalidatePending(
false)
100 , devicePixelRatio(1)
147 if (
renderer->m_sgContext->rhiContext()->isValid()) {
149 bool needsNewWrapper =
false;
151 ||
texture()->rhiTexture() != rhiTexture))
153 needsNewWrapper =
true;
155 if (needsNewWrapper) {
159 t->setHasAlphaChannel(
true);
160 t->setTexture(rhiTexture);
172 if (
renderer->requestedFramesCount > 0) {
197 const auto &rhiCtx = m_sgContext->rhiContext();
199 m_sgContext->bufferManager()->releaseResourcesForLayer(m_layer);
204 releaseAaDependentRhiResources();
205 delete m_effectSystem;
208void QQuick3DSceneRenderer::releaseAaDependentRhiResources()
210 const auto &rhiCtx = m_sgContext->rhiContext();
211 if (!rhiCtx->isValid())
214 delete m_textureRenderTarget;
215 m_textureRenderTarget =
nullptr;
217 delete m_textureRenderPassDescriptor;
218 m_textureRenderPassDescriptor =
nullptr;
220 delete m_depthStencilBuffer;
221 m_depthStencilBuffer =
nullptr;
223 delete m_multiViewDepthStencilBuffer;
224 m_multiViewDepthStencilBuffer =
nullptr;
226 delete m_msaaRenderBuffer;
227 m_msaaRenderBuffer =
nullptr;
229 delete m_msaaMultiViewRenderBuffer;
230 m_msaaMultiViewRenderBuffer =
nullptr;
232 delete m_ssaaTexture;
233 m_ssaaTexture =
nullptr;
235 delete m_ssaaTextureToTextureRenderTarget;
236 m_ssaaTextureToTextureRenderTarget =
nullptr;
238 delete m_ssaaTextureToTextureRenderPassDescriptor;
239 m_ssaaTextureToTextureRenderPassDescriptor =
nullptr;
241 delete m_temporalAATexture;
242 m_temporalAATexture =
nullptr;
243 delete m_temporalAARenderTarget;
244 m_temporalAARenderTarget =
nullptr;
245 delete m_temporalAARenderPassDescriptor;
246 m_temporalAARenderPassDescriptor =
nullptr;
248 delete m_prevTempAATexture;
249 m_prevTempAATexture =
nullptr;
282 rhiCtxD->setMainRenderPassDescriptor(m_textureRenderPassDescriptor);
283 rhiCtxD->setRenderTarget(m_textureRenderTarget);
289 rhiCtxD->setCommandBuffer(
cb);
295 rhiCtxD->setCommandBuffer(
cb);
297 qWarning(
"Neither swapchain nor redirected command buffer are available.");
298 return currentTexture;
304 rhiCtxD->setMainPassSampleCount(m_msaaRenderBuffer ? m_msaaRenderBuffer->
sampleCount() :
305 (m_msaaMultiViewRenderBuffer ? m_msaaMultiViewRenderBuffer->
sampleCount() : 1));
309 int ssaaAdjustedWidth = m_surfaceSize.
width();
310 int ssaaAdjustedHeight = m_surfaceSize.
height();
312 ssaaAdjustedWidth *= m_ssaaMultiplier;
313 ssaaAdjustedHeight *= m_ssaaMultiplier;
318 float dpr = m_sgContext->renderer()->dpr();
319 const QRect vp =
QRect(0, 0, ssaaAdjustedWidth, ssaaAdjustedHeight);
328 Q_TRACE(QSSG_prepareFrame_exit);
331 Q_TRACE(QSSG_renderFrame_entry, ssaaAdjustedWidth, ssaaAdjustedHeight);
340 clearColor = m_layer->
firstEffect ? m_linearBackgroundColor : m_tonemappedBackgroundColor;
345 cb->beginPass(m_textureRenderTarget, clearColor, { 1.0f, 0 },
nullptr, rhiCtx->
commonPassFlags());
358 currentTexture = superSamplingAA ? m_ssaaTexture : m_texture;
362 const auto &
renderer = m_sgContext->renderer();
378 if ((progressiveAA || temporalAA) && m_prevTempAATexture) {
387 const auto &
renderer = m_sgContext->renderer();
392 const auto &shaderPipeline = m_sgContext->shaderCache()->getBuiltInRhiShaders().getRhiProgressiveAAShader();
397 const int ubufSize = 2 *
sizeof(float);
404 int idx = *aaIndex - 1;
406 rub->updateDynamicBuffer(ubuf, 0, 2 *
sizeof(
float), blendFactors);
407 renderer->rhiQuadRenderer()->prepareQuad(rhiCtx, rub);
419 const QSize textureSize = currentTexture->pixelSize();
424 blendResult = m_temporalAATexture;
426 blendResult = m_prevTempAATexture;
430 blendResult = currentTexture;
438 rub->
copyTexture(m_prevTempAATexture, blendResult);
440 rub->copyTexture(m_prevTempAATexture, currentTexture);
441 cb->resourceUpdate(rub);
448 currentTexture = blendResult;
462 const auto &
renderer = m_sgContext->renderer();
469 renderer->rhiQuadRenderer()->prepareQuad(rhiCtx,
nullptr);
476 const auto &shaderPipeline = m_sgContext->shaderCache()->getBuiltInRhiShaders().getRhiSupersampleResolveShader(rhiCtx->
mainPassViewCount());
493 currentTexture = m_texture;
501 Q_TRACE(QSSG_renderFrame_exit);
505 return currentTexture;
510 m_sgContext->renderer()->beginFrame(*m_layer);
515 m_sgContext->renderer()->endFrame(*m_layer);
523 const auto &
renderer = m_sgContext->renderer();
525 renderer->setDpr(displayPixelRatio);
529 renderer->prepareLayerForRender(*m_layer);
546 m_sgContext->renderer()->rhiRender(*m_layer);
568 switch (tonemapMode) {
591 bool newRenderStats =
false;
592 if (!m_renderStats) {
594 newRenderStats =
true;
602 m_sgContext->renderer()->setDpr(
dpr);
603 bool layerSizeIsDirty = m_surfaceSize !=
size;
604 m_surfaceSize =
size;
607 QSet<QSSGRenderGraphObject *> resourceLoaders;
608 bool requestSharedUpdate =
false;
613 if (winAttacment && winAttacment->
rci() != m_sgContext)
614 winAttacment->
setRci(m_sgContext);
617 requestSharedUpdate = winAttacment->
synchronize(resourceLoaders);
627 if (
auto winAttacment = importSceneManager->wattached) {
629 auto rci = winAttacment->
rci();
630 const bool inlineSync = (rci && rci->rhi() && (rci->rhi()->thread() == m_sgContext->rhi()->thread()));
635 }
else if (rci && !
window->isExposed()) {
638 }
else if (!rci || requestSharedUpdate) {
662 for (
const auto &ext : extensions) {
665 if (
type == QSSGRenderGraphObject::Type::RenderExtension) {
666 if (
auto *renderExt = qobject_cast<QQuick3DRenderExtension *>(ext)) {
671 bfs(qobject_cast<QQuick3DRenderExtension *>(ext),
list);
682 updateLayerNode(view3D, resourceLoaders.values());
685 bool postProcessingWasActive = m_effectSystem;
687 if (postProcessingNeeded) {
689 while (lastEffect->m_nextEffect)
693 const auto layerTextureFormat = [effectOutputFormatOverride, view3D](
QRhi *rhi,
bool postProc) {
711 if (postProc && rhi->isTextureFormatSupported(preferredPostProcFormat))
712 return preferredPostProcFormat;
715 if (rhi->isTextureFormatSupported(preferredView3DFormat))
716 return preferredView3DFormat;
720 bool postProcessingStateDirty = postProcessingNeeded != postProcessingWasActive;
728 if (m_userBackgroundColor != currentUserBackgroundColor) {
729 m_userBackgroundColor = currentUserBackgroundColor;
730 m_linearBackgroundColor = QSSGUtils::color::sRGBToLinearColor(m_userBackgroundColor);
732 m_linearBackgroundColor.
greenF(),
733 m_linearBackgroundColor.
blueF()),
742 if (rootNode != m_sceneRootNode) {
744 removeNodeFromLayer(m_sceneRootNode);
747 addNodeToLayer(rootNode);
749 m_sceneRootNode = rootNode;
757 if (importRootNode != m_importRootNode) {
758 if (m_importRootNode)
761 if (importRootNode) {
767 while (sceneParent) {
768 if (sceneParent == view3D) {
772 sceneParent = sceneParent->parent();
778 m_importRootNode = importRootNode;
782 if (lightmapBaker->m_bakingRequested) {
788 [qq3dCallback, qq3dBakingControl](
790 std::optional<QString> msg,
794 switch (qssgBakingStatus)
815 qq3dCallback(qq3dBakingStatus, msg, qq3dBakingControl);
817 if (qq3dBakingControl->isCancelled() && !qssgBakingControl->cancelled)
818 qssgBakingControl->cancelled =
true;
822 lightmapBaker->m_bakingRequested =
false;
830 const bool timeBasedAA = progressiveAA || temporalAA;
831 m_postProcessingStack = m_layer->
firstEffect || timeBasedAA || superSamplingAA;
834 && m_postProcessingStack);
835 if (useFBO && rhiCtx->
isValid()) {
837 const QSize renderSize = superSamplingAA ? m_surfaceSize * m_ssaaMultiplier : m_surfaceSize;
841 if (layerSizeIsDirty || postProcessingStateDirty) {
843 m_texture->
setFormat(layerTextureFormat(rhi, postProcessingNeeded));
856 releaseAaDependentRhiResources();
862 if (m_depthStencilBuffer) {
864 m_depthStencilBuffer->
create();
866 if (m_multiViewDepthStencilBuffer) {
867 m_multiViewDepthStencilBuffer->
setPixelSize(renderSize);
868 m_multiViewDepthStencilBuffer->
create();
870 if (m_msaaRenderBuffer) {
872 m_msaaRenderBuffer->
create();
874 if (m_msaaMultiViewRenderBuffer) {
876 m_msaaMultiViewRenderBuffer->
create();
882 if (postProcessingStateDirty) {
883 delete m_textureRenderPassDescriptor;
887 m_textureRenderTarget->
create();
888 if (m_ssaaTextureToTextureRenderTarget)
889 m_ssaaTextureToTextureRenderTarget->
create();
891 if (m_temporalAATexture) {
893 m_temporalAATexture->
create();
895 if (m_prevTempAATexture) {
897 m_prevTempAATexture->
create();
899 if (m_temporalAARenderTarget)
900 m_temporalAARenderTarget->
create();
908 releaseAaDependentRhiResources();
919 m_texture = rhi->
newTexture(textureFormat, m_surfaceSize, 1, textureFlags);
923 if (!m_ssaaTexture && superSamplingAA) {
927 m_ssaaTexture = rhi->
newTexture(textureFormat, renderSize, 1, textureFlags);
931 if (timeBasedAA && !m_temporalAATexture) {
932 m_temporalAATexture = rhi->
newTexture(textureFormat, renderSize, 1, textureFlags);
933 m_temporalAATexture->
create();
934 m_prevTempAATexture = rhi->
newTexture(textureFormat, renderSize, 1, textureFlags);
935 m_prevTempAATexture->
create();
939 if (m_aaIsDirty || layerSizeIsDirty)
953 if (!supported.contains(m_samples)) {
954 if (!supported.isEmpty()) {
955 auto it = std::lower_bound(supported.cbegin(), supported.cend(), m_samples);
956 m_samples =
it == supported.cend() ? supported.last() : *
it;
962 static bool warned =
false;
965 qWarning(
"Multisample renderbuffers are not supported, disabling MSAA for Offscreen View3D");
972 if (!m_multiViewDepthStencilBuffer) {
975 m_multiViewDepthStencilBuffer->
create();
978 if (!m_depthStencilBuffer) {
980 m_depthStencilBuffer->
create();
984 if (!m_textureRenderTarget) {
990 m_msaaMultiViewRenderBuffer->
create();
995 m_msaaRenderBuffer->
create();
1006 rtDesc.setColorAttachments({ att });
1007 if (m_depthStencilBuffer)
1008 rtDesc.setDepthStencilBuffer(m_depthStencilBuffer);
1009 if (m_multiViewDepthStencilBuffer)
1010 rtDesc.setDepthTexture(m_multiViewDepthStencilBuffer);
1016 m_textureRenderTarget->
create();
1026 m_ssaaTextureToTextureRenderTarget->
create();
1030 if (!m_effectSystem)
1032 m_effectSystem->
setup(renderSize);
1033 }
else if (m_effectSystem) {
1034 delete m_effectSystem;
1035 m_effectSystem =
nullptr;
1038 if (timeBasedAA && !m_temporalAARenderTarget) {
1043 m_temporalAARenderTarget->
create();
1047 m_aaIsDirty =
false;
1066 mgr->releaseCachedResources();
1068 mgr->releaseCachedResources();
1075 return std::nullopt;
1085 if ((theLocalMouse.x() < 0.0f || theLocalMouse.x() >= viewportSize.
x() || theLocalMouse.y() < 0.0f
1086 || theLocalMouse.y() >= viewportSize.
y()))
1087 return std::nullopt;
1089 return m_layer->
renderedCameras[0]->unproject(theLocalMouse, viewportRect);
1095 return QQuick3DSceneRenderer::PickResultList();
1105 return QQuick3DSceneRenderer::PickResultList();
1114 QVarLengthArray<QSSGRenderNode *> subset)
1117 return QQuick3DSceneRenderer::PickResultList();
1120 *m_sgContext->bufferManager(),
1128 return QQuick3DSceneRenderer::PickResultList();
1142 return m_renderStats;
1150 if (aaMode != layerNode.antialiasingMode) {
1151 layerNode.antialiasingMode = aaMode;
1152 layerNode.progAAPassIndex = 0;
1156 if (aaQuality != layerNode.antialiasingQuality) {
1157 layerNode.antialiasingQuality = aaQuality;
1161 layerNode.ssaaMultiplier = ssaaMultiplier;
1166 if (temporalAAEnabled != layerNode.temporalAAEnabled) {
1168 temporalIsDirty =
true;
1170 layerNode.tempAAPassIndex = 0;
1185 layerNode.gridEnabled = environment->
gridEnabled();
1186 layerNode.gridScale = environment->
gridScale();
1187 layerNode.gridFlags = environment->
gridFlags();
1189 layerNode.aoStrength = environment->
aoStrength();
1190 layerNode.aoDistance = environment->
aoDistance();
1191 layerNode.aoSoftness = environment->
aoSoftness();
1192 layerNode.aoEnabled = environment->
aoEnabled();
1193 layerNode.aoBias = environment->
aoBias();
1195 layerNode.aoDither = environment->
aoDither();
1201 layerNode.lightProbe =
nullptr;
1205 layerNode.skyBoxCubeMap =
nullptr;
1207 layerNode.lightProbeSettings.probeExposure = environment->
probeExposure();
1209 layerNode.lightProbeSettings.probeHorizon =
qMin(environment->
probeHorizon() - 1.0f, -0.001f);
1212 layerNode.explicitCameras.clear();
1213 if (!view3D.m_multiViewCameras.
isEmpty()) {
1216 }
else if (view3D.
camera()) {
1227 layerNode.wireframeMode = debugSettings->wireframeEnabled();
1230 layerNode.wireframeMode =
false;
1236 layerNode.lmOptions.bias = lightmapper->
bias();
1239 layerNode.lmOptions.indirectLightSamples = lightmapper->
samples();
1241 layerNode.lmOptions.indirectLightBounces = lightmapper->
bounces();
1244 layerNode.lmOptions = {};
1248 layerNode.fog.enabled =
true;
1251 layerNode.fog.density = fog->
density();
1253 layerNode.fog.depthBegin = fog->
depthNear();
1254 layerNode.fog.depthEnd = fog->
depthFar();
1255 layerNode.fog.depthCurve = fog->
depthCurve();
1263 layerNode.fog.enabled =
false;
1267void QQuick3DSceneRenderer::updateLayerNode(
QQuick3DViewport *view3D,
const QList<QSSGRenderGraphObject *> &resourceLoaders)
1271 bool temporalIsDirty =
false;
1274 int extraFramesToRender = 0;
1280 extraFramesToRender = int(layerNode->antialiasingQuality) + 1;
1281 }
else if (layerNode->temporalAAEnabled) {
1289 requestedFramesCount = extraFramesToRender;
1291 layerNode->firstEffect =
nullptr;
1293 auto rit = effects.crbegin();
1294 const auto rend = effects.crend();
1295 for (; rit != rend; ++rit) {
1299 if (layerNode->hasEffect(effectNode)) {
1300 qWarning() <<
"Duplicate effect found, skipping!";
1302 effectNode->className = (*rit)->metaObject()->className();
1303 layerNode->addEffect(*effectNode);
1310 for (
QSSGRenderEffect *effectNode = layerNode->firstEffect; effectNode; effectNode = effectNode->m_nextEffect)
1311 effectNode->finalizeShaders(*layerNode, m_sgContext.get());
1314 layerNode->resourceLoaders.clear();
1315 layerNode->resourceLoaders = resourceLoaders;
1318void QQuick3DSceneRenderer::removeNodeFromLayer(
QSSGRenderNode *node)
1342 const int x = int(
rect.x());
1343 const int y = surfaceSize.
height() - (int(
rect.y()) + int(
rect.height()));
1357 int sampleCount = 1;
1374 rhiCtxD->setCommandBuffer(
cb);
1375 rhiCtxD->setRenderTarget(rt);
1377 if (color0 &&
color0->texture()) {
1378 sampleCount =
color0->texture()->sampleCount();
1381 for (
auto it =
desc.cbeginColorAttachments(),
end =
desc.cendColorAttachments();
it !=
end; ++
it) {
1382 if (
it->multiViewCount() >= 2) {
1383 viewCount =
it->multiViewCount();
1390 qWarning(
"Neither swapchain nor redirected command buffer and render target are available.");
1399 rhiCtxD->setMainPassSampleCount(sampleCount);
1407 rhiCtxD->setMainPassViewCount(viewCount);
1417 rhiCtxD->setMainRenderPassDescriptor(
d->m_rt.rpDesc);
1418 rhiCtxD->setCommandBuffer(
d->m_rt.cb);
1419 rhiCtxD->setRenderTarget(
d->m_rt.rt);
1420 rhiCtxD->setMainPassSampleCount(
d->m_rt.rt->sampleCount());
1421 rhiCtxD->setMainPassViewCount(1);
1435 if (!
renderer->m_sgContext->rhiContext()->isValid())
1439 queryInlineRenderPassDescriptorAndCommandBuffer(
this,
renderer->m_sgContext->rhiContext().get());
1458 const auto &rhiContext =
renderer->m_sgContext->rhiContext();
1460 if (rhiContext->isValid()) {
1464 queryInlineRenderPassDescriptorAndCommandBuffer(
this,
renderer->m_sgContext->rhiContext().get());
1508 if (m_isVisible == visible)
1510 m_isVisible = visible;
1516 renderPending =
true;
1527 if (m_renderer->m_sgContext->rhiContext()->isValid())
1528 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1531void QQuick3DSGDirectRenderer::prepare()
1533 if (!m_isVisible || !m_renderer)
1536 if (m_renderer->m_sgContext->rhiContext()->isValid()) {
1538 if (m_renderer->m_postProcessingStack) {
1539 if (renderPending) {
1540 renderPending =
false;
1544 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1545 const auto &quadRenderer = m_renderer->m_sgContext->renderer()->rhiQuadRenderer();
1546 quadRenderer->prepareQuad(m_renderer->m_sgContext->rhiContext().get(),
nullptr);
1547 if (m_renderer->requestedFramesCount > 0) {
1549 m_renderer->requestedFramesCount--;
1562 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1563 const QRect vp = convertQtRectToGLViewport(m_viewport, m_window->size() * m_window->effectiveDevicePixelRatio());
1567 m_renderer->
rhiPrepare(vp, m_window->effectiveDevicePixelRatio());
1576void QQuick3DSGDirectRenderer::render()
1578 if (!m_isVisible || !m_renderer)
1581 const auto &rhiContext = m_renderer->m_sgContext->rhiContext();
1583 if (rhiContext->isValid()) {
1594 if (m_renderer->m_postProcessingStack) {
1596 queryMainRenderPassDescriptorAndCommandBuffer(m_window, rhiContext.get());
1597 auto rhiCtx = m_renderer->m_sgContext->rhiContext().get();
1598 const auto &
renderer = m_renderer->m_sgContext->renderer();
1607 QRect vp = convertQtRectToGLViewport(m_viewport, m_window->size() * m_window->effectiveDevicePixelRatio());
1609 const auto &shaderCache = m_renderer->m_sgContext->shaderCache();
1610 const auto &shaderPipeline = shaderCache->getBuiltInRhiShaders().getRhiSimpleQuadShader(rhiCtx->
mainPassViewCount());
1633 queryMainRenderPassDescriptorAndCommandBuffer(m_window, rhiContext.get());
1639 m_renderer->profilingId);
The QColor class provides colors based on RGB, HSV or CMYK values.
float greenF() const noexcept
Returns the green color component of this color.
float redF() const noexcept
Returns the red color component of this color.
float alphaF() const noexcept
Returns the alpha color component of this color.
float blueF() const noexcept
Returns the blue color component of this color.
static QColor fromRgbF(float r, float g, float b, float a=1.0)
Static convenience function that returns a QColor constructed from the RGB color values,...
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
Type
This enum type defines the valid event types in Qt.
QRect mapRect(const QRect &rect) const
Maps rect by multiplying this matrix by the corners of rect and then forming a new rectangle from the...
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
bool isHeightEnabled() const
\qmlproperty bool Fog::heightEnabled
bool isTransmitEnabled() const
\qmlproperty bool Fog::transmitEnabled
bool isDepthEnabled() const
\qmlproperty bool Fog::depthEnabled
bool isEnabled() const
\qmltype Fog \inherits Object \inqmlmodule QtQuick3D
std::function< void(BakingStatus, std::optional< QString >, BakingControl *) Callback)
float indirectLightFactor
bool isAdaptiveBiasEnabled() const
bool isIndirectLightEnabled() const
int indirectLightWorkgroupSize
static QQuick3DObjectPrivate * get(QQuick3DObject *item)
QQuick3DObject * parent
\qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a...
static void updateLayerNodeHelper(const QQuick3DViewport &view3D, QSSGRenderLayer &layerNode, bool &aaIsDirty, bool &temporalIsDirty, float &ssaaMultiplier)
void endSync(bool dump=false)
void setRhiContext(QSSGRhiContext *ctx, QSSGRenderLayer *layer)
void startRenderPrepare()
void endRender(bool dump=false)
~QQuick3DSGDirectRenderer()
QQuick3DSceneRenderer * renderer()
void setViewport(const QRectF &viewport)
void setVisibility(bool visible)
QQuick3DSGDirectRenderer(QQuick3DSceneRenderer *renderer, QQuickWindow *window, QQuick3DSGDirectRendererMode mode=Underlay)
QQuick3DSGDirectRendererMode
void render(const RenderState *state) override
This function is called by the renderer and should paint this node with directly invoking commands in...
void releaseResources() override
This function is called when all custom graphics resources allocated by this node have to be freed im...
RenderingFlags flags() const override
void prepare() override
Called from the frame preparation phase.
QQuick3DSceneRenderer * renderer
StateFlags changedStates() const override
When the underlying rendering API is OpenGL, this function should return a mask where each bit repres...
QQuick3DDebugSettings * debugSettings
\qmlproperty QtQuick3D::DebugSettings QtQuick3D::SceneEnvironment::debugSettings
QRect scissorRect
\qmlproperty rect QtQuick3D::SceneEnvironment::scissorRect
QQuick3DCubeMapTexture * skyBoxCubeMap
\qmlproperty QtQuick3D::CubeMapTexture QtQuick3D::SceneEnvironment::skyBoxCubeMap
float skyboxBlurAmount
\qmlproperty float QtQuick3D::SceneEnvironment::skyboxBlurAmount
QQuick3DEnvironmentTonemapModes
QQuick3DEnvironmentAAModeValues antialiasingMode
QQuick3DTexture * lightProbe
virtual const QVector< QQuick3DEffect * > & effectList() const
bool specularAAEnabled
\qmlproperty bool QtQuick3D::SceneEnvironment::specularAAEnabled
QQuick3DEnvironmentTonemapModes tonemapMode
QVector3D probeOrientation
bool aoEnabled
\qmlproperty bool SceneEnvironment::aoEnabled
QQuick3DFog * fog
\qmlproperty QtQuick3D::Fog QtQuick3D::SceneEnvironment::fog
QQuick3DEnvironmentBackgroundTypes backgroundMode
QQuick3DLightmapper * lightmapper
\qmlproperty Lightmapper QtQuick3D::SceneEnvironment::lightmapper
QQuick3DEnvironmentAAQualityValues antialiasingQuality
static QQuick3DWindowAttachment * getOrSetWindowAttachment(QQuickWindow &window)
QRhiTexture * renderToRhiTexture(QQuickWindow *qw)
PickResultList syncPick(const QSSGRenderRay &ray)
QQuick3DSceneRenderer(const std::shared_ptr< QSSGRenderContextInterface > &rci)
void invalidateFramebufferObject()
void rhiPrepare(const QRect &viewport, qreal displayPixelRatio)
PickResultList syncPickSubset(const QSSGRenderRay &ray, QVarLengthArray< QSSGRenderNode * > subset)
void synchronize(QQuick3DViewport *view3D, const QSize &size, float dpr)
std::optional< QSSGRenderRay > getRayFromViewportPos(const QPointF &pos)
QSize surfaceSize() const
PickResultList syncPickAll(const QSSGRenderRay &ray)
static QSSGRenderLayer::TonemapMode getTonemapMode(const QQuick3DSceneEnvironment &environment)
void setGlobalPickingEnabled(bool isEnabled)
QQuick3DRenderStats * renderStats()
void releaseCachedResources()
PickResultList syncPickOne(const QSSGRenderRay &ray, QSSGRenderNode *node)
QSSGRenderImage * getRenderImage()
QQuick3DNode * importScene
QQuickShaderEffectSource::Format renderFormat
\qmlproperty enumeration QtQuick3D::View3D::renderFormat
void clearExtensionListDirty()
const QList< QQuick3DObject * > & extensionList() const
bool extensionListDirty() const
QQuick3DLightmapBaker * maybeLightmapBaker()
QQuick3DRenderStats * renderStats
QQuick3DSceneEnvironment * environment
Q_INVOKABLE void requestUpdate()
Q_INVOKABLE bool synchronize(QSet< QSSGRenderGraphObject * > &resourceLoaders)
const std::shared_ptr< QSSGRenderContextInterface > & rci() const
QQuickWindow * window() const
void setRci(const std::shared_ptr< QSSGRenderContextInterface > &rciptr)
QQuickWindow * window() const
Returns the window in which this item is rendered.
void update()
Schedules a call to updatePaintNode() for this item.
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
void update()
Schedules the window to render another frame.
void beforeRendering()
\qmlsignal QtQuick::Window::afterSynchronizing()
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
virtual bool create()=0
Creates the corresponding native graphics resources.
void setTexture(QRhiTexture *tex)
Sets the texture tex.
void setRenderBuffer(QRhiRenderBuffer *rb)
Sets the renderbuffer rb.
void setMultiViewCount(int count)
Sets the view count.
void setResolveTexture(QRhiTexture *tex)
Sets the resolve texture tex.
void setPixelSize(const QSize &sz)
Sets the size (in pixels) to sz.
virtual bool create()=0
Creates the corresponding native graphics resources.
void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
Sets the QRhiRenderPassDescriptor desc for use with this render target.
QRhiRenderPassDescriptor * renderPassDescriptor() const
void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc=QRhiTextureCopyDescription())
Enqueues a texture-to-texture copy operation from src into dst as described by desc.
void setName(const QByteArray &name)
Sets a name for the object.
virtual QRhiRenderTarget * currentFrameRenderTarget()=0
QRhiRenderPassDescriptor * renderPassDescriptor() const
virtual QRhiCommandBuffer * currentFrameCommandBuffer()=0
const QRhiColorAttachment * cbeginColorAttachments() const
virtual QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor()=0
QRhiResource::Type resourceType() const override
virtual bool create()=0
Creates the corresponding native graphics resources.
QRhiTextureRenderTargetDescription description() const
void setFormat(Format fmt)
Sets the requested texture format to fmt.
virtual bool create()=0
Creates the corresponding native graphics resources.
Format
Specifies the texture format.
void setPixelSize(const QSize &sz)
Sets the texture size, specified in pixels, to sz.
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
QRhiTexture * newTextureArray(QRhiTexture::Format format, int arraySize, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
bool isYUpInFramebuffer() const
bool isFeatureSupported(QRhi::Feature feature) const
QList< int > supportedSampleCounts() const
QRhiRenderBuffer * newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount=1, QRhiRenderBuffer::Flags flags={}, QRhiTexture::Format backingFormatHint=QRhiTexture::UnknownFormat)
Implementation backend() const
QRhiTextureRenderTarget * newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags={})
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
@ MultisampleRenderBuffer
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
void setOwnsTexture(bool owns)
static QSGRenderNodePrivate * get(QSGRenderNode *node)
The QSGRenderNode class represents a set of custom rendering commands targeting the graphics API that...
const QMatrix4x4 * matrix() const
An interface providing access to some of the graphics API specific internals of the scenegraph.
@ RhiRedirectCommandBuffer
@ RhiRedirectRenderTarget
static bool isApiRhiBased(GraphicsApi api)
void setTexture(QSGTexture *texture)
Sets the texture of this texture node to texture.
QSGTexture * texture() const
Returns the texture for this texture node.
void textureChanged()
This signal is emitted when the texture changes.
static QRhiTexture::Format toRhiFormat(const QSSGRenderTextureFormat format)
QSSGLightmapper::Callback lightmapBakingOutputCallback
const QSSGRenderReflectionMapPtr & getReflectionMapManager() const
bool interactiveLightmapBakingRequested
const QSSGRenderShadowMapPtr & getShadowMapManager() const
QSSGRenderCameraList renderedCameras
std::function< void(BakingStatus, std::optional< QString >, BakingControl *) Callback)
static constexpr bool isExtension(Type type) noexcept
static PickResultList syncPickSubset(const QSSGRenderLayer &layer, QSSGBufferManager &bufferManager, const QSSGRenderRay &ray, QVarLengthArray< QSSGRenderNode * > subset)
static PickResultList syncPickAll(const QSSGRenderContextInterface &ctx, const QSSGRenderLayer &layer, const QSSGRenderRay &ray)
static void setGlobalPickingEnabled(QSSGRenderer &renderer, bool isEnabled)
static PickResultList syncPick(const QSSGRenderContextInterface &ctx, const QSSGRenderLayer &layer, const QSSGRenderRay &ray, QSSGRenderNode *target=nullptr)
static QSSGRhiContextPrivate * get(QSSGRhiContext *q)
static QSSGRhiContextStats & get(QSSGRhiContext &rhiCtx)
QSSGRenderLayer * layerKey
QHash< QSSGRenderLayer *, PerLayerInfo > perLayerInfo
static quint64 totalDrawCallCountForPass(const QSSGRhiContextStats::RenderPassInfo &pass)
int mainPassSampleCount() const
Returns the sample count used in the main render pass.
int mainPassViewCount() const
Returns the multiview count used in the main render pass.
QRhiCommandBuffer * commandBuffer() const
QRhiCommandBuffer::BeginPassFlags commonPassFlags() const
QRhiSampler * sampler(const QSSGRhiSamplerDescription &samplerDescription)
QRhiRenderPassDescriptor * mainRenderPassDescriptor() const
QRhiTexture * process(const QSSGRenderEffect &firstEffect, QRhiTexture *inTexture, QRhiTexture *inDepthTexture, QVector2D cameraClipRange)
void setup(QSize outputSize)
static QSSGRenderTextureFormat::Format overriddenOutputFormat(const QSSGRenderEffect *inEffect)
void addUniformBuffer(int binding, QRhiShaderResourceBinding::StageFlags stage, QRhiBuffer *buf, int offset=0, int size=0)
void addTexture(int binding, QRhiShaderResourceBinding::StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QThread * currentThread()
The QVector2D class represents a vector or vertex in 2D space.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float x() const noexcept
Returns the x coordinate of this point.
The QVector3D class represents a vector or vertex in 3D space.
constexpr QVector3D toVector3D() const noexcept
Returns the 3D vector form of this 4D vector, dropping the w coordinate.
SGFramebufferObjectNode()
~SGFramebufferObjectNode() override
QQuick3DSceneRenderer * renderer
void handleScreenChange()
QSGTexture * texture() const override
Returns a pointer to the texture object.
void preprocess() override
Override this function to do processing on the node before it is rendered.
QQuick3DViewport * quickFbo
QSet< QString >::iterator it
QVector3D tonemapFilmic(const QVector3D &c)
QVector3D tonemapHejlDawson(const QVector3D &c)
QVector3D tonemapAces(const QVector3D &c)
QVector3D tonemapLinearToSrgb(const QVector3D &c)
QVector2D toRectRelative(const QRectF &r, const QVector2D &absoluteCoordinates)
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum format
#define Q_QUICK3D_PROFILE_START(Type)
#define Q_QUICK3D_PROFILE_END_WITH_ID(Type, Payload, POID)
#define Q_QUICK3D_PROFILE_END_WITH_STRING(Type, Payload, Str)
static QRhiTexture::Format toRhiTextureFormat(QQuickShaderEffectSource::Format format)
static const QVector2D s_ProgressiveAABlendFactors[QSSGLayerRenderData::MAX_AA_LEVELS]
static const QVector2D s_TemporalAABlendFactors
static void bfs(In *inExtension, QList< Out * > &outList)
static bool dumpRenderTimes
QT_BEGIN_NAMESPACE QSSG_prepareFrame_entry
static QVector3D tonemapRgb(const QVector3D &c, QQuick3DSceneEnvironment::QQuick3DEnvironmentTonemapModes tonemapMode)
static void requestFullUpdate(QQuickWindow *window)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
void qsgnode_set_description(QSGNode *node, const QString &description)
#define QSSG_ASSERT(cond, action)
#define QSSGRHICTX_STAT(ctx, f)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define QStringLiteral(str)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
#define Q_TRACE_PREFIX(provider, prefix)
#define Q_TRACE_SCOPE(x,...)
#define Q_TRACE_POINT(provider, tracepoint,...)
unsigned long long quint64
view viewport() -> scroll(dx, dy, deviceRect)
QSvgRenderer * renderer
[0]
QSSGRenderEffect * m_nextEffect
QSSGRenderImage * skyBoxCubeMap
@ EnableDepthPrePass
True when we render a depth pass before.
QVarLengthArray< QSSGRenderCamera *, 2 > renderedCameras
QList< QSSGRenderExtension * > renderExtensions[size_t(RenderExtensionStage::Count)]
QSSGRenderImage * lightProbe
QSSGRenderLayer::AAMode antialiasingMode
QSSGLayerRenderData * renderData
bool progressiveAAIsActive
QSSGRenderLayer::AAQuality antialiasingQuality
void removeImportScene(QSSGRenderNode &rootNode)
void setImportScene(QSSGRenderNode &rootNode)
QSSGRenderEffect * firstEffect
void addChild(QSSGRenderNode &inChild)
void removeChild(QSSGRenderNode &inChild)
static void setShaderPipeline(QSSGRhiGraphicsPipelineState &ps, const QSSGRhiShaderPipeline *pipeline)