QRhiVertexInputBinding 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 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);

isetVertexInput() の第2引数のインデックスで、startBinding + i で定義されたインデックスが、QRhiVertexInputLayoutbindings ベクトルの対応するエントリのインデックスと一致することに注意してください。

注: ストライドは常に4の倍数でなければならない。

注: これは互換性保証に制限のあるRHI APIである。詳細はQRhi を参照のこと。

QRhiCommandBuffer::setVertexInput()も参照のこと

メンバ型ドキュメント

enum QRhiVertexInputBinding::Classification

入力データの分類を記述する。

定数説明
QRhiVertexInputBinding::PerVertex0データは頂点単位
QRhiVertexInputBinding::PerInstance1データはインスタンス単位

メンバー関数ドキュメント

[constexpr noexcept] QRhiVertexInputBinding::QRhiVertexInputBinding()

デフォルトの頂点入力バインディング記述を構築します。

QRhiVertexInputBinding::QRhiVertexInputBinding(quint32 stride, QRhiVertexInputBinding::Classification cls = PerVertex, quint32 stepRate = 1)

指定されたstride 、分類cls 、インスタンスステップレートstepRate を持つ頂点入力バインディング記述を構築する。

注: QRhi::CustomInstanceStepRate がサポートされていると報告されている場合にのみ、1 以外のstepRate がサポートされる。

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

stride をバイト数で返す。

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 オブジェクトab の値が等しい場合はfalse を返し、そうでない場合はtrue を返す。

[noexcept] bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b)

2つのQRhiVertexInputBinding オブジェクトab の値が等しい場合、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.