QRhiVertexInputBinding Class
頂点入力のバインディングについて説明します。詳細...
| ヘッダー: | #include <rhi/qrhi.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate) |
| qmake: | QT += gui-private |
| 以下のように: | Qt 6.6 |
パブリック型
| enum | Classification { PerVertex, PerInstance } |
パブリック関数
| QRhiVertexInputBinding() | |
| QRhiVertexInputBinding(quint32 stride, QRhiVertexInputBinding::Classification cls = PerVertex, quint32 stepRate = 1) | |
| QRhiVertexInputBinding::Classification | classification() const |
| quint32 | instanceStepRate() const |
| void | setClassification(QRhiVertexInputBinding::Classification c) |
| void | setInstanceStepRate(quint32 rate) |
| void | setStride(quint32 s) |
| quint32 | stride() const |
関連する非メンバ
| size_t | qHash(const QRhiVertexInputBinding &key, size_t seed = 0) |
| bool | operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) |
| bool | operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) |
詳細な説明
ストライド(バイト単位、4の倍数である必要があります)、分類、およびオプションでインスタンスのステップレートを指定します。
例として、次のような入力を持つ頂点シェーダーを想定します。
layout(location = 0) in vec4 position;
layout(location = 1) in vec2 texcoord;ここで、3成分の頂点位置(x, y, z) と、2成分のテクスチャ座標(u, v) が、バッファ内(あるいは別々のバッファ内でも)で非インターリーブ形式で提供されていると仮定します。この場合、2つのバインディングは次のように定義できます:
QRhiVertexInputLayout inputLayout;
inputLayout.setBindings({
{ 3 * sizeof(float) },
{ 2 * sizeof(float) }
});インスタンス化は使用されていないため、ここではストライドのみが重要です。バインディング番号は、QRhiVertexInputLayout のバインディングベクトル内のQRhiVertexInputBinding要素のインデックスによって指定されます。
この頂点入力レイアウトを持つグラフィックスパイプラインがバインドされると、36個の頂点を持つ立方体を描画するために、頂点入力を次のように設定できます(位置データが先頭、テクスチャ座標がその後にある単一のバッファがあるものと仮定します):
const QRhiCommandBuffer::VertexInput vbufBindings[] = {
{ cubeBuf, 0 },
{ cubeBuf, 36 * 3 * sizeof(float) }
};
cb->setVertexInput(0, 2, vbufBindings);startBinding + i で定義されたインデックス(i はsetVertexInput()の2番目の引数におけるインデックス)が、QRhiVertexInputLayout のbindings ベクトル内の対応するエントリのインデックスと一致している点に注目してください。
注: ストライドは 常に4の倍数でなければなりません。
注:これは 互換性の保証が限定されている RHI API です。詳細については、QRhi を参照してください。
QRhiCommandBuffer::setVertexInput()も参照してください 。
メンバ型のドキュメント
enum QRhiVertexInputBinding::Classification
入力データの分類について説明します。
| 定数 | 値 | 説明 |
|---|---|---|
QRhiVertexInputBinding::PerVertex | 0 | データは頂点ごとです |
QRhiVertexInputBinding::PerInstance | 1 | データはインスタンス単位です |
メンバ関数のドキュメント
[constexpr noexcept default] QRhiVertexInputBinding::QRhiVertexInputBinding()
デフォルトの頂点入力バインディング記述を作成します。
QRhiVertexInputBinding::QRhiVertexInputBinding(quint32 stride, QRhiVertexInputBinding::Classification cls = PerVertex, quint32 stepRate = 1)
指定されたstride 、分類cls 、およびインスタンスステップレートstepRate を用いて、頂点入力バインディングの記述を構築します。
注: stepRate が 1 以外の場合、QRhi::CustomInstanceStepRate がサポートされていると報告されている場合にのみサポートされます。
QRhiVertexInputBinding::Classification QRhiVertexInputBinding::classification() const
入力データの分類を返します。
setClassification()も参照してください 。
quint32 QRhiVertexInputBinding::instanceStepRate() const
インスタンスのステップレートを返します。
setInstanceStepRate()も参照してください 。
void QRhiVertexInputBinding::setClassification(QRhiVertexInputBinding::Classification c)
入力データの分類「c 」を設定します。デフォルトでは、「PerVertex 」に設定されています。
classification()も参照してください 。
void QRhiVertexInputBinding::setInstanceStepRate(quint32 rate)
インスタンスのステップrate を設定します。デフォルトでは、これは1に設定されています。
instanceStepRate()も参照してください 。
void QRhiVertexInputBinding::setStride(quint32 s)
ストライドをs に設定します。
stride()も参照してください 。
quint32 QRhiVertexInputBinding::stride() const
ストライドをバイト単位で返します。
setStride()も参照してください 。
関連する非メンバー関数
[noexcept] size_t qHash(const QRhiVertexInputBinding &key, size_t seed = 0)
`key` のハッシュ値を返し、計算のシードとして `seed ` を使用します。
[noexcept] bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b)
2つのQRhiVertexInputBinding オブジェクトa とb の値が等しい場合はfalse を返し、そうでない場合はtrue を返します。
[noexcept] bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b)
2つのQRhiVertexInputBinding オブジェクトであるa とb の値が等しい場合、true を返します。
© 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.