Qt 6.x
The Qt SDK
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 }
 
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 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, const QByteArray &inItemSuffix=QByteArray())
 
void addShaderItemMap (ShaderItemType itemType, const TStrTableSizedStrMap &itemMap)
 
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
 
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

◆ 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 93 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 98 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 349 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:

◆ addFunction()

void QSSGStageGeneratorBase::addFunction ( const QByteArray functionName)
finalvirtual

Definition at line 339 of file qssgrendershadercodegenerator.cpp.

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

Referenced by addTranslucencyIrradiance(), 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 212 of file qssgrendershadercodegenerator.cpp.

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

Referenced by addFunction(), QSSGMaterialVertexPipeline::addInclude(), QSSGMaterialVertexPipeline::beginVertexGeneration(), QSSGMaterialVertexPipeline::generateEnvMapReflection(), 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 69 of file qssgrendershadercodegenerator.cpp.

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

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 74 of file qssgrendershadercodegenerator.cpp.

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

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 183 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), QList< T >::begin(), QMap< Key, T >::begin(), QList< T >::end(), QMap< Key, T >::end(), 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 155 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() [1/2]

void QSSGStageGeneratorBase::addShaderItemMap ( ShaderItemType  itemType,
const TStrTableSizedStrMap itemMap 
)

◆ addShaderItemMap() [2/2]

void QSSGStageGeneratorBase::addShaderItemMap ( QSSGStageGeneratorBase::ShaderItemType  itemType,
const TStrTableStrMap itemMap,
const QByteArray inItemSuffix = QByteArray() 
)

Definition at line 125 of file qssgrendershadercodegenerator.cpp.

References QByteArray::append(), QMap< Key, T >::begin(), QMap< Key, T >::end(), 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 175 of file qssgrendershadercodegenerator.cpp.

References addShaderItemMap(), addShaderPass2Marker(), 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 119 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 161 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 83 of file qssgrendershadercodegenerator.cpp.

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

Referenced by QSSGMaterialVertexPipeline::addUniform(), QSSGMaterialVertexPipeline::beginFragmentGeneration(), QSSGMaterialVertexPipeline::beginVertexGeneration(), QSSGMaterialVertexPipeline::doGenerateWorldNormal(), 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 88 of file qssgrendershadercodegenerator.cpp.

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

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

+ 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 210 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_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)

Definition at line 214 of file qssgrendershadercodegenerator.cpp.

References addShaderConstantBufferItemMap(), addShaderIncomingMap(), addShaderOutgoingMap(), addShaderUniformMap(), QByteArray::append(), appendShaderCode(), QList< T >::begin(), QMap< Key, T >::begin(), QSet< T >::begin(), QList< T >::end(), QMap< Key, T >::end(), QSet< T >::end(), iter, m_addedDefinitions, m_constantBufferParams, m_constantBuffers, m_finalBuilder, m_includes, m_mergeContext, and QByteArrayLiteral.

Referenced by QSSGProgramGenerator::compileGeneratedRhiShader().

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

◆ buildShaderSourcePass2()

QByteArray QSSGStageGeneratorBase::buildShaderSourcePass2 ( QSSGShaderResourceMergeContext mergeContext)

Definition at line 248 of file qssgrendershadercodegenerator.cpp.

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

Referenced by QSSGProgramGenerator::compileGeneratedRhiShader().

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

◆ operator<<()

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

Definition at line 105 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 117 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 76 of file qssgrendershadercodegenerator_p.h.

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

◆ m_addedFunctions

QList<QByteArray> QSSGStageGeneratorBase::m_addedFunctions

Definition at line 75 of file qssgrendershadercodegenerator_p.h.

Referenced by addFunction(), and begin().

◆ m_codeBuilder

QByteArray QSSGStageGeneratorBase::m_codeBuilder

Definition at line 71 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 74 of file qssgrendershadercodegenerator_p.h.

Referenced by begin().

◆ m_finalBuilder

◆ m_includes

QSet<QByteArray> QSSGStageGeneratorBase::m_includes

Definition at line 66 of file qssgrendershadercodegenerator_p.h.

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

◆ m_incoming

◆ m_mergeContext

◆ m_outgoing

TStrTableStrMap* QSSGStageGeneratorBase::m_outgoing

◆ m_stage

QSSGShaderGeneratorStage QSSGStageGeneratorBase::m_stage

◆ m_uniformArrays

TStrTableSizedStrMap QSSGStageGeneratorBase::m_uniformArrays

Definition at line 68 of file qssgrendershadercodegenerator_p.h.

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

◆ m_uniforms

TStrTableStrMap QSSGStageGeneratorBase::m_uniforms

Definition at line 67 of file qssgrendershadercodegenerator_p.h.

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


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