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
qssglayerrenderdata.cpp File Reference

(411f84ca14da77f1d3c46dad44c3784d5a1ed1eb)

#include "qssglayerrenderdata_p.h"
#include <QtQuick3DRuntimeRender/private/qssgrhiresourcehandle_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/qssgrendercomputepass_p.h>
#include "../graphobjects/qssgrenderroot_p.h"
#include "../qssgrendercontextcore.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 <QtQuick3DRuntimeRender/private/qssgdebugdrawsystem_p.h>
#include <QtQuick3DRuntimeRender/private/qssgshadermaterialadapter_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/qspan.h>
#include <array>
#include <numeric>
#include "qssgrenderpass_p.h"
#include "rendererimpl/qssgrenderhelpers_p.h"
Include dependency graph for qssglayerrenderdata.cpp:

Go to the source code of this file.

Classes

struct  LayerNodeStatResult

Macros

#define POS4BONETRANS(x)
#define POS4BONENORM(x)
#define BONEDATASIZE4ID(x)
#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_STATIC_LOGGING_CATEGORY (lcQuick3DRender, "qt.quick3d.render")
static bool checkParticleSupport (QRhi *rhi)
static LayerNodeStatResult statLayerNodes (const QSSGLayerRenderData::LayerNodes &layerNodes, quint32 layerMask)
static void warnMissingPosition ()
static bool isObjectCullable (const QSSGClippingFrustum &clipFrustum, const QSSGRenderableObject &objobj)
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 (const QSSGLayerRenderData &renderData, QSSGRenderNode *node, QSSGRenderSkeleton *skeletonNode, const QVector< QMatrix4x4 > &poses)
static bool hasDirtyNonJointNodes (QSSGRenderNode *node, bool &hasChildJoints)
static float getCameraDistanceSq (const QSSGRenderableObject &objobj, const QSSGRenderCameraData &camera) noexcept
static constexpr QSSGPrepContextId createPrepId (size_t indexindex, quint32 frame)
static constexpr size_t getPrepContextIndex (QSSGPrepContextId idid)
static constexpr bool verifyPrepContext (QSSGPrepContextId idid, const QSSGRenderer &renderer)
static void createRenderablesHelper (QSSGLayerRenderData &layerlayer, const QSSGRenderNode::ChildList &children, QSSGLayerRenderData::RenderableNodeEntries &renderables, QSSGRenderHelpers::CreateFlags createFlags)
static constexpr size_t pipelineStateIndex (QSSGRenderablesFilter filterfilter)
template<typename T, typename... Args>
T * RENDER_FRAME_NEW (QSSGRenderContextInterface &ctxctx, Args &&... args)
template<typename T>
QSSGDataRef< T > RENDER_FRAME_NEW_BUFFER (QSSGRenderContextInterface &ctxctx, size_t countcount)
static bool hasCustomBlendMode (const QSSGRenderCustomMaterial &material)
static bool usesAutoInstanceLod (const QSSGRenderModel &model, const QSSGRenderSubset &subset, float lodThreshold)
static void prepareIndirectDraw (QSSGRenderContextInterface &contextInterface, QSSGLayerRenderData &datadata, const QSSGRenderGeometry &geometry, QSSGSubsetRenderable &renderable)
static bool scopeLight (QSSGRenderNode *node, QSSGRenderNode *lightScope)
static int effectiveMaxLightCount (const QSSGShaderFeatures &features)
static int effectiveMaxDirectionalLightCount (const QSSGShaderFeatures &features)
static void updateDirtySkeletons (const QSSGLayerRenderData &renderData, const QSSGLayerRenderData::QSSGModelsView &renderableNodes)
template<typename T>
static void clearTable (std::vector< T > &entryentry)
static QSpan< const QSSGRenderInstanceTableEntry > instanceEntries (const void *datadata, qsizetype byteSize, int countcount)
static QSpan< QSSGRenderInstanceTableEntry > instanceEntries (QByteArray &datadata)
static QVector3D instanceWorldPosition (const QSSGRenderInstanceTableEntry &instance, const QMatrix4x4 &globalInstanceTransform, const QVector3D &localInstanceTranslation)
static void sortInstances (QSpan< QSSGRenderInstanceTableEntry > sortedInstances, QList< QSSGRhiSortData > &sortData, QSpan< const QSSGRenderInstanceTableEntry > instances, const QMatrix4x4 &globalInstanceTransform, const QVector3D &localInstanceTranslation, const QVector3D &cameraDirection)
static QVector3D instanceMap (const QSSGRenderInstanceTableEntry &instance, const QVector3D &pp)
static std::array< QVector3D, 3 > instanceWorldAxes (const QSSGRenderInstanceTableEntry &instance, const QSSGRhiInstancePlacement &placement)
static float instanceWorldScaleSq (const std::array< QVector3D, 3 > &axes)
static float instanceWorldStretchSq (const std::array< QVector3D, 3 > &axes)
static QSSGRhiInstancePlacement instancePlacement (const QSSGLayerRenderData &layerData, const QSSGSubsetRenderable &renderable)
static void distributeInstancesToLods (QSSGRhiInstanceBufferData::SubsetLodData &subsetLod, QList< quint8 > &levelOfInstance, QSpan< const QSSGRenderInstanceTableEntry > instances, QSpan< const qint32 > sourceInstanceIndices, const QSSGRhiInstancePlacement &placement, const QVector3D &cameraPosition, const QVector3D &cameraDirection, bool orthographic, QSpan< const float > lodDistancesSq, const QSSGClippingFrustum *frustum, bool tint)
static int cullLodInstances (QSSGRhiInstanceBufferData &instanceData, const QSSGRenderInstanceTable &tabletable, const QMatrix4x4 &globalInstanceTransform, const QVector3D &localInstanceTranslation, const QVector3D &cameraPosition, float minThreshold, float maxThreshold)
static bool usesInstanceIndex (const QSSGRenderGraphObject &material)
static QRhiBuffer * prepareInstanceIndices (QSSGRhiContext *rhiCtx, QSSGRhiInstanceBufferData &instanceData, const QSSGRenderInstanceTable &tabletable, bool usesLod)
static QRhiBuffer * prepareAutoLodInstanceIndices (QSSGRhiContext *rhiCtx, QSSGRhiInstanceBufferData::SubsetLodData &subsetLod)

Variables

static const QVector2D s_ProgressiveAAVertexOffsets [QSSGLayerRenderData::MAX_AA_LEVELS]
static constexpr quint16 PREP_CTX_INDEX_MASK = 0xffff
static const int REDUCED_MAX_LIGHT_COUNT_THRESHOLD_BYTES = 5200

Macro Definition Documentation

◆ BONEDATASIZE4ID

#define BONEDATASIZE4ID ( x)
Value:
GLint GLint GLint GLint GLint x
#define POS4BONETRANS(x)

Definition at line 53 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 267 of file qssglayerrenderdata.cpp.

◆ MAX_MORPH_TARGET_INDEX_SUPPORTS_NORMALS

#define MAX_MORPH_TARGET_INDEX_SUPPORTS_NORMALS   3

Definition at line 268 of file qssglayerrenderdata.cpp.

◆ MAX_MORPH_TARGET_INDEX_SUPPORTS_TANGENTS

#define MAX_MORPH_TARGET_INDEX_SUPPORTS_TANGENTS   1

Definition at line 269 of file qssglayerrenderdata.cpp.

◆ POS4BONENORM

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

Definition at line 52 of file qssglayerrenderdata.cpp.

◆ POS4BONETRANS

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

Definition at line 51 of file qssglayerrenderdata.cpp.

Function Documentation

◆ checkParticleSupport()

bool checkParticleSupport ( QRhi * rhi)
static

Definition at line 55 of file qssglayerrenderdata.cpp.

◆ clearTable()

template<typename T>
void clearTable ( std::vector< T > & entry)
static

Definition at line 3306 of file qssglayerrenderdata.cpp.

◆ collectBoneTransforms()

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

Definition at line 219 of file qssglayerrenderdata.cpp.

◆ createPrepId()

constexpr QSSGPrepContextId createPrepId ( size_t index,
quint32 frame )
staticconstexpr

Definition at line 540 of file qssglayerrenderdata.cpp.

◆ createRenderablesHelper()

void createRenderablesHelper ( QSSGLayerRenderData & layer,
const QSSGRenderNode::ChildList & children,
QSSGLayerRenderData::RenderableNodeEntries & renderables,
QSSGRenderHelpers::CreateFlags createFlags )
static

Definition at line 581 of file qssglayerrenderdata.cpp.

◆ cullLodInstances()

int cullLodInstances ( QSSGRhiInstanceBufferData & instanceData,
const QSSGRenderInstanceTable & table,
const QMatrix4x4 & globalInstanceTransform,
const QVector3D & localInstanceTranslation,
const QVector3D & cameraPosition,
float minThreshold,
float maxThreshold )
static

Definition at line 3708 of file qssglayerrenderdata.cpp.

◆ distributeInstancesToLods()

void distributeInstancesToLods ( QSSGRhiInstanceBufferData::SubsetLodData & subsetLod,
QList< quint8 > & levelOfInstance,
QSpan< const QSSGRenderInstanceTableEntry > instances,
QSpan< const qint32 > sourceInstanceIndices,
const QSSGRhiInstancePlacement & placement,
const QVector3D & cameraPosition,
const QVector3D & cameraDirection,
bool orthographic,
QSpan< const float > lodDistancesSq,
const QSSGClippingFrustum * frustum,
bool tint )
static

Definition at line 3601 of file qssglayerrenderdata.cpp.

◆ effectiveMaxDirectionalLightCount()

int effectiveMaxDirectionalLightCount ( const QSSGShaderFeatures & features)
inlinestatic

Definition at line 2445 of file qssglayerrenderdata.cpp.

◆ effectiveMaxLightCount()

int effectiveMaxLightCount ( const QSSGShaderFeatures & features)
inlinestatic

Definition at line 2437 of file qssglayerrenderdata.cpp.

◆ furthestToNearestCompare()

constexpr bool furthestToNearestCompare ( const QSSGRenderableObjectHandle & lhs,
const QSSGRenderableObjectHandle & rhs )
inlinestaticnodiscardconstexprnoexcept

◆ getCameraDistanceSq()

float getCameraDistanceSq ( const QSSGRenderableObject & obj,
const QSSGRenderCameraData & camera )
inlinestaticnodiscardnoexcept

Definition at line 322 of file qssglayerrenderdata.cpp.

◆ getPrepContextIndex()

constexpr size_t getPrepContextIndex ( QSSGPrepContextId id)
staticconstexpr

Definition at line 541 of file qssglayerrenderdata.cpp.

◆ hasCustomBlendMode()

bool hasCustomBlendMode ( const QSSGRenderCustomMaterial & material)
static

Definition at line 1623 of file qssglayerrenderdata.cpp.

◆ hasDirtyNonJointNodes()

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

Definition at line 242 of file qssglayerrenderdata.cpp.

◆ instanceEntries() [1/2]

QSpan< const QSSGRenderInstanceTableEntry > instanceEntries ( const void * data,
qsizetype byteSize,
int count )
static

Definition at line 3463 of file qssglayerrenderdata.cpp.

◆ instanceEntries() [2/2]

QSpan< QSSGRenderInstanceTableEntry > instanceEntries ( QByteArray & data)
static

Definition at line 3470 of file qssglayerrenderdata.cpp.

◆ instanceMap()

QVector3D instanceMap ( const QSSGRenderInstanceTableEntry & instance,
const QVector3D & p )
static

Definition at line 3519 of file qssglayerrenderdata.cpp.

◆ instancePlacement()

QSSGRhiInstancePlacement instancePlacement ( const QSSGLayerRenderData & layerData,
const QSSGSubsetRenderable & renderable )
static

Definition at line 3571 of file qssglayerrenderdata.cpp.

◆ instanceWorldAxes()

std::array< QVector3D, 3 > instanceWorldAxes ( const QSSGRenderInstanceTableEntry & instance,
const QSSGRhiInstancePlacement & placement )
static

Definition at line 3528 of file qssglayerrenderdata.cpp.

◆ instanceWorldPosition()

QVector3D instanceWorldPosition ( const QSSGRenderInstanceTableEntry & instance,
const QMatrix4x4 & globalInstanceTransform,
const QVector3D & localInstanceTranslation )
static

Definition at line 3483 of file qssglayerrenderdata.cpp.

◆ instanceWorldScaleSq()

float instanceWorldScaleSq ( const std::array< QVector3D, 3 > & axes)
static

Definition at line 3544 of file qssglayerrenderdata.cpp.

◆ instanceWorldStretchSq()

float instanceWorldStretchSq ( const std::array< QVector3D, 3 > & axes)
static

Definition at line 3557 of file qssglayerrenderdata.cpp.

◆ isObjectCullable()

bool isObjectCullable ( const QSSGClippingFrustum & clipFrustum,
const QSSGRenderableObject & obj )
static

Definition at line 159 of file qssglayerrenderdata.cpp.

References QSSGRenderableObjectFlags::hasAttributePosition(), QSSGRenderableObject::isInstanced, and QSSGRenderableObject::renderableFlags.

Here is the call graph for this function:

◆ nearestToFurthestCompare()

constexpr bool nearestToFurthestCompare ( const QSSGRenderableObjectHandle & lhs,
const QSSGRenderableObjectHandle & rhs )
inlinestaticnodiscardconstexprnoexcept

◆ pipelineStateIndex()

constexpr size_t pipelineStateIndex ( QSSGRenderablesFilter filter)
staticconstexpr

Definition at line 812 of file qssglayerrenderdata.cpp.

◆ prepareAutoLodInstanceIndices()

QRhiBuffer * prepareAutoLodInstanceIndices ( QSSGRhiContext * rhiCtx,
QSSGRhiInstanceBufferData::SubsetLodData & subsetLod )
static

Definition at line 3959 of file qssglayerrenderdata.cpp.

◆ prepareIndirectDraw()

void prepareIndirectDraw ( QSSGRenderContextInterface & contextInterface,
QSSGLayerRenderData & data,
const QSSGRenderGeometry & geometry,
QSSGSubsetRenderable & renderable )
static

Definition at line 1674 of file qssglayerrenderdata.cpp.

◆ prepareInstanceIndices()

QRhiBuffer * prepareInstanceIndices ( QSSGRhiContext * rhiCtx,
QSSGRhiInstanceBufferData & instanceData,
const QSSGRenderInstanceTable & table,
bool usesLod )
static

Definition at line 3765 of file qssglayerrenderdata.cpp.

◆ Q_STATIC_LOGGING_CATEGORY()

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

◆ RENDER_FRAME_NEW()

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

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 995 of file qssglayerrenderdata.cpp.

◆ RENDER_FRAME_NEW_BUFFER()

template<typename T>
QSSGDataRef< T > RENDER_FRAME_NEW_BUFFER ( QSSGRenderContextInterface & ctx,
size_t count )
inlinenodiscard

Definition at line 1002 of file qssglayerrenderdata.cpp.

◆ scopeLight()

bool scopeLight ( QSSGRenderNode * node,
QSSGRenderNode * lightScope )
static

Definition at line 2424 of file qssglayerrenderdata.cpp.

◆ sortInstances()

void sortInstances ( QSpan< QSSGRenderInstanceTableEntry > sortedInstances,
QList< QSSGRhiSortData > & sortData,
QSpan< const QSSGRenderInstanceTableEntry > instances,
const QMatrix4x4 & globalInstanceTransform,
const QVector3D & localInstanceTranslation,
const QVector3D & cameraDirection )
static

Definition at line 3495 of file qssglayerrenderdata.cpp.

◆ statLayerNodes()

LayerNodeStatResult statLayerNodes ( const QSSGLayerRenderData::LayerNodes & layerNodes,
quint32 layerMask )
static

Definition at line 110 of file qssglayerrenderdata.cpp.

◆ updateDirtySkeletons()

void updateDirtySkeletons ( const QSSGLayerRenderData & renderData,
const QSSGLayerRenderData::QSSGModelsView & renderableNodes )
static

Definition at line 2453 of file qssglayerrenderdata.cpp.

◆ usesAutoInstanceLod()

bool usesAutoInstanceLod ( const QSSGRenderModel & model,
const QSSGRenderSubset & subset,
float lodThreshold )
static

Definition at line 1658 of file qssglayerrenderdata.cpp.

◆ usesInstanceIndex()

bool usesInstanceIndex ( const QSSGRenderGraphObject & material)
static

Definition at line 3752 of file qssglayerrenderdata.cpp.

◆ verifyPrepContext()

constexpr bool verifyPrepContext ( QSSGPrepContextId id,
const QSSGRenderer & renderer )
staticconstexpr

Definition at line 542 of file qssglayerrenderdata.cpp.

◆ warnMissingPosition()

void warnMissingPosition ( )
static

Definition at line 151 of file qssglayerrenderdata.cpp.

Variable Documentation

◆ PREP_CTX_INDEX_MASK

constexpr quint16 PREP_CTX_INDEX_MASK = 0xffff
staticconstexpr

Definition at line 539 of file qssglayerrenderdata.cpp.

◆ REDUCED_MAX_LIGHT_COUNT_THRESHOLD_BYTES

const int REDUCED_MAX_LIGHT_COUNT_THRESHOLD_BYTES = 5200
static

Definition at line 2435 of file qssglayerrenderdata.cpp.

◆ s_ProgressiveAAVertexOffsets

const QVector2D s_ProgressiveAAVertexOffsets
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),
}
constexpr QVector2D() noexcept
Constructs a null vector, i.e.
Definition qvectornd.h:497

Definition at line 140 of file qssglayerrenderdata.cpp.