QRhiShaderStage Class
パイプライン内のシェーダステージのタイプとシェーダコードを指定します。詳細...
ヘッダー | #include <rhi/qrhi.h> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate) |
qmake: | QT += gui-private |
以来: | Qt 6.6 |
パブリックな型
enum | Type { Vertex, TessellationControl, TessellationEvaluation, Fragment, Compute, Geometry } |
パブリック関数
QRhiShaderStage() | |
QRhiShaderStage(QRhiShaderStage::Type type, const QShader &shader, QShader::Variant v = QShader::StandardShader) | |
void | setShader(const QShader &s) |
void | setShaderVariant(QShader::Variant v) |
void | setType(QRhiShaderStage::Type t) |
QShader | shader() const |
QShader::Variant | shaderVariant() const |
QRhiShaderStage::Type | type() const |
関連する非メンバー
size_t | qHash(const QRhiShaderStage &key, size_t seed = 0) |
bool | operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) |
bool | operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) |
詳細説明
QRhiGraphicsPipeline をセットアップするとき、シェーダーステージのコレクションが指定されます。QRhiShaderStage には、QShader と、グラフィックス・パイプライン・ステージなどの関連するメタデータ、および選択するshader variant が含まれます。実行時に使用されるQRhi バックエンドが、QShader 内のコレクションから適切なシェーダー・バージョンを選択するため、シェーダー言語やバージョンを指定する必要はありません。
典型的な使用法はQRhiGraphicsPipeline::setShaderStages() との組み合わせです。ここでは、オフラインまたはビルド時に生成された.qsb
ファイルからQShader をロードする簡単な方法を示します:
QShader getShader(const QString &name) { QFile f(name); return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader(); } QShader vs = getShader("material.vert.qsb"); QShader fs = getShader("material.frag.qsb"); pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vs }, { QRhiShaderStage::Fragment, fs } });
注: これは互換性保証に制限のある RHI API です。詳細はQRhi を参照してください。
メンバー型ドキュメント
enum QRhiShaderStage::Type
シェーダステージのタイプを指定します。
定数 | 値 | 説明 |
---|---|---|
QRhiShaderStage::Vertex | 0 | 頂点ステージ |
QRhiShaderStage::TessellationControl | 1 | テッセレーション制御(ハルシェーダー)ステージ。QRhi::Tessellation 機能がサポートされている場合にのみ使用されなければならない。 |
QRhiShaderStage::TessellationEvaluation | 2 | テッセレーション評価(ドメインシェーダ)ステージ。QRhi::Tessellation 機能がサポートされているときのみ使用されなければならない。 |
QRhiShaderStage::Fragment | 4 | フラグメント(ピクセルシェーダ)ステージ |
QRhiShaderStage::Compute | 5 | 計算ステージ。QRhi::Compute 機能がサポートされているときのみ使用されなければならない。 |
QRhiShaderStage::Geometry | 3 | ジオメトリステージ。QRhi::GeometryShader 機能がサポートされている場合にのみ使用する必要があります。 |
メンバー関数ドキュメント
[noexcept]
QRhiShaderStage::QRhiShaderStage()
空のQShader で頂点ステージのシェーダステージ記述を構築します。
QRhiShaderStage::QRhiShaderStage(QRhiShaderStage::Type type, const QShader &shader, QShader::Variant v = QShader::StandardShader)
ステージのtype とshader でシェーダステージの説明を構築します。
シェーダのバリアントv のデフォルトはQShader::StandardShader です。QShader には、シェーダの複数のソースバージョンとバイナリバージョンが含まれます。さらに、v を使用して、希望するバリアントを選択できます。
void QRhiShaderStage::setShader(const QShader &s)
シェーダーコレクションs を設定する。
shader()も参照 。
void QRhiShaderStage::setShaderVariant(QShader::Variant v)
要求されたシェーダバリアントv を設定します。
shaderVariant()も参照 。
void QRhiShaderStage::setType(QRhiShaderStage::Type t)
ステージのタイプをt に設定する。 セッターは実際にはほとんど必要ないはずである。ほとんどのアプリケーションでは、QRhiShaderStage コンストラクタを使うことになるでしょう。
type()も参照 。
QShader QRhiShaderStage::shader() const
グラフィックスパイプラインのこのステージで使用するQShader を返します。
setShader()も参照してください 。
QShader::Variant QRhiShaderStage::shaderVariant() const
要求されたシェーダバリアントを返します。
setShaderVariant()も参照 ください。
QRhiShaderStage::Type QRhiShaderStage::type() const
ステージのタイプを返します。
setType()も参照 。
関連する非会員
[noexcept]
size_t qHash(const QRhiShaderStage &key, size_t seed = 0)
key のハッシュ値を返す。計算のシードにはseed を使用する。
[noexcept]
bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b)
2つのQRhiShaderStage オブジェクトa とb の値が等しい場合はfalse
を返し、そうでない場合はtrue
を返す。
[noexcept]
bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b)
2つのQRhiShaderStage オブジェクトa とb の値が等しい場合、true
を返す。
© 2025 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.