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;" \
60#if QT_CONFIG(qml_debug)
66 for (
const auto &pass :
info.renderPasses)
72#define STAT_PAYLOAD(stats) \
73 (statDrawCallCount(stats) | (quint64(stats.perLayerInfo[stats.layerKey].renderPasses.size()) << 32))
77template <
typename In,
typename Out>
85 while (
queue.size() > 0) {
86 if (
auto cur =
queue.dequeue()) {
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->m_sgContext->renderer()->rendererRequestsFrames()
173 ||
renderer->requestedFramesCount > 0) {
176 if (
renderer->requestedFramesCount > 0)
205 releaseAaDependentRhiResources();
206 delete m_effectSystem;
209void QQuick3DSceneRenderer::releaseAaDependentRhiResources()
215 delete m_textureRenderTarget;
216 m_textureRenderTarget =
nullptr;
218 delete m_textureRenderPassDescriptor;
219 m_textureRenderPassDescriptor =
nullptr;
221 delete m_depthStencilBuffer;
222 m_depthStencilBuffer =
nullptr;
224 delete m_msaaRenderBuffer;
225 m_msaaRenderBuffer =
nullptr;
227 delete m_ssaaTexture;
228 m_ssaaTexture =
nullptr;
230 delete m_ssaaTextureToTextureRenderTarget;
231 m_ssaaTextureToTextureRenderTarget =
nullptr;
233 delete m_ssaaTextureToTextureRenderPassDescriptor;
234 m_ssaaTextureToTextureRenderPassDescriptor =
nullptr;
236 delete m_temporalAATexture;
237 m_temporalAATexture =
nullptr;
238 delete m_temporalAARenderTarget;
239 m_temporalAARenderTarget =
nullptr;
240 delete m_temporalAARenderPassDescriptor;
241 m_temporalAARenderPassDescriptor =
nullptr;
243 delete m_prevTempAATexture;
244 m_prevTempAATexture =
nullptr;
291 qWarning(
"Neither swapchain nor redirected command buffer are available.");
292 return currentTexture;
300 int ssaaAdjustedWidth = m_surfaceSize.
width();
301 int ssaaAdjustedHeight = m_surfaceSize.
height();
303 ssaaAdjustedWidth *= m_ssaaMultiplier;
304 ssaaAdjustedHeight *= m_ssaaMultiplier;
309 float dpr = m_sgContext->dpr();
310 const QRect vp =
QRect(0, 0, ssaaAdjustedWidth, ssaaAdjustedHeight);
319 Q_TRACE(QSSG_prepareFrame_exit);
322 Q_TRACE(QSSG_renderFrame_entry, ssaaAdjustedWidth, ssaaAdjustedHeight);
331 clearColor = m_layer->
firstEffect ? m_linearBackgroundColor : m_tonemappedBackgroundColor;
349 currentTexture = superSamplingAA ? m_ssaaTexture : m_texture;
353 const auto &
renderer = m_sgContext->renderer();
369 if ((progressiveAA || temporalAA) && m_prevTempAATexture) {
378 const auto &
renderer = m_sgContext->renderer();
383 const auto &shaderPipeline =
renderer->getRhiProgressiveAAShader();
388 const int ubufSize = 2 *
sizeof(float);
395 int idx = *aaIndex - 1;
398 renderer->rhiQuadRenderer()->prepareQuad(rhiCtx, rub);
415 blendResult = m_temporalAATexture;
417 blendResult = m_prevTempAATexture;
421 blendResult = currentTexture;
429 rub->
copyTexture(m_prevTempAATexture, blendResult);
431 rub->copyTexture(m_prevTempAATexture, currentTexture);
432 cb->resourceUpdate(rub);
439 currentTexture = blendResult;
453 const auto &
renderer = m_sgContext->renderer();
460 renderer->rhiQuadRenderer()->prepareQuad(rhiCtx,
nullptr);
467 const auto &shaderPipeline =
renderer->getRhiSupersampleResolveShader();
483 currentTexture = m_texture;
488 STAT_PAYLOAD(m_sgContext->rhiContext()->stats()),
491 Q_TRACE(QSSG_renderFrame_exit);
495 return currentTexture;
500 m_sgContext->beginFrame(m_layer);
505 m_sgContext->endFrame(m_layer);
513 m_sgContext->setDpr(displayPixelRatio);
519 m_sgContext->prepareLayerForRender(*m_layer);
525 m_sgContext->rhiPrepare(*m_layer);
536 m_sgContext->rhiRender(*m_layer);
558 switch (tonemapMode) {
581 bool newRenderStats =
false;
582 if (!m_renderStats) {
584 newRenderStats =
true;
592 m_sgContext->setDpr(
dpr);
593 bool layerSizeIsDirty = m_surfaceSize !=
size;
594 m_surfaceSize =
size;
598 bool requestSharedUpdate =
false;
603 if (winAttacment && winAttacment->
rci() != m_sgContext)
604 winAttacment->
setRci(m_sgContext);
607 requestSharedUpdate = winAttacment->
synchronize(resourceLoaders);
617 if (
auto winAttacment = importSceneManager->
wattached) {
619 auto rci = winAttacment->
rci();
620 const bool inlineSync = (rci && rci->rhi() && (rci->rhi()->thread() == m_sgContext->rhi()->thread()));
625 }
else if (rci && !
window->isExposed()) {
628 }
else if (!rci || requestSharedUpdate) {
650 for (
const auto &
ext : extensions) {
653 if (
type == QSSGRenderGraphObject::Type::RenderExtension) {
654 if (
auto *renderExt = qobject_cast<QQuick3DRenderExtension *>(
ext)) {
658 bfs(qobject_cast<QQuick3DRenderExtension *>(
ext),
list);
668 updateLayerNode(view3D, resourceLoaders.
values());
671 bool postProcessingWasActive = m_effectSystem;
673 if (postProcessingNeeded) {
679 const auto layerTextureFormat = [effectOutputFormatOverride, view3D](
QRhi *rhi,
bool postProc) {
697 if (postProc && rhi->isTextureFormatSupported(preferredPostProcFormat))
698 return preferredPostProcFormat;
701 if (rhi->isTextureFormatSupported(preferredView3DFormat))
702 return preferredView3DFormat;
706 bool postProcessingStateDirty = postProcessingNeeded != postProcessingWasActive;
714 if (m_userBackgroundColor != currentUserBackgroundColor) {
715 m_userBackgroundColor = currentUserBackgroundColor;
716 m_linearBackgroundColor = color::sRGBToLinearColor(m_userBackgroundColor);
718 m_linearBackgroundColor.
greenF(),
719 m_linearBackgroundColor.
blueF()),
728 if (rootNode != m_sceneRootNode) {
730 removeNodeFromLayer(m_sceneRootNode);
733 addNodeToLayer(rootNode);
735 m_sceneRootNode = rootNode;
743 if (importRootNode != m_importRootNode) {
744 if (m_importRootNode)
747 if (importRootNode) {
753 while (sceneParent) {
754 if (sceneParent == view3D) {
758 sceneParent = sceneParent->
parent();
764 m_importRootNode = importRootNode;
768 if (lightmapBaker->m_bakingRequested) {
774 [qq3dCallback, qq3dBakingControl](
776 std::optional<QString> msg,
780 switch (qssgBakingStatus)
801 qq3dCallback(qq3dBakingStatus, msg, qq3dBakingControl);
803 if (qq3dBakingControl->
isCancelled() && !qssgBakingControl->cancelled)
804 qssgBakingControl->cancelled =
true;
808 lightmapBaker->m_bakingRequested =
false;
816 const bool timeBasedAA = progressiveAA || temporalAA;
817 m_postProcessingStack = m_layer->
firstEffect || timeBasedAA || superSamplingAA;
820 && m_postProcessingStack);
821 if (useFBO && rhiCtx->
isValid()) {
823 const QSize renderSize = superSamplingAA ? m_surfaceSize * m_ssaaMultiplier : m_surfaceSize;
827 if (layerSizeIsDirty || postProcessingStateDirty) {
829 m_texture->
setFormat(layerTextureFormat(rhi, postProcessingNeeded));
842 releaseAaDependentRhiResources();
849 m_depthStencilBuffer->
create();
850 if (m_msaaRenderBuffer) {
852 m_msaaRenderBuffer->
create();
858 if (postProcessingStateDirty) {
859 delete m_textureRenderPassDescriptor;
863 m_textureRenderTarget->
create();
864 if (m_ssaaTextureToTextureRenderTarget)
865 m_ssaaTextureToTextureRenderTarget->
create();
867 if (m_temporalAATexture) {
869 m_temporalAATexture->
create();
871 if (m_prevTempAATexture) {
873 m_prevTempAATexture->
create();
875 if (m_temporalAARenderTarget)
876 m_temporalAARenderTarget->
create();
884 releaseAaDependentRhiResources();
892 m_texture = rhi->
newTexture(textureFormat, m_surfaceSize, 1, textureFlags);
896 if (!m_ssaaTexture && superSamplingAA) {
897 m_ssaaTexture = rhi->
newTexture(textureFormat, renderSize, 1, textureFlags);
901 if (timeBasedAA && !m_temporalAATexture) {
902 m_temporalAATexture = rhi->
newTexture(textureFormat, renderSize, 1, textureFlags);
903 m_temporalAATexture->
create();
904 m_prevTempAATexture = rhi->
newTexture(textureFormat, renderSize, 1, textureFlags);
905 m_prevTempAATexture->
create();
909 if (m_aaIsDirty || layerSizeIsDirty)
923 if (!supported.
contains(m_samples)) {
925 auto it = std::lower_bound(supported.
cbegin(), supported.
cend(), m_samples);
926 m_samples =
it == supported.
cend() ? supported.
last() : *
it;
932 static bool warned =
false;
935 qWarning(
"Multisample renderbuffers are not supported, disabling MSAA for Offscreen View3D");
941 if (!m_depthStencilBuffer) {
943 m_depthStencilBuffer->
create();
946 if (!m_textureRenderTarget) {
951 m_msaaRenderBuffer->
create();
968 m_textureRenderTarget->
create();
976 m_ssaaTextureToTextureRenderTarget->
create();
982 m_effectSystem->
setup(renderSize);
983 }
else if (m_effectSystem) {
984 delete m_effectSystem;
985 m_effectSystem =
nullptr;
988 if (timeBasedAA && !m_temporalAARenderTarget) {
993 m_temporalAARenderTarget->
create();
1016 mgr->releaseCachedResources();
1018 mgr->releaseCachedResources();
1025 return std::nullopt;
1035 if ((theLocalMouse.
x() < 0.0f || theLocalMouse.
x() >= viewportSize.
x() || theLocalMouse.
y() < 0.0f
1036 || theLocalMouse.
y() >= viewportSize.
y()))
1037 return std::nullopt;
1047 return m_sgContext->renderer()->syncPick(*m_layer,
1048 *m_sgContext->bufferManager(),
1057 return m_sgContext->renderer()->syncPick(*m_layer,
1058 *m_sgContext->bufferManager(),
1068 return m_sgContext->renderer()->syncPickAll(*m_layer,
1069 *m_sgContext->bufferManager(),
1075 m_sgContext->renderer()->setGlobalPickingEnabled(isEnabled);
1080 return m_renderStats;
1106 temporalIsDirty =
true;
1162 layerNode.
wireframeMode = debugSettings->wireframeEnabled();
1206 bool temporalIsDirty =
false;
1209 int extraFramesToRender = 0;
1217 if (m_sgContext->rhiContext()->isValid())
1218 extraFramesToRender += 1;
1227 requestedFramesCount = extraFramesToRender;
1231 auto rit = effects.crbegin();
1232 const auto rend = effects.crend();
1233 for (; rit != rend; ++rit) {
1238 qWarning() <<
"Duplicate effect found, skipping!";
1240 effectNode->
className = (*rit)->metaObject()->className();
1256void QQuick3DSceneRenderer::removeNodeFromLayer(
QSSGRenderNode *node)
1280 const int x = int(
rect.x());
1281 const int y = surfaceSize.
height() - (int(
rect.y()) + int(
rect.height()));
1294 int sampleCount = 1;
1313 if (color0 &&
color0->texture())
1314 sampleCount =
color0->texture()->sampleCount();
1316 qWarning(
"Neither swapchain nor redirected command buffer and render target are available.");
1350 if (!
renderer->m_sgContext->rhiContext()->isValid())
1354 queryInlineRenderPassDescriptorAndCommandBuffer(
this,
renderer->m_sgContext->rhiContext().get());
1373 if (
renderer->m_sgContext->rhiContext()->isValid()) {
1377 queryInlineRenderPassDescriptorAndCommandBuffer(
this,
renderer->m_sgContext->rhiContext().get());
1382 STAT_PAYLOAD(
renderer->m_sgContext->rhiContext()->stats()),
renderer->profilingId);
1422 if (m_isVisible == visible)
1424 m_isVisible = visible;
1430 renderPending =
true;
1434void QQuick3DSGDirectRenderer::prepare()
1436 if (!m_isVisible || !m_renderer)
1439 if (m_renderer->m_sgContext->rhiContext()->isValid()) {
1441 if (m_renderer->m_postProcessingStack) {
1442 if (renderPending) {
1443 renderPending =
false;
1445 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1446 auto quadRenderer = m_renderer->m_sgContext->renderer()->rhiQuadRenderer();
1447 quadRenderer->prepareQuad(m_renderer->m_sgContext->rhiContext().get(),
nullptr);
1448 if (m_renderer->m_sgContext->renderer()->rendererRequestsFrames()
1449 || m_renderer->requestedFramesCount > 0) {
1451 if (m_renderer->requestedFramesCount > 0)
1452 m_renderer->requestedFramesCount--;
1465 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1466 const QRect vp = convertQtRectToGLViewport(m_viewport, m_window->size() * m_window->devicePixelRatio());
1470 m_renderer->
rhiPrepare(vp, m_window->devicePixelRatio());
1479void QQuick3DSGDirectRenderer::render()
1481 if (!m_isVisible || !m_renderer)
1484 if (m_renderer->m_sgContext->rhiContext()->isValid()) {
1495 if (m_renderer->m_postProcessingStack) {
1497 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1498 auto rhiCtx = m_renderer->m_sgContext->rhiContext().get();
1499 const auto &
renderer = m_renderer->m_sgContext->renderer();
1506 QRect vp = convertQtRectToGLViewport(m_viewport, m_window->size() * m_window->devicePixelRatio());
1508 const auto &shaderPipeline =
renderer->getRhiSimpleQuadShader();
1527 queryMainRenderPassDescriptorAndCommandBuffer(m_window, m_renderer->m_sgContext->rhiContext().get());
1533 STAT_PAYLOAD(m_renderer->m_sgContext->rhiContext()->stats()),
1534 m_renderer->profilingId);
QSSGRhiRenderableTexture rhiDepthTexture
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.
bool isEmpty() const noexcept
void push_back(parameter_type t)
const_iterator cend() const noexcept
const_iterator cbegin() const noexcept
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...
QObject * parent() const
Returns a pointer to the parent object.
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
QPointer< QQuick3DSceneManager > sceneManager
static QQuick3DObjectPrivate * get(QQuick3DObject *item)
QSSGRenderGraphObject * spatialNode
QQuick3DObject * parent
\qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a...
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
QPointer< QQuick3DWindowAttachment > wattached
static QQuick3DWindowAttachment * getOrSetWindowAttachment(QQuickWindow &window)
QSSGRenderPickResult syncPickOne(const QSSGRenderRay &ray, QSSGRenderNode *node)
QRhiTexture * renderToRhiTexture(QQuickWindow *qw)
QQuick3DSceneRenderer(const std::shared_ptr< QSSGRenderContextInterface > &rci)
void invalidateFramebufferObject()
void rhiPrepare(const QRect &viewport, qreal displayPixelRatio)
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()
QSSGRenderPickResult syncPick(const QSSGRenderRay &ray)
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 setRenderBuffer(QRhiRenderBuffer *rb)
Sets the renderbuffer rb.
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 updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Enqueues updating a region of a QRhiBuffer buf created with the type QRhiBuffer::Dynamic.
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
void setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer)
Sets the renderBuffer for depth-stencil.
void setColorAttachments(std::initializer_list< QRhiColorAttachment > list)
Sets the list of color attachments.
virtual QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor()=0
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.
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
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)
virtual void * getResource(QQuickWindow *window, Resource resource) const
Queries a graphics resource in window.
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
QSSGRenderCamera * camera
bool interactiveLightmapBakingRequested
DepthMapPass depthMapPass
const QSSGRenderShadowMapPtr & getShadowMapManager() const
std::function< void(BakingStatus, std::optional< QString >, BakingControl *)> Callback
QSSGRenderLayer * layerKey
void cleanupLayerInfo(QSSGRenderLayer *layer)
QHash< QSSGRenderLayer *, PerLayerInfo > perLayerInfo
static quint64 totalDrawCallCountForPass(const QSSGRhiContextStats::RenderPassInfo &pass)
void setMainPassSampleCount(int samples)
void setMainRenderPassDescriptor(QRhiRenderPassDescriptor *rpDesc)
QRhiCommandBuffer * commandBuffer() const
static QRhiCommandBuffer::BeginPassFlags commonPassFlags()
QSSGRhiDrawCallData & drawCallData(const QSSGRhiDrawCallDataKey &key)
QSSGRhiContextStats & stats()
QRhiShaderResourceBindings * srb(const QSSGRhiShaderResourceBindingList &bindings)
QRhiSampler * sampler(const QSSGRhiSamplerDescription &samplerDescription)
void setRenderTarget(QRhiRenderTarget *rt)
QRhiRenderPassDescriptor * mainRenderPassDescriptor() const
void setCommandBuffer(QRhiCommandBuffer *cb)
QRhiTexture * process(const QSSGRenderEffect &firstEffect, QRhiTexture *inTexture, QRhiTexture *inDepthTexture, QVector2D cameraClipRange)
void setup(QSize outputSize)
static QSSGRenderTextureFormat::Format overriddenOutputFormat(const QSSGRenderEffect *inEffect)
QList< T > values() const
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
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
Q_QUICK3D_EXPORT void updateLayerNodeHelper(const QQuick3DViewport &view3D, QSSGRenderLayer &layerNode, bool &aaIsDirty, bool &temporalIsDirty, float &ssaaMultiplier)
QVector3D tonemapFilmic(const QVector3D &c)
QVector3D tonemapHejlDawson(const QVector3D &c)
QVector3D tonemapAces(const QVector3D &c)
QVector3D tonemapLinearToSrgb(const QVector3D &c)
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)
QVector2D toRectRelative(const QRectF &r, const QVector2D &absoluteCoordinates)
#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
QFileInfo info(fileName)
[8]
view viewport() -> scroll(dx, dy, deviceRect)
QSvgRenderer * renderer
[0]
bool contains(const AT &t) const noexcept
bool indirectLightEnabled
int indirectLightWorkgroupSize
float indirectLightFactor
QSSGRenderRay unproject(const QVector2D &inLayerRelativeMouseCoords, const QRectF &inViewport) const
void finalizeShaders(const QSSGRenderLayer &layer, QSSGRenderContextInterface *renderContext)
QSSGRenderEffect * m_nextEffect
static constexpr bool isExtension(Type type) noexcept
QSSGRenderCamera * explicitCamera
QSSGLightmapperOptions lmOptions
void addEffect(QSSGRenderEffect &inEffect)
QSSGRenderCamera * renderedCamera
struct QSSGRenderLayer::FogOptions fog
QSSGRenderImage * skyBoxCubeMap
@ EnableDepthPrePass
True when we render a depth pass before.
QVector< QSSGRenderGraphObject * > resourceLoaders
QSSGRenderImage * lightProbe
void setProbeOrientation(const QVector3D &angles)
QSSGRenderLayer::AAMode antialiasingMode
MaterialDebugMode debugMode
QSSGLayerRenderData * renderData
QSSGRenderLayer::Background background
bool progressiveAAIsActive
QSSGRenderLayer::AAQuality antialiasingQuality
void removeImportScene(QSSGRenderNode &rootNode)
bool hasEffect(QSSGRenderEffect *inEffect) const
QList< QSSGRenderExtension * > renderExtensions[RenderExtensionMode::Count]
void setImportScene(QSSGRenderNode &rootNode)
QSSGRenderEffect * firstEffect
void addChild(QSSGRenderNode &inChild)
void removeChild(QSSGRenderNode &inChild)
const QSSGRhiShaderPipeline * shaderPipeline
void addUniformBuffer(int binding, QRhiShaderResourceBinding::StageFlags stage, QRhiBuffer *buf, int offset, int size)
void addTexture(int binding, QRhiShaderResourceBinding::StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)