이 페이지에서

QRhiVertexInputAttribute 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 Format { Float4, Float3, Float2, Float, UNormByte4, …, SShort }

공개 함수

QRhiVertexInputAttribute()
QRhiVertexInputAttribute(int binding, int location, QRhiVertexInputAttribute::Format format, quint32 offset, int matrixSlice = -1)
int binding() const
QRhiVertexInputAttribute::Format format() const
int location() const
int matrixSlice() const
quint32 offset() const
void setBinding(int b)
void setFormat(QRhiVertexInputAttribute::Format f)
void setLocation(int loc)
void setMatrixSlice(int slice)
void setOffset(quint32 ofs)
size_t qHash(const QRhiVertexInputAttribute &key, size_t seed = 0)
bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b)
bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b)

상세 설명

이 멤버들은 단일 정점 입력 요소에 대한 바인딩 번호, 위치, 형식 및 오프셋을 지정합니다.

참고: HLSL의 경우 , SPIR-V에서 변환된 버텍스 셰이더는 각 입력에 대해 ‘ TEXCOORD<location> ’를 시맨틱으로 사용한다고 가정합니다. 따라서 별도의 시맨틱 이름과 인덱스는 없습니다.

예를 들어, 다음과 같은 입력을 가진 정점 셰이더가 있다고 가정해 봅시다.

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) }
});
inputLayout.setAttributes({
    { 0, 0, QRhiVertexInputAttribute::Float3, 0 },
    { 1, 1, QRhiVertexInputAttribute::Float2, 0 }
});

이러한 버텍스 입력 레이아웃을 가진 그래픽스 파이프라인이 바인딩되면, 위치 데이터가 먼저 오고 그 다음에 텍스처 좌표가 오는 단일 버퍼가 있다고 가정할 때, 36개의 버텍스를 가진 큐브를 그리기 위해 버텍스 입력을 다음과 같이 설정할 수 있습니다:

const QRhiCommandBuffer::VertexInput vbufBindings[] = {
    { cubeBuf, 0 },
    { cubeBuf, 36 * 3 * sizeof(float) }
};
cb->setVertexInput(0, 2, vbufBindings);

인터리브된 데이터를 다룰 때는 일반적으로 바인딩이 하나뿐이며, 여러 속성이 동일한 버퍼 바인딩 지점을 참조합니다:

QRhiVertexInputLayout inputLayout;
inputLayout.setBindings({
    { 5 * sizeof(float) }
});
inputLayout.setAttributes({
    { 0, 0, QRhiVertexInputAttribute::Float3, 0 },
    { 0, 1, QRhiVertexInputAttribute::Float2, 3 * sizeof(float) }
});

그리고 다음과 같이:

const QRhiCommandBuffer::VertexInput vbufBinding(interleavedCubeBuf, 0);
cb->setVertexInput(0, 1, &vbufBinding);

참고: 이는 호환성 보장이 제한적인 RHI API입니다. 자세한 내용은 QRhi 를 참조하십시오.

QRhiCommandBuffer::setVertexInput()도 참조하십시오 .

멤버 유형 문서

enum QRhiVertexInputAttribute::Format

요소 데이터의 유형을 지정합니다.

상수값설명
QRhiVertexInputAttribute::Float404개의 성분을 가진 float 벡터
QRhiVertexInputAttribute::Float313개 성분의 float 벡터
QRhiVertexInputAttribute::Float22두 성분의 부동소수점 벡터
QRhiVertexInputAttribute::Float3부동 소수점
QRhiVertexInputAttribute::UNormByte444성분 정규화된 부호 없는 바이트 벡터
QRhiVertexInputAttribute::UNormByte252성분 정규화된 부호 없는 바이트 벡터
QRhiVertexInputAttribute::UNormByte6정규화된 부호 없는 바이트
QRhiVertexInputAttribute::UInt474성분 부호 없는 정수 벡터
QRhiVertexInputAttribute::UInt383성분 부호 없는 정수 벡터
QRhiVertexInputAttribute::UInt292성분 부호 없는 정수 벡터
QRhiVertexInputAttribute::UInt10부호 없는 정수
QRhiVertexInputAttribute::SInt4114성분 부호 있는 정수 벡터
QRhiVertexInputAttribute::SInt3123성분 부호 있는 정수 벡터
QRhiVertexInputAttribute::SInt2132성분 부호 있는 정수 벡터
QRhiVertexInputAttribute::SInt14부호 있는 정수
QRhiVertexInputAttribute::Half4154개 성분의 반정밀도(16비트) 부동소수점 벡터
QRhiVertexInputAttribute::Half3163성분 반정밀도(16비트) 부동소수점 벡터
QRhiVertexInputAttribute::Half2172성분 반정밀도(16비트) 부동소수점 벡터
QRhiVertexInputAttribute::Half18반정밀도(16비트) 부동소수점
QRhiVertexInputAttribute::UShort4194개 성분의 부호 없는 짧은 정수(16비트) 벡터
QRhiVertexInputAttribute::UShort3203성분 부호 없는 short(16비트) 정수 벡터
QRhiVertexInputAttribute::UShort2212성분 부호 없는 짧은 정수(16비트) 벡터
QRhiVertexInputAttribute::UShort22부호 없는 short(16비트) 정수
QRhiVertexInputAttribute::SShort4234개 성분의 부호 있는 short(16비트) 정수 벡터
QRhiVertexInputAttribute::SShort3243성분 부호 있는 short(16비트) 정수 벡터
QRhiVertexInputAttribute::SShort2252성분 부호 있는 short(16비트) 정수 벡터
QRhiVertexInputAttribute::SShort26부호 있는 short(16비트) 정수

참고: 반정밀도 부동소수점 속성에 대한지원 여 부는 런타임에 ` QRhi::Feature::HalfAttributes ` 기능 플래그로 표시됩니다.

참고: Direct3D 11/12는 16비트 입력 속성을 지원하지만 Half3, UShort3 또는 SShort3 유형은 지원하지 않습니다. D3D 백엔드는 Half3를 Half4로, UShort3를 UShort4로, SShort3를 SShort4로 전달합니다. 크로스 플랫폼 호환성을 보장하려면 16비트 입력을 8바이트로 패딩해야 합니다.

멤버 함수 설명서

[constexpr noexcept default] QRhiVertexInputAttribute::QRhiVertexInputAttribute()

기본 정점 입력 속성 설명을 생성합니다.

QRhiVertexInputAttribute::QRhiVertexInputAttribute(int binding, int location, QRhiVertexInputAttribute::Format format, quint32 offset, int matrixSlice = -1)

지정된 binding 번호, location, format 및 offset 를 사용하여 정점 입력 속성 설명을 생성합니다.

matrixSlice 이 속성이 행렬의 행 또는 열에 해당하는 경우(예를 들어, 4x4 행렬은 4개의 vec4가 되어 4개의 연속된 정점 입력 위치를 차지함)를 제외하고는 -1이어야 하며, 해당 경우에는 행 또는 열의 인덱스가 됩니다. location - matrixSlice 는 항상 언롤된 행렬의 첫 번째 행 또는 열에 대한 location 와 같아야 합니다.

int QRhiVertexInputAttribute::binding() const

바인딩 포인트 인덱스를 반환합니다.

setBinding()도 참조하십시오 .

QRhiVertexInputAttribute::Format QRhiVertexInputAttribute::format() const

정점 입력 요소의 형식을 반환합니다.

setFormat()도 참조하십시오 .

int QRhiVertexInputAttribute::location() const

정점 입력 요소의 위치를 반환합니다.

setLocation()도 참조하십시오 .

int QRhiVertexInputAttribute::matrixSlice() const

입력 요소가 행렬의 행이나 열에 해당할 경우 행렬의 해당 부분을 반환하고, 해당하지 않을 경우 -1을 반환합니다.

setMatrixSlice()도 참조하십시오 .

quint32 QRhiVertexInputAttribute::offset() const

입력 요소의 바이트 오프셋을 반환합니다.

setOffset()도 참조하십시오 .

void QRhiVertexInputAttribute::setBinding(int b)

바인딩 포인트 인덱스를 b 로 설정합니다. 기본적으로 이 값은 0으로 설정되어 있습니다.

binding()도 참조하십시오 .

void QRhiVertexInputAttribute::setFormat(QRhiVertexInputAttribute::Format f)

정점 입력 요소의 형식을 ` f`로 설정합니다. 기본적으로 이 값은 `Float4`로 설정되어 있습니다.

format()도 참조하십시오 .

void QRhiVertexInputAttribute::setLocation(int loc)

버텍스 입력 요소의 위치를 loc 로 설정합니다. 기본적으로 이 값은 0으로 설정되어 있습니다.

location()도 참조하십시오 .

void QRhiVertexInputAttribute::setMatrixSlice(int slice)

slice 행렬을 설정합니다. 기본값은 -1이며, 이 속성이 행렬의 행 또는 열에 해당할 때만 a >= 0 값으로 설정해야 합니다(예를 들어, 4x4 행렬은 4개의 vec4가 되어 4개의 연속된 정점 입력 위치를 차지하게 됨). 이 경우 a는 해당 행 또는 열의 인덱스가 됩니다. location - matrixSlice 는 항상 언롤된 행렬의 첫 번째 행 또는 열에 대한 location 와 같아야 합니다.

matrixSlice()도 참조하십시오 .

void QRhiVertexInputAttribute::setOffset(quint32 ofs)

입력 요소의 바이트 오프셋을 ofs 로 설정합니다.

offset()도 참조하십시오 .

관련 비멤버 함수

[noexcept] size_t qHash(const QRhiVertexInputAttribute &key, size_t seed = 0)

seed 를 계산의 시드로 사용하여 key 의 해시 값을 반환합니다.

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

두 개의 ` QRhiVertexInputAttribute ` 객체 a 와 b 의 값이 같으면 ` false `를 반환하고, 그렇지 않으면 ` true`를 반환합니다.

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

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