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
QQuick3DIndirectShaderGeometryPrivate Class Reference

#include <qquick3dindirectshadergeometry_p.h>

Inheritance diagram for QQuick3DIndirectShaderGeometryPrivate:
Collaboration diagram for QQuick3DIndirectShaderGeometryPrivate:

Public Member Functions

 QQuick3DIndirectShaderGeometryPrivate ()
 \qmltype IndirectShaderGeometry \inherits Geometry \inqmlmodule QtQuick3D
Public Member Functions inherited from QQuick3DShaderGeometryBasePrivate
 QQuick3DShaderGeometryBasePrivate ()=default
 QQuick3DShaderGeometryBasePrivate (Flags flagsflags)
Public Member Functions inherited from QQuick3DGeometryPrivate
 QQuick3DGeometryPrivate ()
 QQuick3DGeometryPrivate (Flags flagsflags)
Public Member Functions inherited from QQuick3DObjectPrivate
 QQuick3DObjectPrivate (Type tt, FlagsT ff)
 QQuick3DObjectPrivate (Type tt, Flags ff)
 QQuick3DObjectPrivate (Type tt)
 ~QQuick3DObjectPrivate () override
void init (QQuick3DObject *parent)
QQmlListProperty< QObject > data ()
QQmlListProperty< QObject > resources ()
QQmlListProperty< QQuick3DObject > children ()
QQmlListProperty< QQuickState > states ()
QQmlListProperty< QQuickTransition > transitions ()
QString state () const
void setState (const QString &)
void _q_resourceObjectDeleted (QObject *)
void _q_cleanupContentItem2D ()
quint64 _q_createJSWrapper (QQmlV4ExecutionEnginePtr engine)
void addItemChangeListener (QQuick3DObjectChangeListener *listener, ChangeTypes typestypes)
void updateOrAddItemChangeListener (QQuick3DObjectChangeListener *listener, ChangeTypes typestypes)
void removeItemChangeListener (QQuick3DObjectChangeListener *, ChangeTypes typestypes)
QQuickStateGroup * _states ()
QString dirtyToString () const
void dirty (DirtyType)
void addToDirtyList ()
void removeFromDirtyList ()
bool hasFlag (Flags flag)
void setCulled (bool)
void addChild (QQuick3DObject *)
void removeChild (QQuick3DObject *)
void siblingOrderChanged ()
void refSceneManager (QQuick3DSceneManager &)
void derefSceneManager ()
void updateSubFocusItem (QQuick3DObject *scope, bool focus)
void itemChange (QQuick3DObject::ItemChange, const QQuick3DObject::ItemChangeData &)
virtual void updatePolish ()
void requestSecondaryUpdate ()
Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
void setObjectNameWithoutBindings (const QString &namename)
 QObjectPrivate (decltype(QObjectPrivateVersion) version=QObjectPrivateVersion)
virtual ~QObjectPrivate ()
void deleteChildren ()
void clearBindingStorage ()
void setParent_helper (QObject *)
void moveToThread_helper ()
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
QObjectList receiverList (const char *signal) const
void ensureConnectionData ()
void addConnection (int signal, Connection *cc)
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
bool maybeSignalConnected (uint signalIndex) const
bool isDeclarativeSignalConnected (uint signalIdx) const
void connectNotify (const QMetaMethod &signal)
void disconnectNotify (const QMetaMethod &signal)
void reinitBindingStorageAfterThreadMove ()
virtual std::string flagsForDumping () const
virtual void writeToDebugStream (QDebug &) const
QtPrivate::QPropertyAdaptorSlotObject * getPropertyAdaptorSlotObject (const QMetaProperty &property)
Public Member Functions inherited from QObjectData
 QObjectData ()=default
virtual ~QObjectData ()=0
const QMetaObject * dynamicMetaObject () const

Public Attributes

QQuick3DShaderStorageBuffer * m_buffer = nullptr
int m_offset = 0
int m_drawCount = 1
int m_drawStride = 16
Public Attributes inherited from QQuick3DShaderGeometryBasePrivate
QQuick3DGeometry::PrimitiveType m_primitive = QQuick3DGeometry::PrimitiveType::Triangles
QVector3D m_boundsMinimum
QVector3D m_boundsMaximum
bool m_boundsSet = false
Public Attributes inherited from QQuick3DGeometryPrivate
QByteArray m_vertexBuffer
QByteArray m_targetBuffer
QByteArray m_indexBuffer
QQuick3DGeometry::Attribute m_attributes [MAX_ATTRIBUTE_COUNT]
QVector< Subset > m_subsets
int m_attributeCount = 0
QQuick3DGeometry::TargetAttribute m_targetAttributes [MAX_TARGET_ATTRIBUTE_COUNT]
int m_targetAttributeCount = 0
QQuick3DGeometry::PrimitiveType m_primitiveType = QQuick3DGeometry::PrimitiveType::Triangles
QVector3D m_min
QVector3D m_max
int m_stride = 0
bool m_geometryChanged = true
bool m_geometryBoundsChanged = true
bool m_targetChanged = true
bool m_usesOldTargetSemantics = false
Public Attributes inherited from QQuick3DObjectPrivate
QLazilyAllocated< ExtraData > extra
QVector< QQuick3DObjectPrivate::ChangeListener > changeListeners
QQuickStateGroup * _stateGroup
quint32 dirtyAttributes
QQuick3DObject * nextDirtyItem
QQuick3DObject ** prevDirtyItem
QPointer< QQuick3DSceneManager > sceneManager
int sceneRefCount
QQuick3DObject * parentItem
QList< QQuick3DObject * > childItems
QQuick3DObject * subFocusItem
QSSGRenderGraphObject * spatialNode = nullptr
Type type = Type::Unknown
FlagsT flags = FlagsT(Flags::None)
bool secondaryUpdateRequested = false
bool componentComplete = true
bool preSyncNeeded = false
bool culled
bool sharedResource = false
QQuick3DItem2D * contentItem2d = nullptr
ConnectionMap connectionMap
Public Attributes inherited from QObjectPrivate
ExtraData * extraData
QAtomicPointer< QThreadData > threadData
QAtomicPointer< ConnectionData > connections
union  
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
Public Attributes inherited from QObjectData
QObject * q_ptr
QObject * parent
QObjectList children
uint isWidget: 1
uint blockSig: 1
uint wasDeleted: 1
uint isDeletingChildren: 1
uint sendChildEvents: 1
uint receiveChildEvents: 1
uint isWindow: 1
uint deleteLaterCalled: 1
uint isQuickItem: 1
uint willBeWidget: 1
uint wasWidget: 1
uint receiveParentEvents: 1
uint unused: 20
QAtomicInt postedEvents
QDynamicMetaObjectData * metaObject
QBindingStorage bindingStorage

Additional Inherited Members

Public Types inherited from QQuick3DObjectPrivate
enum class  Flags : quint32 { None = 0x0 , RequiresSecondaryUpdate = 0x1 }
enum  ChangeType {
  Geometry = 0x01 , SiblingOrder = 0x02 , Visibility = 0x04 , Opacity = 0x08 ,
  Destroyed = 0x10 , Parent = 0x20 , Children = 0x40 , Rotation = 0x80 ,
  ImplicitWidth = 0x100 , ImplicitHeight = 0x200 , Enabled = 0x400
}
enum  DirtyType {
  TransformOrigin = 0x00000001 , Transform = 0x00000002 , BasicTransform = 0x00000004 , Position = 0x00000008 ,
  Size = 0x00000010 , ZValue = 0x00000020 , Content = 0x00000040 , Smooth = 0x00000080 ,
  OpacityValue = 0x00000100 , ChildrenChanged = 0x00000200 , ChildrenStackingChanged = 0x00000400 , ParentChanged = 0x00000800 ,
  Clip = 0x00001000 , Window = 0x00002000 , EffectReference = 0x00008000 , Visible = 0x00010000 ,
  HideReference = 0x00020000 , Antialiasing = 0x00040000 , InstanceRootChanged = 0x00080000 , TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position | Window ,
  ComplexTransformUpdateMask = Transform | Window , ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing , ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window
}
using Type = QSSGRenderGraphObject::Type
using FlagsT = std::underlying_type_t<Flags>
 Flags::RequiresSecondaryUpdate indicates that the object needs a secondary update, meaning an additional call to updateSpatialNode() will be made after the first one.
using ConnectionMap = QHash<ConnectionKey, QMetaObject::Connection>
Public Types inherited from QObjectPrivate
typedef void(*) StaticMetaCallFunction(QObject *, QMetaObject::Call, int, void **)
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>
Static Public Member Functions inherited from QQuick3DGeometryPrivate
static QQuick3DGeometry::Attribute::Semantic semanticFromName (const QByteArray &namename)
static QQuick3DGeometry::Attribute::ComponentType toComponentType (QSSGMesh::Mesh::ComponentType componentType)
Static Public Member Functions inherited from QQuick3DObjectPrivate
template<typename SceneContext, typename CallContext, typename Setter>
static void attachWatcherPriv (SceneContext *sceneContext, CallContext *callContext, Setter setter, QQuick3DObject *newO, QObject *oldO)
template<typename Context, typename Setter, typename Object3D>
static void attachWatcher (Context *context, Setter setter, Object3D *newO, Object3D *oldO)
 Attach a object-destroyed-watcher to an object that's not owned.
static QQuick3DObjectPrivate * get (QQuick3DObject *item)
static const QQuick3DObjectPrivate * get (const QQuick3DObject *item)
static QSSGRenderGraphObject * updateSpatialNode (QQuick3DObject *o, QSSGRenderGraphObject *nn)
static void data_append (QQmlListProperty< QObject > *, QObject *)
static qsizetype data_count (QQmlListProperty< QObject > *)
static QObject * data_at (QQmlListProperty< QObject > *, qsizetype)
static void data_clear (QQmlListProperty< QObject > *)
static QObject * resources_at (QQmlListProperty< QObject > *, qsizetype)
static void resources_append (QQmlListProperty< QObject > *, QObject *)
static qsizetype resources_count (QQmlListProperty< QObject > *)
static void resources_clear (QQmlListProperty< QObject > *)
static void children_append (QQmlListProperty< QQuick3DObject > *, QQuick3DObject *)
static qsizetype children_count (QQmlListProperty< QQuick3DObject > *)
static QQuick3DObject * children_at (QQmlListProperty< QQuick3DObject > *, qsizetype)
static void children_clear (QQmlListProperty< QQuick3DObject > *)
static void refSceneManager (QQuick3DObject *objobj, QQuick3DSceneManager &mgr)
static void derefSceneManager (QQuick3DObject *objobj)
Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *cc)
static QObjectPrivate * get (QObject *o)
static const QObjectPrivate * get (const QObject *o)
static void deleteInOwnThread (QObject *objectobject)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType typetype=Qt::AutoConnection)
template<typename Func1, typename Func2>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
static QMetaObject::Connection connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int typetype, const int *typestypes, const QMetaObject *senderMetaObject)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType typetype)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType typetype)
static bool disconnect (const QObject *sender, int signal_index, void **slot)
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot)
Static Public Attributes inherited from QQuick3DGeometryPrivate
static const int MAX_ATTRIBUTE_COUNT = 16
static const int MAX_TARGET_ATTRIBUTE_COUNT = 32

Detailed Description

Definition at line 24 of file qquick3dindirectshadergeometry_p.h.

Constructor & Destructor Documentation

◆ QQuick3DIndirectShaderGeometryPrivate()

QT_BEGIN_NAMESPACE QQuick3DIndirectShaderGeometryPrivate::QQuick3DIndirectShaderGeometryPrivate ( )

\qmltype IndirectShaderGeometry \inherits Geometry \inqmlmodule QtQuick3D

Since
6.13

Geometry generated in the vertex shader, with the draw arguments read from a GPU buffer.

Like \l ShaderGeometry, IndirectShaderGeometry has no vertex data: each position is derived in the vertex shader from VERTEX_INDEX. The difference is where the vertex count comes from. ShaderGeometry takes it from a property on the CPU side, whereas IndirectShaderGeometry reads it, together with the instance count, from a \l ShaderStorageBuffer at draw time. This means a \l ComputePass can decide how much to draw without the count having to be read back to the CPU.

The \l buffer holds one or more draw commands in the layout used by glDrawArraysIndirect and vkCmdDrawIndirect, four 32-bit unsigned integers each:

\badcode struct DrawCommand { uint vertexCount; uint instanceCount; uint firstVertex; uint firstInstance; };

The instance count is part of the command, and INSTANCE_INDEX is available in the vertex shader. For a shaded material to place the instances with INSTANCE_TRANSFORM, set \l{Model::instancing}{instancing} to a \l ShaderInstancing, whose \l{ShaderInstancing::instanceCount}{instanceCount} is then ignored. If the \l Model has other \l{Model::instancing}{instancing} set, its per-instance data is still available to the shader, but the number of instances drawn is determined by the buffer.

Note
Keep firstInstance at zero: the behavior when {firstInstance != 0} differs between graphics APIs.

The following example lets a compute shader decide the number of triangles, and draws them:

\qml View3D { ShaderStorageBuffer { id: argsBuffer size: 16 }

Model { geometry: IndirectShaderGeometry { buffer: argsBuffer } materials: CustomMaterial { vertexShader: "triangles.vert" }

ComputePass { computeShader: "count.comp" property ShaderStorageBuffer drawArgs: argsBuffer commands: [ Dispatch { groupCountX: 1 } ] } } } \endqml

where count.comp writes the command:

\badcode layout(local_size_x = 1) in;

STORAGE_BUFFER(drawArgs, writeonly) { uint vertexCount; uint instanceCount; uint firstVertex; uint firstInstance; }

void main() { vertexCount = 3 * 100; instanceCount = 1; firstVertex = 0; firstInstance = 0; }

Note
IndirectShaderGeometry must be used with a \l CustomMaterial that has a vertex shader, as with \l ShaderGeometry.
Indirect drawing requires a graphics API that supports it: OpenGL 4.0 or newer, OpenGL ES 3.1 or newer, or Vulkan, Metal, or Direct3D. Otherwise nothing is drawn, and a warning is printed.
If the \l buffer gets its content from a \l{ShaderStorageBuffer::bufferProvider}{bufferProvider}, the QRhiBuffer that the render extension supplies must have been created with the QRhiBuffer::IndirectBuffer usage flag.
As with \l ShaderGeometry, the model is not frustum culled and casts no shadows unless \l boundsMinimum and \l boundsMaximum are set. Ray picking hits the box given by the bounds. Without bounds, or with \l ShaderInstancing, the model cannot be picked. Morph targets, skinning, lightmap baking and motion vectors are not supported.
See also
ShaderGeometry, ShaderInstancing, ShaderStorageBuffer, ComputePass

\qmlproperty enumeration IndirectShaderGeometry::primitiveType

How the vertices are assembled into primitives. See \l{ShaderGeometry::primitiveType}.

\qmlproperty vector3d IndirectShaderGeometry::boundsMinimum

One corner of the box the generated vertices stay inside. See \l{ShaderGeometry::boundsMinimum}.

\qmlproperty vector3d IndirectShaderGeometry::boundsMaximum

The opposite corner to \l boundsMinimum.

Definition at line 136 of file qquick3dindirectshadergeometry.cpp.

Member Data Documentation

◆ m_buffer

QQuick3DShaderStorageBuffer* QQuick3DIndirectShaderGeometryPrivate::m_buffer = nullptr

Definition at line 29 of file qquick3dindirectshadergeometry_p.h.

◆ m_drawCount

int QQuick3DIndirectShaderGeometryPrivate::m_drawCount = 1

Definition at line 31 of file qquick3dindirectshadergeometry_p.h.

◆ m_drawStride

int QQuick3DIndirectShaderGeometryPrivate::m_drawStride = 16

Definition at line 32 of file qquick3dindirectshadergeometry_p.h.

◆ m_offset

int QQuick3DIndirectShaderGeometryPrivate::m_offset = 0

Definition at line 30 of file qquick3dindirectshadergeometry_p.h.


The documentation for this class was generated from the following files: