QRhiVertexInputAttribute 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 | 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);
참고: 이 API는 호환성이 제한적으로 보장되는 RHI API이며, 자세한 내용은 QRhi 을 참조하세요.
QRhiCommandBuffer::setVertexInput()도 참조하세요 .
멤버 유형 문서
enum QRhiVertexInputAttribute::Format
요소 데이터의 유형을 지정합니다.
상수 | 값 | 설명 |
---|---|---|
QRhiVertexInputAttribute::Float4 | 0 | 4성분 실수 벡터 |
QRhiVertexInputAttribute::Float3 | 1 | 3성분 실수 벡터 |
QRhiVertexInputAttribute::Float2 | 2 | 2 컴포넌트 플로트 벡터 |
QRhiVertexInputAttribute::Float | 3 | Float |
QRhiVertexInputAttribute::UNormByte4 | 4 | 4성분 정규화된 부호 없는 바이트 벡터 |
QRhiVertexInputAttribute::UNormByte2 | 5 | 2성분 정규화된 부호 없는 바이트 벡터 |
QRhiVertexInputAttribute::UNormByte | 6 | 정규화된 부호 없는 바이트 |
QRhiVertexInputAttribute::UInt4 | 7 | 4성분 부호 없는 정수 벡터 |
QRhiVertexInputAttribute::UInt3 | 8 | 3성분 부호 없는 정수 벡터 |
QRhiVertexInputAttribute::UInt2 | 9 | 2성분 부호 없는 정수 벡터 |
QRhiVertexInputAttribute::UInt | 10 | 부호 없는 정수 |
QRhiVertexInputAttribute::SInt4 | 11 | 4성분 부호화된 정수 벡터 |
QRhiVertexInputAttribute::SInt3 | 12 | 3성분 부호화된 정수 벡터 |
QRhiVertexInputAttribute::SInt2 | 13 | 2성분 부호화된 정수 벡터 |
QRhiVertexInputAttribute::SInt | 14 | 부호 있는 정수 |
QRhiVertexInputAttribute::Half4 | 15 | 4성분 반정도(16비트) 부동 소수점 벡터 |
QRhiVertexInputAttribute::Half3 | 16 | 3성분 반정도(16비트) 부동 소수점 벡터 |
QRhiVertexInputAttribute::Half2 | 17 | 2성분 반정도(16비트) 부동 소수점 벡터 |
QRhiVertexInputAttribute::Half | 18 | 반정밀도(16비트) 실수 |
QRhiVertexInputAttribute::UShort4 | 19 | 4성분 부호 없는 짧은(16비트) 정수 벡터 |
QRhiVertexInputAttribute::UShort3 | 20 | 3성분 부호 없는 짧은(16비트) 정수 벡터 |
QRhiVertexInputAttribute::UShort2 | 21 | 2성분 부호 없는 짧은(16비트) 정수 벡터 |
QRhiVertexInputAttribute::UShort | 22 | 부호 없는 짧은(16비트) 정수 |
QRhiVertexInputAttribute::SShort4 | 23 | 4성분 부호가 짧은(16비트) 정수 벡터 |
QRhiVertexInputAttribute::SShort3 | 24 | 3성분 부호가 짧은(16비트) 정수 벡터 |
QRhiVertexInputAttribute::SShort2 | 25 | 2성분 부호가 짧은(16비트) 정수 벡터 |
QRhiVertexInputAttribute::SShort | 26 | 부호가 짧은(16비트) 정수 |
참고: 반정밀도 부동 소수점 특성 지원은 런타임에 QRhi::Feature::HalfAttributes 기능 플래그로 표시됩니다.
참고: Direct3D 11/12는 16비트 입력 어트리뷰트를 지원하지만 Half3, UShort3 또는 SShort3 유형은 지원하지 않습니다. D3D 백엔드는 Half3을 Half4로, UShort3을 UShort4로, SShort3을 SShort4로 전달합니다. 플랫폼 간 호환성을 보장하기 위해 16비트 입력은 8바이트로 패딩해야 합니다.
멤버 함수 문서
[constexpr noexcept]
QRhiVertexInputAttribute::QRhiVertexInputAttribute()
기본 버텍스 입력 속성 설명을 구성합니다.
QRhiVertexInputAttribute::QRhiVertexInputAttribute(int binding, int location, QRhiVertexInputAttribute::Format format, quint32 offset, int matrixSlice = -1)
지정된 binding 번호, location, format, offset 로 버텍스 입력 어트리뷰트 설명을 구성합니다.
matrixSlice 이 속성이 행렬의 행 또는 열에 해당하는 경우(예: 4x4 행렬은 4개의 연속된 버텍스 입력 위치를 사용하는 4vec4가 됨)를 제외하고는 -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로 설정되며, 이 속성이 행렬의 행 또는 열에 해당하는 경우에만 >= 0 값으로 설정해야 합니다(예: 4x4 행렬은 4개의 연속된 정점 입력 위치를 사용하는 4개의 vec4가 됨). 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
을 반환합니다.
© 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.