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
qssgrenderableobjects_p.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6
7#ifndef QSSG_RENDER_IMPL_RENDERABLE_OBJECTS_H
8#define QSSG_RENDER_IMPL_RENDERABLE_OBJECTS_H
9
10//
11// W A R N I N G
12// -------------
13//
14// This file is not part of the Qt API. It exists purely as an
15// implementation detail. This header file may change from version to
16// version without notice, or even be removed.
17//
18// We mean it.
19//
20
21#include <QtQuick3DRuntimeRender/private/qssgrendermodel_p.h>
22#include <QtQuick3DRuntimeRender/private/qssgrenderdefaultmaterial_p.h>
23#include <QtQuick3DRuntimeRender/private/qssgrendercustommaterial_p.h>
24#include <QtQuick3DRuntimeRender/private/qssgrenderparticles_p.h>
25#include <QtQuick3DRuntimeRender/private/qssgrendermesh_p.h>
26#include <QtQuick3DRuntimeRender/private/qssgrendershaderkeys_p.h>
27#include <QtQuick3DRuntimeRender/private/qssgrendershadercache_p.h>
28#include <QtQuick3DRuntimeRender/private/qssgrenderableimage_p.h>
29#include <QtQuick3DRuntimeRender/private/qssgrenderlight_p.h>
30#include <QtQuick3DRuntimeRender/private/qssgrenderreflectionprobe_p.h>
31#include <QtQuick3DRuntimeRender/private/qssgrenderclippingfrustum_p.h>
32#include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h>
33
34#include <QtQuick3DUtils/private/qssginvasivelinkedlist_p.h>
35
36#include <array>
37
38QT_BEGIN_NAMESPACE
39
40class QSSGRenderer;
42struct QSSGRenderItem2D;
43
45{
48 Dirty = 1 << 2,
49 CastsShadows = 1 << 3,
60 // The number of target models' attributes are too many
61 // to store in a renderable flag.
62 // They will be recorded in shaderKey.
72};
73
75{
76 void setHasTransparency(bool inHasTransparency)
77 {
78 setFlag(QSSGRenderableObjectFlag::HasTransparency, inHasTransparency);
79 }
80 bool hasTransparency() const { return this->operator&(QSSGRenderableObjectFlag::HasTransparency); }
81 void setCompletelyTransparent(bool inTransparent)
82 {
84 }
86 {
88 }
89 void setDirty(bool inDirty) { setFlag(QSSGRenderableObjectFlag::Dirty, inDirty); }
90 bool isDirty() const { return this->operator&(QSSGRenderableObjectFlag::Dirty); }
91
92 void setCastsShadows(bool inCastsShadows) { setFlag(QSSGRenderableObjectFlag::CastsShadows, inCastsShadows); }
93 bool castsShadows() const { return this->operator&(QSSGRenderableObjectFlag::CastsShadows); }
94
95 void setReceivesShadows(bool inReceivesShadows) { setFlag(QSSGRenderableObjectFlag::ReceivesShadows, inReceivesShadows); }
96 bool receivesShadows() const { return this->operator&(QSSGRenderableObjectFlag::ReceivesShadows); }
97
98 void setReceivesReflections(bool inReceivesReflections) { setFlag(QSSGRenderableObjectFlag::ReceivesReflections, inReceivesReflections); }
100
101 void setCastsReflections(bool inCastsReflections) { setFlag(QSSGRenderableObjectFlag::CastsReflections, inCastsReflections); }
102 bool castsReflections() const { return this->operator&(QSSGRenderableObjectFlag::CastsReflections); }
103
104 void setUsedInBakedLighting(bool inUsedInBakedLighting) { setFlag(QSSGRenderableObjectFlag::UsedInBakedLighting, inUsedInBakedLighting); }
106
107 void setRendersWithLightmap(bool inRendersWithLightmap) { setFlag(QSSGRenderableObjectFlag::RendersWithLightmap, inRendersWithLightmap); }
109
112
114 bool hasAttributeNormal() const { return this->operator&(QSSGRenderableObjectFlag::HasAttributeNormal); }
115
118
121
124
127
130
132 bool hasAttributeColor() const { return this->operator&(QSSGRenderableObjectFlag::HasAttributeColor); }
133
137
141
142 void setPointsTopology(bool v)
143 {
145 }
146 bool isPointsTopology() const
147 {
148 return this->operator&(QSSGRenderableObjectFlag::IsPointsTopology);
149 }
156 }
157
164 }
167};
168
170{
172 bool shadows = false;
174
175 inline bool operator < (const QSSGShaderLight &o) const
176 {
177 // sort by light type
178 if (light->type < o.light->type)
179 return true;
180 // then shadow lights first
181 if (shadows > o.shadows)
182 return true;
183 return false;
184 }
185};
186
195
196// Having this as a QVLA is beneficial mainly because QVector would need to
197// detach somewhere in QSSGLayerRenderPreparationData::prepareForRender so the
198// implicit sharing's benefits do not outweigh the cost of allocations in this case.
200using QSSGShaderLightListView = QSSGDataView<QSSGShaderLight>;
201
203{
212
213 QSSGRenderNode *node = nullptr;
216
217 // FIXME: This is just for the extension API and
218 // should be removed in the future.
225
226 bool isNull() const { return (node == nullptr); }
228 QSSGRenderableNodeEntry(QSSGRenderNode &inNode) : node(&inNode) {}
229 QSSGRenderableNodeEntry(QSSGRenderNode *inNode) : node(inNode) {}
230};
231
232// Used for sorting
234{
236 QSSGRenderableObjectHandle(QSSGRenderableObject *o, float camDistSq, QSSGRenderNodeTag tag)
237 : obj(o)
238 , cameraDistanceSq(camDistSq)
239 , tag(tag)
240 {}
242 float cameraDistanceSq = 0.0f;
244};
246
247using QSSGRenderableObjectList = QVector<QSSGRenderableObjectHandle>;
248
250{
252public:
259
260 // Variables used for picking
263
264 // Used for shadow map bounds when model has instancing
266
268 // For rough sorting for transparency and for depth
270 float depthBiasSq; // Squared as our sorting is based on the square distance!
271 float camdistSq = 0.0f;
273 const Type type;
276 bool isInstanced = false;
277
280 const QVector3D &inWorldCenterPt,
281 const QSSGBounds3 &inBounds,
282 float inDepthBias,
283 float inMinThreshold = -1,
284 float inMaxThreshold = -1)
285
288 , renderableFlags(inFlags)
290 , depthBiasSq(inDepthBias)
291 , type(ty)
292 , instancingLodMin(inMinThreshold)
293 , instancingLodMax(inMaxThreshold)
294 {
295 }
296};
297
298Q_STATIC_ASSERT(std::is_trivially_destructible<QSSGRenderableObject>::value);
299
307
308using QSSGRenderCameraList = QVarLengthArray<QSSGRenderCamera *, 2>;
309using QSSGRenderCameraDataList = QVarLengthArray<QSSGRenderCameraData, 2>;
310using QSSGRenderMvpArray = std::array<QMatrix4x4, 2>; // cannot be dynamic due to QSSGModelContext, must stick with 2 for now
311
312class QSSGSubsetRenderable;
313
314// Different subsets from the same model will get the same
315// model context so we can generate the MVP and normal matrix once
316// and only once per subset.
317class Q_AUTOTEST_EXPORT QSSGModelContext
318{
319 Q_DISABLE_COPY_MOVE(QSSGModelContext)
320public:
321 QSSGModelContext(const QSSGRenderModel &inModel,
322 const QMatrix4x4 &globalTransform,
323 const QMatrix3x3 &inNormalMatrix,
324 const QSSGRenderMvpArray &inModelViewProjections);
325
331};
332
333Q_STATIC_ASSERT(std::is_trivially_destructible<QSSGModelContext>::value);
334
335class QSSGRenderer;
337struct QSSGShadowMapEntry;
338
339class Q_AUTOTEST_EXPORT QSSGSubsetRenderable : public QSSGRenderableObject
340{
341 Q_DISABLE_COPY_MOVE(QSSGSubsetRenderable)
342public:
343 int reflectionProbeIndex = -1;
344 float distanceFromReflectionProbe;
345 quint32 subsetLevelOfDetail = 0;
346 QSSGShaderReflectionProbe reflectionProbe;
347 QSSGRenderer *renderer = nullptr;
348 const QSSGModelContext &modelContext;
349 const QSSGRenderSubset &subset;
350 QRhiBuffer *instanceBuffer = nullptr;
351 QRhiBuffer *instanceIndexBuffer = nullptr;
352 // Automatic per-instance LOD distribution; set in prepareForRender, used in rhiRenderRenderable
353 static constexpr int MaxAutoLodLevels = QSSGRhiInstanceBufferData::MaxAutoLodLevels;
354 bool usesAutoLod = false;
355 int autoLodLevelCount = 0;
356 float autoLodThresholdFactor = 0.0f; // times lods[i].distance gives the world space switch distance
357 // The instances of all the levels, level after level, see QSSGRhiInstanceBufferData::SubsetLodData.
358 QRhiBuffer *autoLodBuffer = nullptr;
359 // The rows in the table of the instances in autoLodBuffer, when a shader reads
360 // INSTANCE_INDEX, see QSSGLayerRenderData::prepareAutoLodInstancing().
361 QRhiBuffer *autoLodInstanceIndexBuffer = nullptr;
362 std::array<int, MaxAutoLodLevels> autoLodInstanceCounts {};
363 QRhiBuffer *indirectBuffer = nullptr;
364 quint32 indirectOffset = 0;
365 quint32 indirectDrawCount = 0;
366 quint32 indirectStride = 0;
367 bool autoLodTint = false;
368 float opacity;
369 const QSSGRenderGraphObject &material;
370 QSSGRenderableImage *firstImage;
371 QSSGShaderDefaultMaterialKey shaderDescription;
372 const QSSGShaderLightListView &lights;
373
374 struct RhiPassData {
375 QRhiGraphicsPipeline *pipeline = nullptr;
376 QRhiShaderResourceBindings *srb = nullptr;
377 };
378
379 struct {
380 // Transient (due to the subsetRenderable being allocated using a
381 // per-frame allocator on every frame), not owned refs from the
382 // rhi-prepare step, used by the rhi-render step.
383 struct {
384 QRhiGraphicsPipeline *pipeline = nullptr;
385 QRhiShaderResourceBindings *srb = nullptr;
386 } mainPass;
387 struct {
388 QRhiGraphicsPipeline *pipeline = nullptr;
389 QRhiShaderResourceBindings *srb = nullptr;
390 } depthPrePass;
391 struct {
392 QRhiGraphicsPipeline *pipeline = nullptr;
393 QRhiShaderResourceBindings *srb[6] = {};
394 } shadowPass;
395 struct {
396 QRhiGraphicsPipeline *pipeline = nullptr;
397 QRhiShaderResourceBindings *srb[6] = {};
398 } reflectionPass;
399 struct {
400 QRhiGraphicsPipeline *pipeline = nullptr;
401 QRhiShaderResourceBindings *srb = nullptr;
402 } normalPass;
403 struct {
404 QRhiGraphicsPipeline *pipeline = nullptr;
405 QRhiShaderResourceBindings *srb = nullptr;
406 } motionVectorPass;
407 RhiPassData userPassData[QSSGUserRenderPassManager::maxUserPassSlots()] {};
408 } rhiRenderData;
409
410 QSSGSubsetRenderable(Type type,
411 QSSGRenderableObjectFlags inFlags,
412 const QVector3D &inWorldCenterPt,
413 QSSGRenderer *rendr,
414 const QSSGRenderSubset &inSubset,
415 const QSSGModelContext &inModelContext,
416 float inOpacity,
417 quint32 inSubsetLevelOfDetail,
418 const QSSGRenderGraphObject &mat,
419 QSSGRenderableImage *inFirstImage,
420 QSSGShaderDefaultMaterialKey inShaderKey,
421 const QSSGShaderLightListView &inLights,
422 bool anyLightHasShadows);
423
424 [[nodiscard]] const QSSGRenderGraphObject &getMaterial() const { return material; }
425};
426
427Q_STATIC_ASSERT(std::is_trivially_destructible<QSSGSubsetRenderable>::value);
428
429/**
430 * A renderable that corresponds to a particles.
431 */
432class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGParticlesRenderable : public QSSGRenderableObject
433{
434 Q_DISABLE_COPY_MOVE(QSSGParticlesRenderable)
435public:
436 QSSGRenderer *renderer = nullptr;
437 const QSSGRenderParticles &particles;
438 QSSGRenderableImage *firstImage;
439 QSSGRenderableImage *colorTable;
440 const QSSGShaderLightListView &lights;
441 QMatrix4x4 globalTransform;
442 float opacity;
443 QSSGShaderParticleMaterialKey shaderDescription;
444
445 struct {
446 // Transient (due to the subsetRenderable being allocated using a
447 // per-frame allocator on every frame), not owned refs from the
448 // rhi-prepare step, used by the rhi-render step.
449 struct {
450 QRhiGraphicsPipeline *pipeline = nullptr;
451 QRhiShaderResourceBindings *srb = nullptr;
452 } mainPass;
453 struct {
454 QRhiGraphicsPipeline *pipeline = nullptr;
455 QRhiShaderResourceBindings *srb = nullptr;
456 } depthPrePass;
457 struct {
458 QRhiGraphicsPipeline *pipeline = nullptr;
459 QRhiShaderResourceBindings *srb[6] = {};
460 } shadowPass;
461 struct {
462 QRhiGraphicsPipeline *pipeline = nullptr;
463 QRhiShaderResourceBindings *srb[6] = {};
464 } reflectionPass;
465 } rhiRenderData;
466
467 QSSGParticlesRenderable(QSSGRenderableObjectFlags inFlags,
468 const QVector3D &inWorldCenterPt,
469 QSSGRenderer *rendr,
470 const QMatrix4x4 &inGlobalTransform,
471 const QSSGRenderParticles &inParticles,
472 QSSGRenderableImage *inFirstImage,
473 QSSGRenderableImage *inColorTable,
474 const QSSGShaderLightListView &inLights,
475 float inOpacity,
476 QSSGShaderParticleMaterialKey inShaderKey);
477};
478
479Q_STATIC_ASSERT(std::is_trivially_destructible<QSSGParticlesRenderable>::value);
480
481
482using QSSGModelsView = QSSGDataView<QSSGRenderModel *>;
483using QSSGParticlesView = QSSGDataView<QSSGRenderParticles *>;
484using QSSGItem2DsView = QSSGDataView<QSSGRenderItem2D *>;
485using QSSGCamerasView = QSSGDataView<QSSGRenderCamera *>;
486using QSSGLightsView = QSSGDataView<QSSGRenderLight *>;
487using QSSGReflectionProbesView = QSSGDataView<QSSGRenderReflectionProbe *>;
488using QSSGNonCategorizedView = QSSGDataView<QSSGRenderNode *>;
489
490QT_END_NAMESPACE
491
492#endif
QSSGRhiShaderPipelinePtr debugObjectShader
QSSGRhiGraphicsPipelineState ps
Type passType() const final
void resetForFrame() final
QSSGRhiGraphicsPipelineState ps
QSSGRenderLayer * layer
QSSGRhiShaderPipelinePtr gridShader
void resetForFrame() final
Type passType() const final
Type passType() const final
std::vector< QSGRenderer * > prepdItem2DRenderers
void resetForFrame() final
static constexpr int MaxBuckets
QSSGRhiGraphicsPipelineState ps
QSSGRenderMotionVectorMapPtr motionVectorMapManager
QSSGRenderableObjectList motionVectorPassObjects[MaxBuckets]
Type passType() const final
QSSGRhiRenderableTexture * rhiMotionVectorTexture
QSSGRenderCamera * camera
QRhiTexture * rhiOverflowTexture
QSSGShaderFeatures shaderFeatures
QRhiShaderResourceBindings * compositeSrb
QSSGRhiShaderPipelinePtr compositeShaderPipeline
QSSGRenderLayer::OITMethod method
void resetForFrame() final
Type passType() const final
QSSGRhiGraphicsPipelineState ps
void setMethod(QSSGRenderLayer::OITMethod m)
void setMethod(QSSGRenderLayer::OITMethod m)
quint32 reportedNodeCount
QSSGShaderFeatures shaderFeatures
QSSGRenderLayer::OITMethod method
QRhiShaderResourceBindings * clearSrb
QSSGRenderableObjectList sortedTransparentObjects
QSSGRhiRenderableTexture * rhiCounterImage
QRhiTextureRenderTarget * renderTarget
Type passType() const final
void resetForFrame() final
QSSGRhiShaderPipelinePtr clearPipeline
QSSGRhiRenderableTexture * rhiDepthTexture
QSSGRhiGraphicsPipelineState ps
QRhiTexture * readbackImage
bool linkedListRequiresResize(QSize dim)
QSSGOITRenderContext * oitRenderContext
QRhiBuffer * rhiCounterBuffer
void resetForFrame() final
Type passType() const final
QSSGShaderFeatures shaderFeatures
QSSGRhiGraphicsPipelineState ps
static void render(const QSSGRenderContextInterface &ctx, const QSSGRhiGraphicsPipelineState &ps, const QSSGRenderableObjectList &sortedOpaqueObjects)
QSSGRenderableObjectList sortedOpaqueObjects
QRect viewport() const
Returns the viewport rectangle.
void drawLine(const QVector3D &startPoint, const QVector3D &endPoint, const QColor &color, bool isPersistent=false)
void recordRenderDebugObjects(QSSGRhiContext *rhiCtx, QSSGRhiGraphicsPipelineState *ps, QRhiShaderResourceBindings *srb, QRhiRenderPassDescriptor *rpDesc)
void drawPoint(const QVector3D &vertex, const QColor &color, bool isPersistent=false)
void prepareGeometry(QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *rub)
static QColor levelOfDetailColor(quint32 lod)
void drawBounds(const QSSGBounds3 &bounds, const QColor &color, bool isPersistent=false)
InstanceTransforms getInstanceTransforms(QSSGRenderNodeHandle h) const
float getGlobalOpacity(const QSSGRenderNode &node) const
LayerNodeView getLayerNodeView(const QSSGRenderLayer &layer) const
float getGlobalOpacity(QSSGRenderNodeHandle h, float defaultValue=1.0f) const
InstanceTransformStore instanceTransforms
GlobalOpacityStore globalOpacities
QMatrix4x4 getGlobalTransform(QSSGRenderNodeHandle h) const
QMatrix4x4 getGlobalTransform(const QSSGRenderNode &node) const
LayerNodeView getLayerNodeView(QSSGRenderLayerHandle h) const
QMatrix4x4 getGlobalTransform(QSSGRenderNodeHandle h, const QMatrix4x4 &defaultValue) const
VersionType stateGeneration() const
InstanceTransforms getInstanceTransforms(const QSSGRenderNode &node) const
VersionType version() const
GlobalTransformStore globalTransforms
NormalMatrixStore normalMatrices
LayerNodeViewStore layerNodes
QSSGLayerRenderPreparationResult(const QRectF &inViewport, QSSGRenderLayer &inLayer)
const QSSGLayerRenderPreparationResultFlags & getFlags() const
QSSGRenderMvpArray modelViewProjections
const QMatrix4x4 globalTransform
const QMatrix3x3 normalMatrix
QSSGDataRef< QSSGSubsetRenderable > subsets
static GlobalStateResult updateGlobalNodeState(QSSGRenderNode *node, const VersionType version)
updateGlobalNodeState
static bool calcInstanceTransforms(QSSGRenderNode *node, const VersionType version, QSSGGlobalRenderNodeData::GlobalTransformStore &globalTransforms, QSSGGlobalRenderNodeData::InstanceTransformStore &instanceTransforms)
calcInstanceTransforms
void releaseRenderData(const QSSGRenderItem2D &item)
void updateItem2DData(QSSGItem2DsView &items, QSSGRenderer *renderer, const QSSGRenderCameraDataList &renderCameraData)
Item2DRenderer getItem2DRenderer(const QSSGRenderItem2D &item) const
const QSSGGlobalRenderNodeDataPtr & globalNodeData() const
ModelViewProjections getModelViewProjection(const QSSGRenderItem2D &item) const
ModelViewProjections getModelViewProjection(QSSGRenderNodeHandle h) const
ModelViewProjections getModelViewProjection(QSSGRenderNodeHandle h) const
void updateModelData(QSSGModelsView &models, QSSGRenderer *renderer, const QSSGRenderCameraDataList &renderCameraData)
QMatrix3x3 getNormalMatrix(const QSSGRenderModel &model) const
const QSSGGlobalRenderNodeDataPtr & globalNodeData() const
QSSGRenderMesh * getMesh(const QSSGRenderModel &model) const
ModelViewProjections getModelViewProjection(const QSSGRenderModel &model) const
MaterialList getMaterials(const QSSGRenderModel &model) const
QMatrix3x3 getNormalMatrix(QSSGRenderNodeHandle h, QMatrix3x3 defaultValue) const
virtual ~QSSGRenderPass()
virtual void resetForFrame()=0
virtual Type passType() const =0
QSSGRenderableObjectFlags renderableFlags
QSSGRenderableObject(Type ty, QSSGRenderableObjectFlags inFlags, const QVector3D &inWorldCenterPt, const QSSGBounds3 &inBounds, float inDepthBias, float inMinThreshold=-1, float inMaxThreshold=-1)
friend class QSSGParticleRenderer
void releaseItem2DData(const QSSGRenderItem2D &item2D)
const std::unique_ptr< QSSGRhiQuadRenderer > & rhiQuadRenderer() const
quint32 frameDepth() const
float dpr() const
friend class QSSGRenderContextInterface
QRect scissorRect() const
void cleanupResources(QSet< QSSGRenderGraphObject * > &resources)
void setViewport(QRect inViewport)
void beginSubLayerRender(QSSGLayerRenderData &inLayer)
const std::unique_ptr< QSSGRhiCubeRenderer > & rhiCubeRenderer() const
void setDpr(float dpr)
void setScissorRect(QRect inScissorRect)
void endSubLayerRender(QSSGLayerRenderData &inLayer)
QSSGRenderContextInterface * contextInterface() const
void resetForFrame() final
std::shared_ptr< QSSGRenderReflectionMap > reflectionMapManager
QSSGRenderableObjectList reflectionPassObjects
std::vector< QSSGRenderReflectionProbe * > reflectionProbes
QSSGRhiGraphicsPipelineState ps
Type passType() const final
Type passType() const final
QSSGRhiRenderableTexture * rhiAoTexture
const QSSGRhiRenderableTexture * rhiDepthTexture
void resetForFrame() final
QSSGRhiShaderPipelinePtr ssaoShaderPipeline
QSSGAmbientOcclusionSettings aoSettings
const QSSGRenderCamera * camera
QSSGRhiGraphicsPipelineState ps
void resetForFrame() final
QSSGRhiGraphicsPipelineState ps
Type passType() const final
std::optional< SkyboxPass > skyboxPass
QSSGShaderFeatures shaderFeatures
QSSGRenderableObjectList sortedOpaqueObjects
std::optional< SkyboxCubeMapPass > skyboxCubeMapPass
QSSGRhiRenderableTexture * rhiScreenTexture
QSSGRenderableObjectList sortedScreenTextureObjects
const QSSGRhiRenderableTexture * rhiScreenTexture
QSSGRhiGraphicsPipelineState ps
Type passType() const final
QSSGRenderCamera * camera
QSSGBounds3 castingObjectsBox
QSSGShaderLightList globalLights
QSSGRenderableObjectList shadowPassObjects
QSSGRhiGraphicsPipelineState ps
QSSGBounds3 receivingObjectsBox
void resetForFrame() final
std::unique_ptr< QSSGRenderCamera > debugCamera
Type passType() const final
std::shared_ptr< QSSGRenderShadowMap > shadowMapManager
QSSGRhiRenderableTexture * offscreenTexture
QRhiShaderResourceBindings * backgroundSrb
Type passType() const final
QSSGRhiShaderPipelinePtr pipeline
QSSGRhiGraphicsPipelineState ps
QRhiRenderPassDescriptor * rpDesc
void resetForFrame() final
Type passType() const final
QRhiRenderPassDescriptor * rpDesc
QSSGRenderLayer * layer
QSSGRhiShaderPipelinePtr skyBoxCubeShader
QSSGRhiGraphicsPipelineState ps
void resetForFrame() final
Type passType() const final
void resetForFrame() final
QRhiRenderPassDescriptor * rpDesc
Type passType() const final
QSSGRenderLayer * layer
QSSGRhiGraphicsPipelineState ps
QSSGRenderableObjectList sortedTransparentObjects
static void render(const QSSGRenderContextInterface &ctx, const QSSGRhiGraphicsPipelineState &ps, const QSSGRenderableObjectList &sortedTransparentObjects)
QSSGShaderFeatures shaderFeatures
QSSGRhiGraphicsPipelineState ps
void resetForFrame() final
Type passType() const final
Type passType() const final
QList< QSSGRenderExtension * > extensions
void resetForFrame() final
void resetForFrame() final
bool hasData() const
QList< QSSGRenderUserPassBase * > userPasses
Type passType() const final
static constexpr size_t MAX_SUBPASS_DEPTH
std::vector< UserPassData > userPassData
std::set< QSSGResourceId > visitedPasses
void resetForFrame() final
QSSGRenderableObjectList renderedOpaqueDepthPrepassObjects
Type passType() const final
QSSGRhiGraphicsPipelineState ps
QSSGRenderableObjectList renderedDepthWriteObjects
QSSGRenderResult::Key toInternalRenderResultKey(QSSGFrameData::RenderResult id)
Combined button and popup list for selecting options.
qsizetype rhiPrepareOverrideMaterialUserPass(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGRhiGraphicsPipelineState &basePipelineState, QRhiRenderPassDescriptor *rpDesc, QSSGRenderGraphObject *overrideMaterial, QSSGLayerRenderData &inData, QSSGRenderableObjectList &inObjects, QSSGShaderFeatures featureSet)
bool setupDrawInputs(QSSGRhiContext *rhiCtx, QRhiGraphicsPipeline *ps, const QSSGSubsetRenderable &renderable, QRhiBuffer *instanceIndexBuffer, QRhiCommandBuffer::VertexInput *vertexBuffers, int &vertexBufferCount, quint32 &instances)
void rhiRenderUserAugmentedPass(QSSGRhiContext *rhiCtx, QSSGRenderableObjectList &inObjects)
quint32 rhiCalculateABufferSize(int nodeCount)
void rhiRenderAoTexture(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, QSSGRenderer &renderer, QSSGRhiShaderPipeline &shaderPipeline, QSSGRhiGraphicsPipelineState &ps, const QSSGAmbientOcclusionSettings &ao, const QSSGRhiRenderableTexture &rhiAoTexture, const QSSGRhiRenderableTexture &rhiDepthTexture, const QSSGRenderCamera &camera)
bool anyAutoLodInstances(const QSSGSubsetRenderable &renderable)
bool bindInstanceIndices(QRhiGraphicsPipeline *ps, QRhiBuffer *instanceIndexBuffer, QRhiCommandBuffer::VertexInput *vertexBuffers, int *vertexBufferCount)
bool rhiPrepareNormalPass(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGRhiGraphicsPipelineState &basePipelineState, QRhiRenderPassDescriptor *rpDesc, QSSGLayerRenderData &inData, const QSSGRenderableObjectList &sortedOpaqueObjects)
bool rhiPrepareMotionVectorTexture(QSSGRhiContext *rhiCtx, const QSize &size, QSSGRhiRenderableTexture *renderableTex)
void rhiRenderReflectionMap(const QSSGRenderContextInterface &context, QSSGPassKey passKey, const QSSGLayerRenderData &inData, QSSGRhiGraphicsPipelineState *ps, QSSGRenderReflectionMap &reflectionMapManager, const std::vector< QSSGRenderReflectionProbe * > &reflectionProbes, const QSSGRenderableObjectList &reflectionPassObjects, QSSGRenderer &renderer)
void rhiRenderNormalPass(QSSGRhiContext *rhiCtx, const QSSGRhiGraphicsPipelineState &ps, const QSSGRenderableObjectList &sortedOpaqueObjects, bool *needsSetViewport)
Q_QUICK3DRUNTIMERENDER_EXPORT void rhiRenderRenderable(QSSGRhiContext *rhiCtx, const QSSGRhiGraphicsPipelineState &state, QSSGRenderableObject &object, bool *needsSetViewport, QSSGRenderTextureCubeFace cubeFace=QSSGRenderTextureCubeFaceNone, qsizetype userPassIndex=-1)
void rhiDrawNonIndexed(QSSGRhiContext *rhiCtx, QRhiCommandBuffer *cb, const QSSGSubsetRenderable &renderable, quint32 instances)
qsizetype rhiPrepareAugmentedUserPass(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGRhiGraphicsPipelineState &basePipelineState, QRhiRenderPassDescriptor *rpDesc, const QSSGUserShaderAugmentation &shaderAugmentation, const QSSGLayerRenderData &inData, QSSGRenderableObjectList &inObjects, QSSGShaderFeatures featureSet)
bool rhiPrepareDepthPass(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGRhiGraphicsPipelineState &basePipelineState, QRhiRenderPassDescriptor *rpDesc, QSSGLayerRenderData &inData, const QSSGRenderableObjectList &sortedOpaqueObjects, const QSSGRenderableObjectList &sortedTransparentObjects, int samples, int viewCount)
qsizetype rhiPrepareOriginalMaterialUserPass(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGRhiGraphicsPipelineState &basePipelineState, QRhiRenderPassDescriptor *rpDesc, const QSSGLayerRenderData &inData, QSSGRenderableObjectList &inObjects, QSSGShaderFeatures featureSet)
bool rhiPrepareScreenTexture(QSSGRhiContext *rhiCtx, const QSize &size, bool wantsMips, QSSGRhiRenderableTexture *renderableTex, quint8 viewCount)
QRect correctViewportCoordinates(const QRectF &layerViewport, const QRect &deviceRect)
void addAccumulatorImageBindings(QSSGRhiShaderPipeline *shaderPipeline, QSSGRhiShaderResourceBindingList &bindings)
bool rhiPrepareDepthTexture(QSSGRhiContext *rhiCtx, const QSize &size, QSSGRhiRenderableTexture *renderableTex, quint8 viewCount, int samples=1)
void rhiRenderMotionVector(QSSGRhiContext *rhiCtx, const QSSGRhiGraphicsPipelineState &state, const QSSGRenderableObjectList *motionVectorPassObjects, int bucketsCount)
void rhiDrawAutoLodInstanced(QSSGRhiContext *rhiCtx, QRhiCommandBuffer *cb, QRhiCommandBuffer::VertexInput *vertexBuffers, int vertexBufferCount, QRhiBuffer *indexBuffer, const QSSGSubsetRenderable &renderable)
Q_AUTOTEST_EXPORT bool rhiPrepareAoTexture(QSSGRhiContext *rhiCtx, const QSize &size, QSSGRhiRenderableTexture *renderableTex, quint8 viewCount)
quint32 rhiCalculateABufferSize(const QSize &size, int levels)
void rhiRenderDepthPass(QSSGRhiContext *rhiCtx, const QSSGRhiGraphicsPipelineState &ps, const QSSGRenderableObjectList &sortedOpaqueObjects, const QSSGRenderableObjectList &sortedTransparentObjects, bool *needsSetViewport)
void addDebugFrustum(const QSSGBoxPoints &frustumPoints, const QColor &color, QSSGDebugDrawSystem *debugDrawSystem)
void addDebugBox(const QSSGBoxPoints &boxUnsorted, const QColor &color, QSSGDebugDrawSystem *debugDrawSystem)
void addDirectionalLightDebugBox(const QSSGBoxPoints &box, QSSGDebugDrawSystem *debugDrawSystem)
#define M_PI_2
Definition qmath.h:205
#define M_PI
Definition qmath.h:201
QSSGLayerRenderPreparationResultFlag
Q_DECLARE_TYPEINFO(QSSGRenderableObjectHandle, Q_PRIMITIVE_TYPE)
QSSGRenderableObjectFlag
QVarLengthArray< QSSGShaderLight, 16 > QSSGShaderLightList
static void setupCubeShadowCameras(const QSSGLayerRenderData &inData, const QSSGRenderLight *inLight, float shadowMapFar, QSSGRenderCamera inCameras[6])
static void updateUniformsForDefaultMaterial(QSSGRhiShaderPipeline &shaderPipeline, QSSGRhiContext *rhiCtx, const QSSGLayerRenderData &inData, char *ubufData, QSSGRhiGraphicsPipelineState *ps, QSSGSubsetRenderable &subsetRenderable, const QSSGRenderCameraList &cameras, const QVector2D *depthAdjust, const QMatrix4x4 *alteredModelViewProjection, const QSSGRenderGraphObject *materialOverride=nullptr)
static QSSGRhiShaderPipelinePtr shadersForParticleMaterial(QSSGRhiGraphicsPipelineState *ps, QSSGParticlesRenderable &particleRenderable, const QSSGShaderFeatures &featureSet)
static QSSGRhiShaderPipelinePtr shadersForDefaultMaterial(QSSGRhiGraphicsPipelineState *ps, QSSGSubsetRenderable &subsetRenderable, const QSSGShaderFeatures &featureSet, const QSSGUserShaderAugmentation &shaderAugmentation={})
static std::unique_ptr< QSSGRenderCamera > computeShadowCameraFromFrustum(const QMatrix4x4 &lightMatrix, const QMatrix4x4 &lightMatrixInverted, const QVector3D &lightPivot, const QVector3D &lightForward, const QVector3D &lightUp, const float shadowMapResolution, const float pcfRadius, const QSSGBoxPoints &frustumPoints, float frustumStartT, float frustumEndT, float frustumRadius, bool lockShadowmapTexels, const QSSGBounds3 &castingBox, const QSSGBounds3 &receivingBox, QSSGDebugDrawSystem *debugDrawSystem, const bool drawCascades, const bool drawSceneCascadeIntersection)
static QRhiViewport calculateAtlasViewport(QSize atlasPixelSize, const QSSGShadowMapEntry::AtlasEntry &atlasEntry, bool yIsUp)
static QSSGBoxPoints sliceFrustum(const QSSGBoxPoints &frustumPoints, float t0, float t1)
static void rhiPrepareSkyBox_helper(const QSSGRenderContextInterface &context, QSSGPassKey passKey, QSSGRenderLayer &layer, QSSGRenderCameraList &cameras, QSSGRenderer &renderer, QSSGReflectionMapEntry *entry=nullptr, QSSGRenderTextureCubeFace cubeFace=QSSGRenderTextureCubeFaceNone, uint tonemapMode=0)
static QT_BEGIN_NAMESPACE constexpr float QSSG_PI
static void rhiPrepareResourcesForReflectionMap(const QSSGRenderContextInterface &context, QSSGPassKey passKey, const QSSGLayerRenderData &inData, QSSGReflectionMapEntry *pEntry, QSSGRhiGraphicsPipelineState *ps, const QSSGRenderableObjectList &sortedOpaqueObjects, QSSGRenderCamera &inCamera, QSSGRenderer &renderer, QSSGRenderTextureCubeFace cubeFace)
static void rhiPrepareResourcesForShadowMap(QSSGRhiContext *rhiCtx, const QSSGLayerRenderData &inData, QSSGPassKey passKey, QSSGShadowMapEntry *pEntry, QSSGRhiGraphicsPipelineState *ps, const QVector2D *depthAdjust, const QSSGRenderableObjectList &sortedOpaqueObjects, QSSGRenderCamera &inCamera, bool orthographic, QSSGRenderTextureCubeFace cubeFace, quint32 cascadeIndex)
static void addOpaqueDepthPrePassBindings(QSSGRhiContext *rhiCtx, QSSGRhiShaderPipeline *shaderPipeline, QSSGRenderableImage *renderableImage, QSSGRhiShaderResourceBindingList &bindings, bool isCustomMaterialMeshSubset=false)
static QSSGBoxPoints computeFrustumBounds(const QMatrix4x4 &projection)
static void addNormalTextureBindings(QSSGRhiContext *rhiCtx, QSSGRhiShaderPipeline *shaderPipeline, QSSGRhiShaderResourceBindingList &bindings)
static const QRhiShaderResourceBinding::StageFlags RENDERER_VISIBILITY_ALL
static QRhiShaderResourceBindings * drawCallDataSrb(QSSGRhiContextPrivate *rhiCtxD, QSSGRhiDrawCallData &dcd, const QSSGRhiShaderResourceBindingList &bindings)
static constexpr float QSSG_HALFPI
static int setupInstancing(QSSGSubsetRenderable *renderable, QSSGRhiGraphicsPipelineState *ps, QSSGRhiContext *rhiCtx, const QSSGLayerRenderData &inData, const QVector3D &cameraDirection, const QVector3D &cameraPosition, InstanceLevels instanceLevels, const QSSGRhiShaderPipeline &shaders)
void rhiPrepareRenderableImp(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, const QSSGLayerRenderData &inData, QSSGRenderableObject &inObject, QRhiRenderPassDescriptor *renderPassDescriptor, QSSGRhiGraphicsPipelineState *ps, QSSGShaderFeatures featureSet, int samples, int viewCount, bool screenMapPass, QSSGRenderCamera *alteredCamera, QMatrix4x4 *alteredModelViewProjection, QSSGRenderTextureCubeFace cubeFace, QSSGReflectionMapEntry *entry, bool oit)
static void setupCubeReflectionCameras(const QSSGLayerRenderData &inData, const QSSGRenderReflectionProbe *inProbe, QSSGRenderCamera inCameras[6])
static void fillTargetBlend(QRhiGraphicsPipeline::TargetBlend *targetBlend, QSSGRenderDefaultMaterial::MaterialBlendMode materialBlend)
static void addDepthTextureBindings(QSSGRhiContext *rhiCtx, QSSGRhiShaderPipeline *shaderPipeline, QSSGRhiShaderResourceBindingList &bindings, QBitArray *specifiedBindings=nullptr)
static QVarLengthArray< std::unique_ptr< QSSGRenderCamera >, 4 > setupCascadingCamerasForShadowMap(const QSSGLayerRenderData &data, const QSSGRenderCamera &inCamera, const QSSGRenderLight *inLight, const int shadowMapResolution, const float pcfRadius, const float clipNear, const float clipFar, const QSSGBounds3 &castingObjectsBox, const QSSGBounds3 &receivingObjectsBox, bool lockShadowmapTexels, QSSGDebugDrawSystem *debugDrawSystem, bool drawCascades, bool drawSceneCascadeIntersection)
QSqlQueryModel * model
[16]
QVector< QSSGRenderableObjectHandle > renderables
QSSGBakedLightingModel(const QSSGRenderModel *model, const QVector< QSSGRenderableObjectHandle > &renderables)
const QSSGRenderModel * model
QSSGRenderLight::SoftShadowQuality maxSoftShadowQuality
QSSGDefaultMaterialPreparationResult(QSSGShaderDefaultMaterialKey inMaterialKey)
QSSGShaderDefaultMaterialKey materialKey
QRhiReadbackResult * pendingResult
QList< QRhiReadbackResult * > completedResults
QRhiTextureRenderTarget * oitRenderTarget
QRhiResourceUpdateBatch * rub
QRhiRenderPassDescriptor * renderPassDescriptor
std::optional< QSSGClippingFrustum > clippingFrustum
QSSGShaderLightListView lights
QSSGRenderableNodeEntry()=default
void setRendersWithLightmap(bool inRendersWithLightmap)
void setCompletelyTransparent(bool inTransparent)
void setCastsReflections(bool inCastsReflections)
void setCastsShadows(bool inCastsShadows)
void setReceivesReflections(bool inReceivesReflections)
void setUsedInBakedLighting(bool inUsedInBakedLighting)
void setHasTransparency(bool inHasTransparency)
void setReceivesShadows(bool inReceivesShadows)
QSSGRenderableObjectHandle(QSSGRenderableObject *o, float camDistSq, QSSGRenderNodeTag tag)
QSSGRenderableObjectHandle()=default
bool operator<(const QSSGShaderLight &o) const
QSSGRenderLight * light
QSSGRhiRenderableTextureV2Ptr renderableTexture
std::optional< SkyboxCubeMapPass > skyboxCubeMapPass
std::vector< UserPassData > subPassData
QSSGRhiGraphicsPipelineState ps
QSSGShaderDefineList shaderDefines
QRhiDepthStencilClearValue depthStencilClearValue
QSSGRenderableObjectList renderables
std::optional< SkyboxPass > skyboxPass
QSSGRenderUserPass * passNode
std::optional< Item2DPass > item2DPass