Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssglayerrenderdata.cpp File Reference
#include "qssglayerrenderdata_p.h"
#include <QtQuick3DRuntimeRender/private/qssgrenderer_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderlight_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrhicustommaterialsystem_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrhiquadrenderer_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrhiparticles_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderlayer_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendereffect_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendercamera_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderskeleton_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderjoint_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendermorphtarget_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderparticles_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderbuffermanager_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendershadercache_p.h>
#include <QtQuick3DRuntimeRender/private/qssgperframeallocator_p.h>
#include <QtQuick3DRuntimeRender/private/qssgruntimerenderlogging_p.h>
#include <QtQuick3DRuntimeRender/private/qssglightmapper_p.h>
#include <QtQuick3DUtils/private/qssgutils_p.h>
#include <QtQuick3DUtils/private/qssgassert_p.h>
#include <QtQuick/private/qsgtexture_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QBitArray>
#include <array>
#include "qssgrenderpass_p.h"
+ Include dependency graph for qssglayerrenderdata.cpp:

Go to the source code of this file.

Macros

#define POS4BONETRANS(x)   (sizeof(float) * 16 * (x) * 2)
 
#define POS4BONENORM(x)   (sizeof(float) * 16 * ((x) * 2 + 1))
 
#define BONEDATASIZE4ID(x)   POS4BONETRANS(x + 1)
 
#define MAX_MORPH_TARGET   8
 
#define MAX_MORPH_TARGET_INDEX_SUPPORTS_NORMALS   3
 
#define MAX_MORPH_TARGET_INDEX_SUPPORTS_TANGENTS   1
 
#define CHECK_IMAGE_AND_PREPARE(img, imgtype, shadercomponent)
 

Functions

QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY (lcQuick3DRender, "qt.quick3d.render")
 
static bool checkParticleSupport (QRhi *rhi)
 
static constexpr bool nearestToFurthestCompare (const QSSGRenderableObjectHandle &lhs, const QSSGRenderableObjectHandle &rhs) noexcept
 
static constexpr bool furthestToNearestCompare (const QSSGRenderableObjectHandle &lhs, const QSSGRenderableObjectHandle &rhs) noexcept
 
static void collectBoneTransforms (QSSGRenderNode *node, QSSGRenderSkeleton *skeletonNode, const QVector< QMatrix4x4 > &poses)
 
static bool hasDirtyNonJointNodes (QSSGRenderNode *node, bool &hasChildJoints)
 
template<typename T , typename V >
void collectNode (V node, QVector< T > &dst, int &dstPos)
 
template<typename T , typename V >
static void collectNodeFront (V node, QVector< T > &dst, int &dstPos)
 
static bool maybeQueueNodeForRender (QSSGRenderNode &inNode, QVector< QSSGRenderableNodeEntry > &outRenderableModels, int &ioRenderableModelsCount, QVector< QSSGRenderableNodeEntry > &outRenderableParticles, int &ioRenderableParticlesCount, QVector< QSSGRenderItem2D * > &outRenderableItem2Ds, int &ioRenderableItem2DsCount, QVector< QSSGRenderCamera * > &outCameras, int &ioCameraCount, QVector< QSSGRenderLight * > &outLights, int &ioLightCount, QVector< QSSGRenderReflectionProbe * > &outReflectionProbes, int &ioReflectionProbeCount, quint32 &ioDFSIndex)
 
static QSSGCameraRenderData getCameraDataImpl (const QSSGRenderCamera *camera)
 
static float getCameraDistanceSq (const QSSGRenderableObject &obj, const QSSGCameraRenderData &camera) noexcept
 
template<typename T , typename... Args>
Q_REQUIRED_RESULT T * RENDER_FRAME_NEW (QSSGRenderContextInterface &ctx, Args &&... args)
 
template<typename T >
Q_REQUIRED_RESULT QSSGDataRef< T > RENDER_FRAME_NEW_BUFFER (QSSGRenderContextInterface &ctx, size_t count)
 
static bool scopeLight (QSSGRenderNode *node, QSSGRenderNode *lightScope)
 
static int effectiveMaxLightCount (const QSSGShaderFeatures &features)
 
void updateDirtySkeletons (const QVector< QSSGRenderableNodeEntry > &renderableNodes)
 
static void sortInstances (QByteArray &sortedData, QList< QSSGRhiSortData > &sortData, const void *instances, int stride, int count, const QVector3D &cameraDirection)
 
static void cullLodInstances (QByteArray &lodData, const void *instances, int count, const QVector3D &cameraPosition, float minThreshold, float maxThreshold)
 

Variables

static const QVector2D s_ProgressiveAAVertexOffsets [QSSGLayerRenderData::MAX_AA_LEVELS]
 
static const int REDUCED_MAX_LIGHT_COUNT_THRESHOLD_BYTES = 4096
 

Macro Definition Documentation

◆ BONEDATASIZE4ID

#define BONEDATASIZE4ID (   x)    POS4BONETRANS(x + 1)

Definition at line 51 of file qssglayerrenderdata.cpp.

◆ CHECK_IMAGE_AND_PREPARE

#define CHECK_IMAGE_AND_PREPARE (   img,
  imgtype,
  shadercomponent 
)
Value:
if ((img)) \
prepareImageForRender(*(img), imgtype, firstImage, nextImage, renderableFlags, \
theGeneratedKey, shadercomponent, &inMaterial)
GLint void * img
Definition qopenglext.h:233

◆ MAX_MORPH_TARGET

#define MAX_MORPH_TARGET   8

Definition at line 195 of file qssglayerrenderdata.cpp.

◆ MAX_MORPH_TARGET_INDEX_SUPPORTS_NORMALS

#define MAX_MORPH_TARGET_INDEX_SUPPORTS_NORMALS   3

Definition at line 196 of file qssglayerrenderdata.cpp.

◆ MAX_MORPH_TARGET_INDEX_SUPPORTS_TANGENTS

#define MAX_MORPH_TARGET_INDEX_SUPPORTS_TANGENTS   1

Definition at line 197 of file qssglayerrenderdata.cpp.

◆ POS4BONENORM

#define POS4BONENORM (   x)    (sizeof(float) * 16 * ((x) * 2 + 1))

Definition at line 50 of file qssglayerrenderdata.cpp.

◆ POS4BONETRANS

#define POS4BONETRANS (   x)    (sizeof(float) * 16 * (x) * 2)

Definition at line 49 of file qssglayerrenderdata.cpp.

Function Documentation

◆ checkParticleSupport()

static bool checkParticleSupport ( QRhi rhi)
static

Definition at line 53 of file qssglayerrenderdata.cpp.

References QRhi::isTextureFormatSupported(), QSSG_ASSERT, qWarning, ret, QRhiTexture::RGBA16F, and QRhiTexture::RGBA32F.

+ Here is the call graph for this function:

◆ collectBoneTransforms()

static void collectBoneTransforms ( QSSGRenderNode node,
QSSGRenderSkeleton skeletonNode,
const QVector< QMatrix4x4 > &  poses 
)
static

Definition at line 126 of file qssglayerrenderdata.cpp.

References QSSGRenderSkeleton::boneData, QSSGRenderNode::calculateGlobalVariables(), child, QSSGRenderNode::children, collectBoneTransforms(), QMatrix4x4::constData(), QSSGRenderSkeleton::containsNonJointNodes, QByteArray::data(), QSSGRenderNode::globalTransform, QSSGRenderJoint::index, QMatrix4x4::normalMatrix(), POS4BONENORM, POS4BONETRANS, QList< T >::size(), and QSSGRenderGraphObject::type.

Referenced by collectBoneTransforms(), and updateDirtySkeletons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectNode()

template<typename T , typename V >
void collectNode ( node,
QVector< T > &  dst,
int &  dstPos 
)
inline

Definition at line 175 of file qssglayerrenderdata.cpp.

Referenced by maybeQueueNodeForRender().

+ Here is the caller graph for this function:

◆ collectNodeFront()

template<typename T , typename V >
static void collectNodeFront ( node,
QVector< T > &  dst,
int &  dstPos 
)
inlinestatic

Definition at line 185 of file qssglayerrenderdata.cpp.

Referenced by maybeQueueNodeForRender().

+ Here is the caller graph for this function:

◆ cullLodInstances()

static void cullLodInstances ( QByteArray lodData,
const void instances,
int  count,
const QVector3D cameraPosition,
float  minThreshold,
float  maxThreshold 
)
static

Definition at line 2249 of file qssglayerrenderdata.cpp.

References QByteArray::data(), i, QSSGRenderInstanceTableEntry::row0, QSSGRenderInstanceTableEntry::row1, QSSGRenderInstanceTableEntry::row2, QVector4D::w(), QVector3D::x(), QVector3D::y(), and QVector3D::z().

Referenced by QSSGSubsetRenderable::prepareInstancing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effectiveMaxLightCount()

static int effectiveMaxLightCount ( const QSSGShaderFeatures features)
inlinestatic

Definition at line 1676 of file qssglayerrenderdata.cpp.

References QSSGShaderFeatures::isSet(), QSSG_MAX_NUM_LIGHTS, QSSG_REDUCED_MAX_NUM_LIGHTS, and QSSGShaderFeatures::ReduceMaxNumLights.

Referenced by QSSGLayerRenderData::prepareForRender().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ furthestToNearestCompare()

static constexpr bool furthestToNearestCompare ( const QSSGRenderableObjectHandle lhs,
const QSSGRenderableObjectHandle rhs 
)
inlinestaticconstexprnoexcept

Definition at line 121 of file qssglayerrenderdata.cpp.

Referenced by QSSGLayerRenderData::getSortedScreenTextureRenderableObjects(), and QSSGLayerRenderData::getSortedTransparentRenderableObjects().

+ Here is the caller graph for this function:

◆ getCameraDataImpl()

static QSSGCameraRenderData getCameraDataImpl ( const QSSGRenderCamera camera)
static

Definition at line 258 of file qssglayerrenderdata.cpp.

References camera, QSSGClipPlane::d, dir, QVector3D::dotProduct(), QSSGClipPlane::normal, ret, mat33::transform(), and Qt::Uninitialized.

Referenced by QSSGLayerRenderData::getCameraRenderData(), and QSSGLayerRenderData::getCameraRenderData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCameraDistanceSq()

static float getCameraDistanceSq ( const QSSGRenderableObject obj,
const QSSGCameraRenderData camera 
)
inlinestaticnoexcept

Definition at line 293 of file qssglayerrenderdata.cpp.

References camera, and QVector3D::dotProduct().

Referenced by QSSGLayerRenderData::prepareModelsForRender(), and QSSGLayerRenderData::prepareParticlesForRender().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasDirtyNonJointNodes()

static bool hasDirtyNonJointNodes ( QSSGRenderNode node,
bool &  hasChildJoints 
)
static

Definition at line 149 of file qssglayerrenderdata.cpp.

References child, QSSGRenderNode::children, hasDirtyNonJointNodes(), QSSGRenderNode::isDirty(), ret, and QSSGRenderGraphObject::type.

Referenced by hasDirtyNonJointNodes(), and updateDirtySkeletons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maybeQueueNodeForRender()

static bool maybeQueueNodeForRender ( QSSGRenderNode inNode,
QVector< QSSGRenderableNodeEntry > &  outRenderableModels,
int &  ioRenderableModelsCount,
QVector< QSSGRenderableNodeEntry > &  outRenderableParticles,
int &  ioRenderableParticlesCount,
QVector< QSSGRenderItem2D * > &  outRenderableItem2Ds,
int &  ioRenderableItem2DsCount,
QVector< QSSGRenderCamera * > &  outCameras,
int &  ioCameraCount,
QVector< QSSGRenderLight * > &  outLights,
int &  ioLightCount,
QVector< QSSGRenderReflectionProbe * > &  outReflectionProbes,
int &  ioReflectionProbeCount,
quint32 ioDFSIndex 
)
static

Definition at line 199 of file qssglayerrenderdata.cpp.

References QSSGRenderNode::Active, QSSGRenderNode::calculateGlobalVariables(), QSSGRenderNode::children, collectNode(), collectNodeFront(), QSSGRenderNode::dfsIndex, QSSGRenderNode::getGlobalState(), QSSGRenderNode::GlobalValuesDirty, QSSGRenderGraphObject::isCamera(), QSSGRenderNode::isDirty(), QSSGRenderLight::isEnabled(), QSSGRenderGraphObject::isLight(), QSSGRenderGraphObject::isRenderable(), maybeQueueNodeForRender(), and QSSGRenderGraphObject::type.

Referenced by maybeQueueNodeForRender(), and QSSGLayerRenderData::prepareForRender().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nearestToFurthestCompare()

static constexpr bool nearestToFurthestCompare ( const QSSGRenderableObjectHandle lhs,
const QSSGRenderableObjectHandle rhs 
)
inlinestaticconstexprnoexcept

Definition at line 116 of file qssglayerrenderdata.cpp.

Referenced by QSSGLayerRenderData::getSortedBakedLightingModels(), and QSSGLayerRenderData::getSortedOpaqueRenderableObjects().

+ Here is the caller graph for this function:

◆ Q_LOGGING_CATEGORY()

QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY ( lcQuick3DRender  ,
"qt.quick3d.render"   
)

◆ RENDER_FRAME_NEW()

template<typename T , typename... Args>
Q_REQUIRED_RESULT T * RENDER_FRAME_NEW ( QSSGRenderContextInterface ctx,
Args &&...  args 
)
inline

Usage: T *ptr = RENDER_FRAME_NEW<T>(context, arg0, arg1, ...); is equivalent to: T *ptr = new T(arg0, arg1, ...); so RENDER_FRAME_NEW() takes the RCI + T's arguments

Definition at line 452 of file qssglayerrenderdata.cpp.

References args.

◆ RENDER_FRAME_NEW_BUFFER()

template<typename T >
Q_REQUIRED_RESULT QSSGDataRef< T > RENDER_FRAME_NEW_BUFFER ( QSSGRenderContextInterface ctx,
size_t  count 
)
inline

Definition at line 459 of file qssglayerrenderdata.cpp.

◆ scopeLight()

static bool scopeLight ( QSSGRenderNode node,
QSSGRenderNode lightScope 
)
static

Definition at line 1663 of file qssglayerrenderdata.cpp.

References QSSGRenderNode::parent.

Referenced by QSSGLayerRenderData::prepareForRender().

+ Here is the caller graph for this function:

◆ sortInstances()

static void sortInstances ( QByteArray sortedData,
QList< QSSGRhiSortData > &  sortData,
const void instances,
int  stride,
int  count,
const QVector3D cameraDirection 
)
static

Definition at line 2220 of file qssglayerrenderdata.cpp.

References QList< T >::begin(), QByteArray::data(), QVector3D::dotProduct(), QList< T >::end(), i, pos, Q_ASSERT, QList< T >::resize(), QSSGRenderInstanceTableEntry::row0, QSSGRenderInstanceTableEntry::row1, QSSGRenderInstanceTableEntry::row2, and QVector4D::w().

Referenced by QSSGSubsetRenderable::prepareInstancing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateDirtySkeletons()

void updateDirtySkeletons ( const QVector< QSSGRenderableNodeEntry > &  renderableNodes)

Definition at line 1684 of file qssglayerrenderdata.cpp.

References BONEDATASIZE4ID, child, QSet< T >::clear(), collectBoneTransforms(), QSet< T >::contains(), hasDirtyNonJointNodes(), i, QSet< T >::insert(), MAX_MORPH_TARGET_INDEX_SUPPORTS_NORMALS, MAX_MORPH_TARGET_INDEX_SUPPORTS_TANGENTS, qCeil(), qSqrt(), QSSGRenderModel::skeleton, QSSGRenderNode::TransformDirty, and QSSGRenderMorphTarget::weight.

Referenced by QSSGLayerRenderData::prepareForRender().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ REDUCED_MAX_LIGHT_COUNT_THRESHOLD_BYTES

const int REDUCED_MAX_LIGHT_COUNT_THRESHOLD_BYTES = 4096
static

Definition at line 1674 of file qssglayerrenderdata.cpp.

Referenced by QSSGLayerRenderData::prepareForRender().

◆ s_ProgressiveAAVertexOffsets

const QVector2D s_ProgressiveAAVertexOffsets[QSSGLayerRenderData::MAX_AA_LEVELS]
static
Initial value:
= {
QVector2D(-0.170840f, -0.553840f),
QVector2D(0.162960f, -0.319340f),
QVector2D(0.360260f, -0.245840f),
QVector2D(-0.561340f, -0.149540f),
QVector2D(0.249460f, 0.453460f),
QVector2D(-0.336340f, 0.378260f),
QVector2D(0.340000f, 0.166260f),
QVector2D(0.235760f, 0.527760f),
}
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31

Definition at line 74 of file qssglayerrenderdata.cpp.

Referenced by QSSGLayerRenderData::prepareForRender().