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
QSSGStageGeneratorBase Struct Reference

#include <qssgrendershadercodegenerator_p.h>

+ Inheritance diagram for QSSGStageGeneratorBase:
+ Collaboration diagram for QSSGStageGeneratorBase:

Public Types

enum class  ShaderItemType { VertexInput , Input , Output , Uniform }
 
enum class  ShaderItemMapFlag { Flat = 0x01 }
 
typedef QMap< QByteArray, QByteArrayTStrTableStrMap
 
typedef QMap< QByteArray, QPair< quint32, QByteArray > > TStrTableSizedStrMap
 
typedef QPair< QByteArray, QByteArrayTParamPair
 
typedef QPair< QByteArray, TParamPairTConstantBufferParamPair
 
typedef QVector< TConstantBufferParamPairTConstantBufferParamArray
 

Public Member Functions

 QSSGStageGeneratorBase (QSSGShaderGeneratorStage inStage)
 
virtual ~QSSGStageGeneratorBase ()=default
 
virtual void begin (QSSGShaderGeneratorStageFlags inEnabledStages)
 
virtual void addIncoming (const QByteArray &name, const QByteArray &type)
 
virtual void addOutgoing (const QByteArray &name, const QByteArray &type)
 
virtual void addFlatIncoming (const QByteArray &name, const QByteArray &type)
 
virtual void addFlatOutgoing (const QByteArray &name, const QByteArray &type)
 
virtual void addUniform (const QByteArray &name, const QByteArray &type)
 
virtual void addUniformArray (const QByteArray &name, const QByteArray &type, quint32 size)
 
virtual void addConstantBuffer (const QByteArray &name, const QByteArray &layout)
 
virtual void addConstantBufferParam (const QByteArray &cbName, const QByteArray &paramName, const QByteArray &type)
 
virtual QSSGStageGeneratorBaseoperator<< (const QByteArray &data)
 
virtual void append (const QByteArray &data)
 
QSSGShaderGeneratorStage stage () const
 
void addShaderPass2Marker (ShaderItemType itemType)
 
void addShaderItemMap (ShaderItemType itemType, const TStrTableStrMap &itemMap, ShaderItemMapFlags flags={})
 
virtual void addShaderIncomingMap ()
 
virtual void addShaderUniformMap ()
 
virtual void addShaderOutgoingMap ()
 
virtual void addShaderConstantBufferItemMap (const QByteArray &itemType, const TStrTableStrMap &cbMap, TConstantBufferParamArray cbParamsArray)
 
virtual void appendShaderCode () final
 
virtual void addInclude (const QByteArray &name) final
 
void buildShaderSourcePass1 (QSSGShaderResourceMergeContext *mergeContext)
 
QByteArray buildShaderSourcePass2 (QSSGShaderResourceMergeContext *mergeContext)
 
virtual void addFunction (const QByteArray &functionName) final
 
virtual void addDefinition (const QByteArray &name, const QByteArray &value) final
 

Public Attributes

TStrTableStrMap m_incoming
 
TStrTableStrMapm_outgoing = nullptr
 
TStrTableStrMap m_flatIncoming
 
TStrTableStrMapm_flatOutgoing = nullptr
 
QSet< QByteArraym_includes
 
TStrTableStrMap m_uniforms
 
TStrTableSizedStrMap m_uniformArrays
 
TStrTableStrMap m_constantBuffers
 
TConstantBufferParamArray m_constantBufferParams
 
QByteArray m_codeBuilder
 
QByteArray m_finalBuilder
 
QSSGShaderGeneratorStage m_stage
 
QSSGShaderGeneratorStageFlags m_enabledStages
 
QList< QByteArraym_addedFunctions
 
TStrTableStrMap m_addedDefinitions
 
QSSGShaderResourceMergeContextm_mergeContext = nullptr
 

Detailed Description

Definition at line 43 of file qssgrendershadercodegenerator_p.h.

Member Typedef Documentation

◆ TConstantBufferParamArray

◆ TConstantBufferParamPair

◆ TParamPair

◆ TStrTableSizedStrMap

◆ TStrTableStrMap

Member Enumeration Documentation

◆ ShaderItemMapFlag

Enumerator
Flat 

Definition at line 52 of file qssgrendershadercodegenerator_p.h.

◆ ShaderItemType

Enumerator
VertexInput 
Input 
Output 
Uniform 

Definition at line 45 of file qssgrendershadercodegenerator_p.h.

Constructor & Destructor Documentation

◆ QSSGStageGeneratorBase()

QSSGStageGeneratorBase::QSSGStageGeneratorBase ( QSSGShaderGeneratorStage inStage)
explicit

Definition at line 46 of file qssgrendershadercodegenerator.cpp.

◆ ~QSSGStageGeneratorBase()

virtual QSSGStageGeneratorBase::~QSSGStageGeneratorBase ( )
virtualdefault

Member Function Documentation

◆ addConstantBuffer()

void QSSGStageGeneratorBase::addConstantBuffer ( const QByteArray & name,
const QByteArray & layout )
virtual

Definition at line 115 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), layout, and m_constantBuffers.

Referenced by QSSGMaterialVertexPipeline::addConstantBuffer().

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

◆ addConstantBufferParam()

void QSSGStageGeneratorBase::addConstantBufferParam ( const QByteArray & cbName,
const QByteArray & paramName,
const QByteArray & type )
virtual

Definition at line 120 of file qssgrendershadercodegenerator.cpp.

References m_constantBufferParams, and QList< T >::push_back().

Referenced by QSSGMaterialVertexPipeline::addConstantBufferParam().

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

◆ addDefinition()

void QSSGStageGeneratorBase::addDefinition ( const QByteArray & name,
const QByteArray & value )
finalvirtual

Definition at line 373 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), and m_addedDefinitions.

Referenced by QSSGMaterialVertexPipeline::addDefinition().

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

◆ addFlatIncoming()

void QSSGStageGeneratorBase::addFlatIncoming ( const QByteArray & name,
const QByteArray & type )
virtual

Definition at line 88 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), m_flatIncoming, m_incoming, and QMap< Key, T >::remove().

Referenced by QSSGMaterialVertexPipeline::addFlatParameter().

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

◆ addFlatOutgoing()

void QSSGStageGeneratorBase::addFlatOutgoing ( const QByteArray & name,
const QByteArray & type )
virtual

Definition at line 94 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), m_flatOutgoing, m_outgoing, Q_ASSERT, and QMap< Key, T >::remove().

Referenced by QSSGMaterialVertexPipeline::addFlatParameter().

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

◆ addFunction()

void QSSGStageGeneratorBase::addFunction ( const QByteArray & functionName)
finalvirtual

Definition at line 363 of file qssgrendershadercodegenerator.cpp.

References addInclude(), QListSpecialMethodsBase< T >::contains(), m_addedFunctions, and QList< T >::push_back().

Referenced by calculatePointLightAttenuation(), generateFragmentShader(), generateImageUVCoordinates(), handleSpecularLight(), and outputSpecularEquation().

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

◆ addInclude()

void QSSGStageGeneratorBase::addInclude ( const QByteArray & name)
finalvirtual

Definition at line 236 of file qssgrendershadercodegenerator.cpp.

References QSet< T >::insert(), and m_includes.

Referenced by addFunction(), QSSGMaterialVertexPipeline::addInclude(), QSSGMaterialVertexPipeline::beginVertexGeneration(), generateFragmentShader(), generateShadowMapOcclusion(), maybeAddMaterialFresnel(), and outputSpecularEquation().

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

◆ addIncoming()

void QSSGStageGeneratorBase::addIncoming ( const QByteArray & name,
const QByteArray & type )
virtual

Definition at line 71 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), m_flatIncoming, m_incoming, and QMap< Key, T >::remove().

Referenced by QSSGMaterialVertexPipeline::addIncoming(), QSSGMaterialVertexPipeline::addInterpolationParameter(), and QSSGMaterialVertexPipeline::beginVertexGeneration().

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

◆ addOutgoing()

void QSSGStageGeneratorBase::addOutgoing ( const QByteArray & name,
const QByteArray & type )
virtual

Definition at line 77 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), m_flatOutgoing, m_outgoing, Q_ASSERT, and QMap< Key, T >::remove().

Referenced by QSSGMaterialVertexPipeline::addInterpolationParameter().

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

◆ addShaderConstantBufferItemMap()

void QSSGStageGeneratorBase::addShaderConstantBufferItemMap ( const QByteArray & itemType,
const TStrTableStrMap & cbMap,
TConstantBufferParamArray cbParamsArray )
virtual

Definition at line 207 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), iter, and m_finalBuilder.

Referenced by buildShaderSourcePass1().

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

◆ addShaderIncomingMap()

void QSSGStageGeneratorBase::addShaderIncomingMap ( )
virtual

Reimplemented in QSSGFragmentShaderGenerator.

Definition at line 177 of file qssgrendershadercodegenerator.cpp.

References addShaderItemMap(), addShaderPass2Marker(), m_incoming, and VertexInput.

Referenced by buildShaderSourcePass1().

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

◆ addShaderItemMap()

void QSSGStageGeneratorBase::addShaderItemMap ( QSSGStageGeneratorBase::ShaderItemType itemType,
const TStrTableStrMap & itemMap,
ShaderItemMapFlags flags = {} )

Definition at line 147 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), Flat, Input, iter, m_finalBuilder, m_mergeContext, m_stage, Output, Q_ASSERT, QByteArrayLiteral, qWarning, QSSGShaderResourceMergeContext::registerInput(), QSSGShaderResourceMergeContext::registerOutput(), QSSGShaderResourceMergeContext::registerSampler(), QSSGShaderResourceMergeContext::registerUniformMember(), Uniform, Vertex, and VertexInput.

Referenced by addShaderIncomingMap(), QSSGFragmentShaderGenerator::addShaderIncomingMap(), addShaderOutgoingMap(), and addShaderUniformMap().

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

◆ addShaderOutgoingMap()

void QSSGStageGeneratorBase::addShaderOutgoingMap ( )
virtual

Reimplemented in QSSGFragmentShaderGenerator.

Definition at line 197 of file qssgrendershadercodegenerator.cpp.

References addShaderItemMap(), addShaderPass2Marker(), Flat, m_flatOutgoing, m_outgoing, and Output.

Referenced by buildShaderSourcePass1().

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

◆ addShaderPass2Marker()

void QSSGStageGeneratorBase::addShaderPass2Marker ( QSSGStageGeneratorBase::ShaderItemType itemType)

Definition at line 141 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), m_finalBuilder, m_mergeContext, QByteArray::number(), Q_ASSERT, and QByteArrayLiteral.

Referenced by addShaderIncomingMap(), QSSGFragmentShaderGenerator::addShaderIncomingMap(), addShaderOutgoingMap(), QSSGFragmentShaderGenerator::addShaderOutgoingMap(), and addShaderUniformMap().

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

◆ addShaderUniformMap()

void QSSGStageGeneratorBase::addShaderUniformMap ( )
virtual

Definition at line 183 of file qssgrendershadercodegenerator.cpp.

References addShaderItemMap(), addShaderPass2Marker(), QMap< Key, T >::begin(), QMap< Key, T >::end(), iter, m_mergeContext, m_uniformArrays, m_uniforms, QByteArray::number(), QByteArrayLiteral, QSSGShaderResourceMergeContext::registerSampler(), QSSGShaderResourceMergeContext::registerUniformMember(), and Uniform.

Referenced by buildShaderSourcePass1().

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

◆ addUniform()

void QSSGStageGeneratorBase::addUniform ( const QByteArray & name,
const QByteArray & type )
virtual

Definition at line 105 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), and m_uniforms.

Referenced by QSSGMaterialVertexPipeline::addUniform(), QSSGMaterialVertexPipeline::beginFragmentGeneration(), QSSGMaterialVertexPipeline::beginVertexGeneration(), generateFragmentShader(), generateImageUVCoordinates(), generateImageUVSampler(), generateShadowMapOcclusion(), QSSGMaterialVertexPipeline::generateShadowWorldPosition(), QSSGMaterialVertexPipeline::generateViewVector(), and QSSGMaterialVertexPipeline::generateWorldPosition().

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

◆ addUniformArray()

void QSSGStageGeneratorBase::addUniformArray ( const QByteArray & name,
const QByteArray & type,
quint32 size )
virtual

Definition at line 110 of file qssgrendershadercodegenerator.cpp.

References QMap< Key, T >::insert(), m_uniformArrays, and qMakePair().

Referenced by QSSGMaterialVertexPipeline::addUniformArray(), QSSGMaterialVertexPipeline::beginVertexGeneration(), generateFragmentShader(), and QSSGMaterialVertexPipeline::generateViewVector().

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

◆ append()

◆ appendShaderCode()

void QSSGStageGeneratorBase::appendShaderCode ( )
finalvirtual

Definition at line 234 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), m_codeBuilder, and m_finalBuilder.

Referenced by buildShaderSourcePass1().

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

◆ begin()

void QSSGStageGeneratorBase::begin ( QSSGShaderGeneratorStageFlags inEnabledStages)
virtual

Definition at line 52 of file qssgrendershadercodegenerator.cpp.

References QByteArray::clear(), QList< T >::clear(), QMap< Key, T >::clear(), QSet< T >::clear(), m_addedDefinitions, m_addedFunctions, m_codeBuilder, m_constantBufferParams, m_constantBuffers, m_enabledStages, m_finalBuilder, m_flatIncoming, m_flatOutgoing, m_includes, m_incoming, m_outgoing, m_uniformArrays, and m_uniforms.

Referenced by QSSGProgramGenerator::beginProgram().

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

◆ buildShaderSourcePass1()

void QSSGStageGeneratorBase::buildShaderSourcePass1 ( QSSGShaderResourceMergeContext * mergeContext)

◆ buildShaderSourcePass2()

QByteArray QSSGStageGeneratorBase::buildShaderSourcePass2 ( QSSGShaderResourceMergeContext * mergeContext)

Definition at line 272 of file qssgrendershadercodegenerator.cpp.

References addEndCond(), addStartCond(), QString::asprintf(), QVariant::constData(), QByteArray::indexOf(), Input, iter, m_finalBuilder, m_stage, QByteArray::mid(), Output, pos, QByteArrayLiteral, QByteArray::replace(), QByteArray::toInt(), Uniform, var, Vertex, and VertexInput.

+ Here is the call graph for this function:

◆ operator<<()

QSSGStageGeneratorBase & QSSGStageGeneratorBase::operator<< ( const QByteArray & data)
virtual

Definition at line 127 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), and m_codeBuilder.

+ Here is the call graph for this function:

◆ stage()

QSSGShaderGeneratorStage QSSGStageGeneratorBase::stage ( ) const

Definition at line 139 of file qssgrendershadercodegenerator.cpp.

References m_stage.

Referenced by QSSGMaterialVertexPipeline::stage().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_addedDefinitions

TStrTableStrMap QSSGStageGeneratorBase::m_addedDefinitions

Definition at line 83 of file qssgrendershadercodegenerator_p.h.

Referenced by addDefinition(), begin(), and buildShaderSourcePass1().

◆ m_addedFunctions

QList<QByteArray> QSSGStageGeneratorBase::m_addedFunctions

Definition at line 82 of file qssgrendershadercodegenerator_p.h.

Referenced by addFunction(), and begin().

◆ m_codeBuilder

QByteArray QSSGStageGeneratorBase::m_codeBuilder

Definition at line 78 of file qssgrendershadercodegenerator_p.h.

Referenced by append(), appendShaderCode(), begin(), and operator<<().

◆ m_constantBufferParams

TConstantBufferParamArray QSSGStageGeneratorBase::m_constantBufferParams

◆ m_constantBuffers

TStrTableStrMap QSSGStageGeneratorBase::m_constantBuffers

◆ m_enabledStages

QSSGShaderGeneratorStageFlags QSSGStageGeneratorBase::m_enabledStages

Definition at line 81 of file qssgrendershadercodegenerator_p.h.

Referenced by begin().

◆ m_finalBuilder

◆ m_flatIncoming

TStrTableStrMap QSSGStageGeneratorBase::m_flatIncoming

◆ m_flatOutgoing

TStrTableStrMap* QSSGStageGeneratorBase::m_flatOutgoing = nullptr

◆ m_includes

QSet<QByteArray> QSSGStageGeneratorBase::m_includes

Definition at line 73 of file qssgrendershadercodegenerator_p.h.

Referenced by addInclude(), begin(), and buildShaderSourcePass1().

◆ m_incoming

◆ m_mergeContext

◆ m_outgoing

◆ m_stage

QSSGShaderGeneratorStage QSSGStageGeneratorBase::m_stage

◆ m_uniformArrays

TStrTableSizedStrMap QSSGStageGeneratorBase::m_uniformArrays

Definition at line 75 of file qssgrendershadercodegenerator_p.h.

Referenced by addShaderUniformMap(), addUniformArray(), and begin().

◆ m_uniforms

TStrTableStrMap QSSGStageGeneratorBase::m_uniforms

Definition at line 74 of file qssgrendershadercodegenerator_p.h.

Referenced by addShaderUniformMap(), addUniform(), and begin().


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