QRhiShaderStage 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 | Type { Vertex, TessellationControl, TessellationEvaluation, Fragment, Compute, Geometry } |
공용 함수
QRhiShaderStage() | |
QRhiShaderStage(QRhiShaderStage::Type type, const QShader &shader, QShader::Variant v = QShader::StandardShader) | |
void | setShader(const QShader &s) |
void | setShaderVariant(QShader::Variant v) |
void | setType(QRhiShaderStage::Type t) |
QShader | shader() const |
QShader::Variant | shaderVariant() const |
QRhiShaderStage::Type | type() const |
관련 비회원
size_t | qHash(const QRhiShaderStage &key, size_t seed = 0) |
bool | operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) |
bool | operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) |
상세 설명
QRhiGraphicsPipeline 을 설정할 때 셰이더 스테이지의 컬렉션이 지정됩니다. QRhiShaderStage에는 QShader 및 그래픽 파이프라인 스테이지와 같은 일부 관련 메타데이터와 선택할 shader variant 이 포함됩니다. 런타임에 사용 중인 QRhi 백엔드가 QShader 내의 컬렉션에서 적절한 셰이더 버전을 선택하기 때문에 셰이더 언어나 버전을 지정할 필요가 없습니다.
일반적인 사용법은 QRhiGraphicsPipeline::setShaderStages()와 결합하여 오프라인 또는 빌드 시 생성된 .qsb
파일에서 QShader 을 로드하는 간단한 접근 방식입니다:
QShader getShader(const QString &name) { QFile f(name); return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader(); } QShader vs = getShader("material.vert.qsb"); QShader fs = getShader("material.frag.qsb"); pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vs }, { QRhiShaderStage::Fragment, fs } });
참고: 이 API는 호환성이 제한적으로 보장되는 RHI API이며, 자세한 내용은 QRhi 을 참조하세요.
멤버 유형 문서
enum QRhiShaderStage::Type
셰이더 스테이지의 유형을 지정합니다.
Constant | 값 | 설명 |
---|---|---|
QRhiShaderStage::Vertex | 0 | 버텍스 스테이지 |
QRhiShaderStage::TessellationControl | 1 | 테셀레이션 제어(헐 셰이더) 스테이지입니다. QRhi::Tessellation 기능이 지원되는 경우에만 사용해야 합니다. |
QRhiShaderStage::TessellationEvaluation | 2 | 테셀레이션 평가(도메인 셰이더) 단계. QRhi::Tessellation 기능이 지원되는 경우에만 사용해야 합니다. |
QRhiShaderStage::Fragment | 4 | 프래그먼트(픽셀 셰이더) 단계 |
QRhiShaderStage::Compute | 5 | 계산 단계. QRhi::Compute 기능이 지원되는 경우에만 사용해야 합니다. |
QRhiShaderStage::Geometry | 3 | 지오메트리 단계. QRhi::GeometryShader 기능이 지원되는 경우에만 사용해야 합니다. |
멤버 함수 문서
[noexcept]
QRhiShaderStage::QRhiShaderStage()
빈 QShader 으로 버텍스 스테이지에 대한 셰이더 스테이지 설명을 구성합니다.
QRhiShaderStage::QRhiShaderStage(QRhiShaderStage::Type type, const QShader &shader, QShader::Variant v = QShader::StandardShader)
스테이지의 type 와 shader 로 셰이더 스테이지 설명을 구성합니다.
셰이더 변형 v 은 기본값이 QShader::StandardShader 입니다. QShader 에는 셰이더의 여러 소스 및 바이너리 버전이 포함됩니다. 또한 약간 수정된 코드가 있는 셰이더 배리언트를 포함할 수도 있습니다. v 을 사용하여 원하는 배리언트를 선택할 수 있습니다.
void QRhiShaderStage::setShader(const QShader &s)
셰이더 컬렉션을 설정합니다 s.
shader()도 참조하세요 .
void QRhiShaderStage::setShaderVariant(QShader::Variant v)
요청된 셰이더 배리언트를 설정합니다 v.
shaderVariant()도 참조하세요 .
void QRhiShaderStage::setType(QRhiShaderStage::Type t)
스테이지의 유형을 t 로 설정합니다. 실제로는 설정자가 거의 필요하지 않습니다. 대부분의 애플리케이션은 QRhiShaderStage 생성자를 사용하는 경우가 대부분입니다.
type()도 참조하세요 .
QShader QRhiShaderStage::shader() const
그래픽 파이프라인에서 이 단계에 사용할 QShader 을 반환합니다.
setShader()도 참조하세요 .
QShader::Variant QRhiShaderStage::shaderVariant() const
요청된 셰이더 배리언트를 반환합니다.
setShaderVariant()도 참조하세요 .
QRhiShaderStage::Type QRhiShaderStage::type() const
스테이지의 유형을 반환합니다.
setType()도 참조하세요 .
관련 비회원
[noexcept]
size_t qHash(const QRhiShaderStage &key, size_t seed = 0)
seed 을 사용하여 key 에 대한 해시값을 반환합니다.
[noexcept]
bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b)
두 개의 QRhiShaderStage 객체 a 와 b 의 값이 같으면 false
를 반환하고, 그렇지 않으면 true
를 반환합니다.
[noexcept]
bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b)
두 개의 QRhiShaderStage 객체 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.