QRhiVertexInputBinding Class

버텍스 입력 바인딩을 설명합니다. 더 보기...

Header: #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) 가 버퍼(또는 별도의 버퍼)에 인터리브되지 않은 형식으로 제공된다고 가정해 보겠습니다. 그러면 두 개의 바인딩을 다음과 같이 정의할 수 있습니다:

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 에서 정의된 인덱스( isetVertexInput()의 두 번째 인수의 인덱스)가 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 로 버텍스 입력 바인딩 설명을 구성합니다.

참고: 1 이외의stepRateQRhi::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)

seed 을 사용하여 key 에 대한 해시값을 반환합니다.

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

두 개의 QRhiVertexInputBinding 객체 ab 의 값이 같으면 false 를 반환하고, 그렇지 않으면 true 를 반환합니다.

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

두 개의 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.