QRhiShaderStage 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 | 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 }
});참고: 이는 호환성 보장이 제한된 RHI API입니다. 자세한 내용은 QRhi 를 참조하십시오.
멤버 유형 문서
enum QRhiShaderStage::Type
셰이더 스테이지의 유형을 지정합니다.
| 상수 | 값 | 설명 |
|---|---|---|
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 default] 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 를 반환합니다.
© 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.