Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QSGBatchRenderer Namespace Reference

Classes

class  Allocator
 
class  AllocatorPage
 
struct  Batch
 
struct  BatchRootInfo
 
struct  Buffer
 
struct  ClipBatchRootInfo
 
struct  ClipState
 
struct  DrawSet
 
struct  Element
 
struct  GraphicsPipelineStateKey
 
struct  GraphicsState
 
struct  Node
 
struct  Pt
 
struct  Rect
 
class  Renderer
 
struct  RenderNodeElement
 
struct  RenderNodeState
 
struct  RenderPassState
 
class  RhiVisualizer
 
struct  ShaderKey
 
class  ShaderManager
 
struct  ShaderManagerShader
 
struct  StencilClipState
 
class  Updater
 
class  Visualizer
 

Enumerations

enum  BatchCompatibility { BatchBreaksOnCompare , BatchIsCompatible }
 

Functions

static int size_of_type (int type)
 
bool qsg_sort_element_increasing_order (Element *a, Element *b)
 
bool qsg_sort_element_decreasing_order (Element *a, Element *b)
 
bool qsg_sort_batch_is_valid (Batch *a, Batch *b)
 
bool qsg_sort_batch_increasing_order (Batch *a, Batch *b)
 
bool qsg_sort_batch_decreasing_order (Batch *a, Batch *b)
 
static bool isTranslate (const QMatrix4x4 &m)
 
static bool isScale (const QMatrix4x4 &m)
 
static bool is2DSafe (const QMatrix4x4 &m)
 
template<class Int >
Int aligned (Int v, Int byteAlign)
 
QRhiVertexInputAttribute::Format qsg_vertexInputFormat (const QSGGeometry::Attribute &a)
 
static QRhiVertexInputLayout calculateVertexInputLayout (const QSGMaterialShader *s, const QSGGeometry *geometry, bool batchable)
 
QRhiCommandBuffer::IndexFormat qsg_indexFormat (const QSGGeometry *geometry)
 
QRhiGraphicsPipeline::Topology qsg_topology (int geomDrawMode)
 
void qsg_setMultiViewFlagsOnMaterial (QSGMaterial *material, int multiViewCount)
 
void qsg_dumpShadowRoots (BatchRootInfo *i, int indent)
 
void qsg_dumpShadowRoots (Node *n)
 
int qsg_positionAttribute (QSGGeometry *g)
 
static int qsg_countNodesInBatch (const Batch *batch)
 
static int qsg_countNodesInBatches (const QDataBuffer< Batch * > &batches)
 
static void qsg_wipeBuffer (Buffer *buffer)
 
static void qsg_wipeBatch (Batch *batch)
 
static void qsg_addOrphanedElements (QDataBuffer< Element * > &orphans, const QDataBuffer< Element * > &renderList)
 
static void qsg_addBackOrphanedElements (QDataBuffer< Element * > &orphans, QDataBuffer< Element * > &renderList)
 
static int qsg_fixIndexCount (int iCount, int drawMode)
 
static float calculateElementZOrder (const Element *e, qreal zRange)
 
QMatrix4x4 qsg_matrixForRoot (Node *node)
 
static bool needsBlendConstant (QRhiGraphicsPipeline::BlendFactor f)
 
static QRhiSamplernewSampler (QRhi *rhi, const QSGSamplerDescription &desc)
 
static void rendererToMaterialGraphicsState (QSGMaterialShader::GraphicsPipelineState *dst, GraphicsState *src)
 
static void materialToRendererGraphicsState (GraphicsState *dst, QSGMaterialShader::GraphicsPipelineState *src)
 
bool operator== (const GraphicsState &a, const GraphicsState &b) noexcept
 
bool operator!= (const GraphicsState &a, const GraphicsState &b) noexcept
 
size_t qHash (const GraphicsState &s, size_t seed) noexcept
 
bool operator== (const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKey &b) noexcept
 
bool operator!= (const GraphicsPipelineStateKey &a, const GraphicsPipelineStateKey &b) noexcept
 
size_t qHash (const GraphicsPipelineStateKey &k, size_t seed) noexcept
 
bool operator== (const ShaderKey &a, const ShaderKey &b) noexcept
 
bool operator!= (const ShaderKey &a, const ShaderKey &b) noexcept
 
size_t qHash (const ShaderKey &k, size_t seed) noexcept
 
bool hasMaterialWithBlending (QSGGeometryNode *n)
 
QDebug operator<< (QDebug d, const Pt &p)
 
QDebug operator<< (QDebug d, const Rect &r)
 
static void fillVertexIndex (RhiVisualizer::DrawCall *dc, QSGGeometry *g, bool withData, bool forceUintIndex)
 
static uint aligned (uint v, uint byteAlign)
 
static bool ensureBuffer (QRhi *rhi, QRhiBuffer **buf, QRhiBuffer::UsageFlags usage, quint32 newSize)
 

Variables

QSGMaterial::Flag QSGMaterial_FullMatrix = (QSGMaterial::Flag) (QSGMaterial::RequiresFullMatrix & ~QSGMaterial::RequiresFullMatrixExceptTranslate)
 
const float OPAQUE_LIMIT = 0.999f
 
const uint DYNAMIC_VERTEX_INDEX_BUFFER_THRESHOLD = 4
 
const int VERTEX_BUFFER_BINDING = 0
 
const int ZORDER_BUFFER_BINDING = VERTEX_BUFFER_BINDING + 1
 
const float VIEWPORT_MIN_DEPTH = 0.0f
 
const float VIEWPORT_MAX_DEPTH = 1.0f
 
const QRhiShaderResourceBinding::StageFlags ubufVisibility
 

Enumeration Type Documentation

◆ BatchCompatibility

Enumerator
BatchBreaksOnCompare 
BatchIsCompatible 

Definition at line 354 of file qsgbatchrenderer_p.h.

Function Documentation

◆ aligned() [1/2]

template<class Int >
Int QSGBatchRenderer::aligned ( Int v,
Int byteAlign )
inline

Definition at line 91 of file qsgbatchrenderer.cpp.

◆ aligned() [2/2]

static uint QSGBatchRenderer::aligned ( uint v,
uint byteAlign )
inlinestatic

Definition at line 250 of file qsgrhivisualizer.cpp.

◆ calculateElementZOrder()

static float QSGBatchRenderer::calculateElementZOrder ( const Element * e,
qreal zRange )
inlinestatic

◆ calculateVertexInputLayout()

static QRhiVertexInputLayout QSGBatchRenderer::calculateVertexInputLayout ( const QSGMaterialShader * s,
const QSGGeometry * geometry,
bool batchable )
static

◆ ensureBuffer()

static bool QSGBatchRenderer::ensureBuffer ( QRhi * rhi,
QRhiBuffer ** buf,
QRhiBuffer::UsageFlags usage,
quint32 newSize )
static

Definition at line 255 of file qsgrhivisualizer.cpp.

References QRhiBuffer::Dynamic, QRhi::newBuffer(), and QRhiBuffer::setSize().

+ Here is the call graph for this function:

◆ fillVertexIndex()

static void QSGBatchRenderer::fillVertexIndex ( RhiVisualizer::DrawCall * dc,
QSGGeometry * g,
bool withData,
bool forceUintIndex )
static

Definition at line 234 of file qsgrhivisualizer.cpp.

References QSGBatchRenderer::RhiVisualizer::DrawCall::index, QRhiCommandBuffer::IndexUInt32, qsg_indexFormat(), qsg_topology(), qsg_vertexInputFormat(), and QSGBatchRenderer::RhiVisualizer::DrawCall::vertex.

+ Here is the call graph for this function:

◆ hasMaterialWithBlending()

bool QSGBatchRenderer::hasMaterialWithBlending ( QSGGeometryNode * n)
inline

Definition at line 179 of file qsgbatchrenderer_p.h.

References QSGMaterial::Blending.

Referenced by QSGBatchRenderer::Renderer::nodeChanged(), and QSGBatchRenderer::Element::setNode().

+ Here is the caller graph for this function:

◆ is2DSafe()

static bool QSGBatchRenderer::is2DSafe ( const QMatrix4x4 & m)
static

Definition at line 79 of file qsgbatchrenderer.cpp.

References QMatrix4x4::Rotation.

Referenced by QSGBatchRenderer::Batch::isSafeToBatch().

+ Here is the caller graph for this function:

◆ isScale()

static bool QSGBatchRenderer::isScale ( const QMatrix4x4 & m)
static

Definition at line 78 of file qsgbatchrenderer.cpp.

References QMatrix4x4::Scale.

Referenced by QSGBatchRenderer::Rect::map().

+ Here is the caller graph for this function:

◆ isTranslate()

static bool QSGBatchRenderer::isTranslate ( const QMatrix4x4 & m)
static

Definition at line 77 of file qsgbatchrenderer.cpp.

References QMatrix4x4::Translation.

Referenced by QSGBatchRenderer::Updater::visitGeometryNode().

+ Here is the caller graph for this function:

◆ materialToRendererGraphicsState()

static void QSGBatchRenderer::materialToRendererGraphicsState ( GraphicsState * dst,
QSGMaterialShader::GraphicsPipelineState * src )
static

Definition at line 2867 of file qsgbatchrenderer.cpp.

◆ needsBlendConstant()

◆ newSampler()

static QRhiSampler * QSGBatchRenderer::newSampler ( QRhi * rhi,
const QSGSamplerDescription & desc )
static

Definition at line 2748 of file qsgbatchrenderer.cpp.

References QRhiSampler::ClampToEdge, QSGTexture::ClampToEdge, QRhiSampler::Linear, QSGTexture::Linear, QRhiSampler::Mirror, QSGTexture::MirroredRepeat, QRhiSampler::Nearest, QSGTexture::Nearest, QRhi::newSampler(), QRhiSampler::None, QSGTexture::None, Q_FALLTHROUGH, QRhiSampler::Repeat, and QSGTexture::Repeat.

+ Here is the call graph for this function:

◆ operator!=() [1/3]

bool QSGBatchRenderer::operator!= ( const GraphicsPipelineStateKey & a,
const GraphicsPipelineStateKey & b )
noexcept

Definition at line 4184 of file qsgbatchrenderer.cpp.

◆ operator!=() [2/3]

bool QSGBatchRenderer::operator!= ( const GraphicsState & a,
const GraphicsState & b )
noexcept

Definition at line 4155 of file qsgbatchrenderer.cpp.

◆ operator!=() [3/3]

bool QSGBatchRenderer::operator!= ( const ShaderKey & a,
const ShaderKey & b )
noexcept

Definition at line 4204 of file qsgbatchrenderer.cpp.

◆ operator<<() [1/2]

QDebug QSGBatchRenderer::operator<< ( QDebug d,
const Pt & p )
inline

Definition at line 203 of file qsgbatchrenderer_p.h.

References d.

◆ operator<<() [2/2]

QDebug QSGBatchRenderer::operator<< ( QDebug d,
const Rect & r )
inline

Definition at line 256 of file qsgbatchrenderer_p.h.

References d.

◆ operator==() [1/3]

bool QSGBatchRenderer::operator== ( const GraphicsPipelineStateKey & a,
const GraphicsPipelineStateKey & b )
noexcept

Definition at line 4176 of file qsgbatchrenderer.cpp.

◆ operator==() [2/3]

bool QSGBatchRenderer::operator== ( const GraphicsState & a,
const GraphicsState & b )
noexcept

Definition at line 4134 of file qsgbatchrenderer.cpp.

◆ operator==() [3/3]

bool QSGBatchRenderer::operator== ( const ShaderKey & a,
const ShaderKey & b )
noexcept

Definition at line 4197 of file qsgbatchrenderer.cpp.

◆ qHash() [1/3]

size_t QSGBatchRenderer::qHash ( const GraphicsPipelineStateKey & k,
size_t seed )
noexcept

Definition at line 4189 of file qsgbatchrenderer.cpp.

References qHash(), and seed.

+ Here is the call graph for this function:

◆ qHash() [2/3]

size_t QSGBatchRenderer::qHash ( const GraphicsState & s,
size_t seed )
noexcept

Definition at line 4160 of file qsgbatchrenderer.cpp.

References seed.

Referenced by QSGBatchRenderer::GraphicsPipelineStateKey::create(), qHash(), and qHash().

+ Here is the caller graph for this function:

◆ qHash() [3/3]

size_t QSGBatchRenderer::qHash ( const ShaderKey & k,
size_t seed )
noexcept

Definition at line 4209 of file qsgbatchrenderer.cpp.

References qHash(), and seed.

+ Here is the call graph for this function:

◆ qsg_addBackOrphanedElements()

static void QSGBatchRenderer::qsg_addBackOrphanedElements ( QDataBuffer< Element * > & orphans,
QDataBuffer< Element * > & renderList )
static

Definition at line 1554 of file qsgbatchrenderer.cpp.

References i, and QSGBatchRenderer::Element::orphaned.

◆ qsg_addOrphanedElements()

static void QSGBatchRenderer::qsg_addOrphanedElements ( QDataBuffer< Element * > & orphans,
const QDataBuffer< Element * > & renderList )
static

◆ qsg_countNodesInBatch()

static int QSGBatchRenderer::qsg_countNodesInBatch ( const Batch * batch)
static

Definition at line 817 of file qsgbatchrenderer.cpp.

References QSGBatchRenderer::Batch::first, QSGBatchRenderer::Element::nextInBatch, and sum.

Referenced by qsg_countNodesInBatches().

+ Here is the caller graph for this function:

◆ qsg_countNodesInBatches()

static int QSGBatchRenderer::qsg_countNodesInBatches ( const QDataBuffer< Batch * > & batches)
static

Definition at line 828 of file qsgbatchrenderer.cpp.

References i, qsg_countNodesInBatch(), and sum.

Referenced by QSGBatchRenderer::Renderer::prepareRenderPass().

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

◆ qsg_dumpShadowRoots() [1/2]

void QSGBatchRenderer::qsg_dumpShadowRoots ( BatchRootInfo * i,
int indent )

Definition at line 304 of file qsgbatchrenderer.cpp.

References QSet< T >::constBegin(), QByteArray::constData(), QSet< T >::constEnd(), i, it, qDebug, and qsg_dumpShadowRoots().

Referenced by qsg_dumpShadowRoots(), qsg_dumpShadowRoots(), and QSGBatchRenderer::Updater::updateStates().

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

◆ qsg_dumpShadowRoots() [2/2]

void QSGBatchRenderer::qsg_dumpShadowRoots ( Node * n)

Definition at line 325 of file qsgbatchrenderer.cpp.

References child, QSGNode::ClipNodeType, QByteArray::constData(), d, Qt::dec(), QSGNode::GeometryNodeType, Qt::hex(), Q_UNUSED, qDebug, qsg_dumpShadowRoots(), and SHADOWNODE_TRAVERSE.

+ Here is the call graph for this function:

◆ qsg_fixIndexCount()

static int QSGBatchRenderer::qsg_fixIndexCount ( int iCount,
int drawMode )
inlinestatic

◆ qsg_indexFormat()

QRhiCommandBuffer::IndexFormat QSGBatchRenderer::qsg_indexFormat ( const QSGGeometry * geometry)

Definition at line 164 of file qsgbatchrenderer.cpp.

References QSGGeometry::indexType(), QRhiCommandBuffer::IndexUInt16, QRhiCommandBuffer::IndexUInt32, QSGGeometry::UnsignedIntType, and QSGGeometry::UnsignedShortType.

Referenced by fillVertexIndex().

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

◆ qsg_matrixForRoot()

QMatrix4x4 QSGBatchRenderer::qsg_matrixForRoot ( Node * node)

Definition at line 2023 of file qsgbatchrenderer.cpp.

References QSGNode::ClipNodeType, QSGBasicGeometryNode::matrix(), Q_ASSERT, QSGBatchRenderer::Node::sgNode, QSGNode::TransformNodeType, and QSGBatchRenderer::Node::type().

+ Here is the call graph for this function:

◆ qsg_positionAttribute()

int QSGBatchRenderer::qsg_positionAttribute ( QSGGeometry * g)

Definition at line 615 of file qsgbatchrenderer.cpp.

References QSGGeometry::FloatType, QSGGeometry::Attribute::isVertexCoordinate, size_of_type(), QSGGeometry::Attribute::tupleSize, and QSGGeometry::Attribute::type.

Referenced by QSGBatchRenderer::Element::computeBounds().

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

◆ qsg_setMultiViewFlagsOnMaterial()

void QSGBatchRenderer::qsg_setMultiViewFlagsOnMaterial ( QSGMaterial * material,
int multiViewCount )

Definition at line 204 of file qsgbatchrenderer.cpp.

References QSGMaterial::MultiView2, QSGMaterial::MultiView3, QSGMaterial::MultiView4, and QSGMaterial::setFlag().

Referenced by QSGBatchRenderer::ShaderManager::prepareMaterial(), and QSGBatchRenderer::ShaderManager::prepareMaterialNoRewrite().

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

◆ qsg_sort_batch_decreasing_order()

bool QSGBatchRenderer::qsg_sort_batch_decreasing_order ( Batch * a,
Batch * b )

Definition at line 73 of file qsgbatchrenderer.cpp.

Referenced by QSGBatchRenderer::Renderer::prepareRenderPass().

+ Here is the caller graph for this function:

◆ qsg_sort_batch_increasing_order()

bool QSGBatchRenderer::qsg_sort_batch_increasing_order ( Batch * a,
Batch * b )

Definition at line 72 of file qsgbatchrenderer.cpp.

Referenced by QSGBatchRenderer::Renderer::prepareRenderPass().

+ Here is the caller graph for this function:

◆ qsg_sort_batch_is_valid()

bool QSGBatchRenderer::qsg_sort_batch_is_valid ( Batch * a,
Batch * b )

Definition at line 71 of file qsgbatchrenderer.cpp.

◆ qsg_sort_element_decreasing_order()

bool QSGBatchRenderer::qsg_sort_element_decreasing_order ( Element * a,
Element * b )

Definition at line 70 of file qsgbatchrenderer.cpp.

◆ qsg_sort_element_increasing_order()

bool QSGBatchRenderer::qsg_sort_element_increasing_order ( Element * a,
Element * b )

Definition at line 69 of file qsgbatchrenderer.cpp.

◆ qsg_topology()

QRhiGraphicsPipeline::Topology QSGBatchRenderer::qsg_topology ( int geomDrawMode)

Definition at line 178 of file qsgbatchrenderer.cpp.

References QSGGeometry::DrawLines, QSGGeometry::DrawLineStrip, QSGGeometry::DrawPoints, QSGGeometry::DrawTriangles, QSGGeometry::DrawTriangleStrip, QRhiGraphicsPipeline::Lines, QRhiGraphicsPipeline::LineStrip, QRhiGraphicsPipeline::Points, qWarning, QRhiGraphicsPipeline::Triangles, and QRhiGraphicsPipeline::TriangleStrip.

Referenced by fillVertexIndex().

+ Here is the caller graph for this function:

◆ qsg_vertexInputFormat()

QRhiVertexInputAttribute::Format QSGBatchRenderer::qsg_vertexInputFormat ( const QSGGeometry::Attribute & a)

◆ qsg_wipeBatch()

static void QSGBatchRenderer::qsg_wipeBatch ( Batch * batch)
static

Definition at line 912 of file qsgbatchrenderer.cpp.

References QSGBatchRenderer::Batch::ibo, qsg_wipeBuffer(), QSGBatchRenderer::StencilClipState::reset(), QSGBatchRenderer::Batch::stencilClipState, QSGBatchRenderer::Batch::ubuf, and QSGBatchRenderer::Batch::vbo.

Referenced by QSGBatchRenderer::Renderer::~Renderer().

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

◆ qsg_wipeBuffer()

static void QSGBatchRenderer::qsg_wipeBuffer ( Buffer * buffer)
static

Definition at line 900 of file qsgbatchrenderer.cpp.

Referenced by qsg_wipeBatch().

+ Here is the caller graph for this function:

◆ rendererToMaterialGraphicsState()

◆ size_of_type()

static int QSGBatchRenderer::size_of_type ( int type)
inlinestatic

Definition at line 50 of file qsgbatchrenderer.cpp.

References QSGGeometry::ByteType, QSGGeometry::DoubleType, and Q_ASSERT.

Referenced by calculateVertexInputLayout(), and qsg_positionAttribute().

+ Here is the caller graph for this function:

Variable Documentation

◆ DYNAMIC_VERTEX_INDEX_BUFFER_THRESHOLD

const uint QSGBatchRenderer::DYNAMIC_VERTEX_INDEX_BUFFER_THRESHOLD = 4

Definition at line 83 of file qsgbatchrenderer.cpp.

◆ OPAQUE_LIMIT

const float QSGBatchRenderer::OPAQUE_LIMIT = 0.999f

Definition at line 81 of file qsgbatchrenderer.cpp.

Referenced by QSGBatchRenderer::Updater::visitOpacityNode().

◆ QSGMaterial_FullMatrix

◆ ubufVisibility

const QRhiShaderResourceBinding::StageFlags QSGBatchRenderer::ubufVisibility

◆ VERTEX_BUFFER_BINDING

const int QSGBatchRenderer::VERTEX_BUFFER_BINDING = 0

Definition at line 84 of file qsgbatchrenderer.cpp.

Referenced by calculateVertexInputLayout().

◆ VIEWPORT_MAX_DEPTH

const float QSGBatchRenderer::VIEWPORT_MAX_DEPTH = 1.0f

◆ VIEWPORT_MIN_DEPTH

const float QSGBatchRenderer::VIEWPORT_MIN_DEPTH = 0.0f

◆ ZORDER_BUFFER_BINDING

const int QSGBatchRenderer::ZORDER_BUFFER_BINDING = VERTEX_BUFFER_BINDING + 1

Definition at line 85 of file qsgbatchrenderer.cpp.

Referenced by calculateVertexInputLayout().