Sur cette page

Qt3DRender::QShaderProgramBuilder Class

class Qt3DRender::QShaderProgramBuilder

Génère le contenu d'un programme de shader à partir des graphes chargés. En savoir plus...

En-tête : #include <qshaderprogrambuilder.h>
CMake : find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake : QT += 3drender
En QML : ShaderProgramBuilder
Hérite de : Qt3DCore::QNode
Statut : Obsolète

Cette classe est obsolète. Nous déconseillons fortement de l'utiliser dans du nouveau code.

Propriétés

Fonctions publiques

QByteArray computeShaderCode() const
QUrl computeShaderGraph() const
QStringList enabledLayers() const
QByteArray fragmentShaderCode() const
QUrl fragmentShaderGraph() const
QByteArray geometryShaderCode() const
QUrl geometryShaderGraph() const
Qt3DRender::QShaderProgram *shaderProgram() const
QByteArray tessellationControlShaderCode() const
QUrl tessellationControlShaderGraph() const
QByteArray tessellationEvaluationShaderCode() const
QUrl tessellationEvaluationShaderGraph() const
QByteArray vertexShaderCode() const
QUrl vertexShaderGraph() const

Emplacements publics

void setComputeShaderGraph(const QUrl &computeShaderGraph)
void setEnabledLayers(const QStringList &layers)
void setFragmentShaderGraph(const QUrl &fragmentShaderGraph)
void setGeometryShaderGraph(const QUrl &geometryShaderGraph)
void setShaderProgram(Qt3DRender::QShaderProgram *program)
void setTessellationControlShaderGraph(const QUrl &tessellationControlShaderGraph)
void setTessellationEvaluationShaderGraph(const QUrl &tessellationEvaluationShaderGraph)
void setVertexShaderGraph(const QUrl &vertexShaderGraph)

Signaux

void computeShaderCodeChanged(const QByteArray &computeShaderCode)
void computeShaderGraphChanged(const QUrl &computeShaderGraph)
void enabledLayersChanged(const QStringList &layers)
void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)
void fragmentShaderGraphChanged(const QUrl &fragmentShaderGraph)
void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)
void geometryShaderGraphChanged(const QUrl &geometryShaderGraph)
void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)
void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)
void tessellationControlShaderGraphChanged(const QUrl &tessellationControlShaderGraph)
void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)
void tessellationEvaluationShaderGraphChanged(const QUrl &tessellationEvaluationShaderGraph)
void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)
void vertexShaderGraphChanged(const QUrl &vertexShaderGraph)

Description détaillée

Un générateur de programmes de shaders se compose de plusieurs graphes de shaders différents utilisés pour générer du code de shader.

Un cache contenant le code de shader généré est géré. Par défaut, les shaders générés sont enregistrés dans le répertoire « QStandardPaths::writableLocation » (QStandardPaths::TempLocation)). Ce chemin d’accès peut être redéfini en attribuant à la variable d’environnement QT3D_WRITABLE_CACHE_PATH un chemin d’accès valide sur lequel l’écriture est autorisée.

L’utilisation du cache peut être désactivée en définissant la variable d’environnement QT3D_DISABLE_SHADER_CACHE.

Dans la plupart des cas, les modifications apportées à un graphe sont détectées par Qt 3D et une nouvelle entrée de cache est générée. Cela ne se produit toutefois pas lorsque des extraits de code inclus dans un graphe sont modifiés. Pour contourner ce problème, il est possible de vider le répertoire du cache ou de définir la variable d’environnement QT3D_REBUILD_SHADER_CACHE afin de forcer la régénération du code du shader.

Documentation sur les propriétés

[read-only] computeShaderCode : QByteArray

Contient le code généré pour le shader de calcul.

Fonctions d'accès :

QByteArray computeShaderCode() const

Signal de notification :

void computeShaderCodeChanged(const QByteArray &computeShaderCode)

computeShaderGraph : QUrl

Contient l'URL du graphe de shaders de calcul utilisé par ce générateur de programmes de shaders.

Fonctions d'accès :

QUrl computeShaderGraph() const
void setComputeShaderGraph(const QUrl &computeShaderGraph)

Signal de notification :

void computeShaderGraphChanged(const QUrl &computeShaderGraph)

enabledLayers : QStringList

Contient la liste des couches que ce générateur activera dans les graphes de shaders lors de la génération du code.

Fonctions d'accès :

QStringList enabledLayers() const
void setEnabledLayers(const QStringList &layers)

Signal de notification :

void enabledLayersChanged(const QStringList &layers)

[read-only] fragmentShaderCode : QByteArray

Contient le code généré pour le shader de fragment.

Fonctions d'accès :

QByteArray fragmentShaderCode() const

Signal de notification :

void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)

fragmentShaderGraph : QUrl

Contient l'URL du graphe de shaders de fragment utilisé par ce générateur de programmes de shaders.

Fonctions d'accès :

QUrl fragmentShaderGraph() const
void setFragmentShaderGraph(const QUrl &fragmentShaderGraph)

Signal de notification :

void fragmentShaderGraphChanged(const QUrl &fragmentShaderGraph)

[read-only] geometryShaderCode : QByteArray

Contient le code généré par le shader géométrique.

Fonctions d'accès :

QByteArray geometryShaderCode() const

Signal de notification :

void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)

geometryShaderGraph : QUrl

Contient l'URL du graphe de shaders géométriques utilisé par ce générateur de programmes de shaders.

Fonctions d'accès :

QUrl geometryShaderGraph() const
void setGeometryShaderGraph(const QUrl &geometryShaderGraph)

Signal de notification :

void geometryShaderGraphChanged(const QUrl &geometryShaderGraph)

shaderProgram : Qt3DRender::QShaderProgram*

Contient le programme de shader à partir duquel ce générateur produit du code.

Fonctions d'accès :

Qt3DRender::QShaderProgram *shaderProgram() const
void setShaderProgram(Qt3DRender::QShaderProgram *program)

Signal de notification :

void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)

[read-only] tessellationControlShaderCode : QByteArray

Contient le code du shader de contrôle de la génération de la tessellation.

Fonctions d'accès :

QByteArray tessellationControlShaderCode() const

Signal de notification :

void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)

tessellationControlShaderGraph : QUrl

Contient l'URL du graphe de shaders de contrôle de tessellation utilisé par ce générateur de programmes de shaders.

Fonctions d'accès :

QUrl tessellationControlShaderGraph() const
void setTessellationControlShaderGraph(const QUrl &tessellationControlShaderGraph)

Signal de notification :

void tessellationControlShaderGraphChanged(const QUrl &tessellationControlShaderGraph)

[read-only] tessellationEvaluationShaderCode : QByteArray

Contient le code du shader d'évaluation de la tessellation générée.

Fonctions d'accès :

QByteArray tessellationEvaluationShaderCode() const

Signal de notification :

void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)

tessellationEvaluationShaderGraph : QUrl

Contient l'URL du graphe de shaders d'évaluation de la tessellation utilisé par ce générateur de programmes de shaders.

Fonctions d’accès :

QUrl tessellationEvaluationShaderGraph() const
void setTessellationEvaluationShaderGraph(const QUrl &tessellationEvaluationShaderGraph)

Signal de notification :

void tessellationEvaluationShaderGraphChanged(const QUrl &tessellationEvaluationShaderGraph)

[read-only] vertexShaderCode : QByteArray

Contient le code généré pour le shader de sommets.

Fonctions d'accès :

QByteArray vertexShaderCode() const

Signal de notification :

void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)

vertexShaderGraph : QUrl

Contient l'URL du graphe de shaders de sommets utilisé par ce générateur de programmes de shaders.

Fonctions d'accès :

QUrl vertexShaderGraph() const
void setVertexShaderGraph(const QUrl &vertexShaderGraph)

Signal de notification :

void vertexShaderGraphChanged(const QUrl &vertexShaderGraph)

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.