![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qrhi.h>
Public Types | |
enum | Type { Vertex , TessellationControl , TessellationEvaluation , Geometry , Fragment , Compute } |
Specifies the type of the shader stage. More... | |
Public Member Functions | |
QRhiShaderStage ()=default | |
Constructs a shader stage description for the vertex stage with an empty QShader. | |
QRhiShaderStage (Type type, const QShader &shader, QShader::Variant v=QShader::StandardShader) | |
Constructs a shader stage description with the type of the stage and the shader. | |
Type | type () const |
void | setType (Type t) |
Sets the type of the stage to t. | |
QShader | shader () const |
void | setShader (const QShader &s) |
Sets the shader collection s. | |
QShader::Variant | shaderVariant () const |
void | setShaderVariant (QShader::Variant v) |
Sets the requested shader variant v. | |
Friends | |
bool | operator== (const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept |
bool | operator!= (const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept |
size_t | qHash (const QRhiShaderStage &v, size_t seed=0) noexcept |
\inmodule QtGui
Specifies the type and the shader code for a shader stage in the pipeline.
When setting up a QRhiGraphicsPipeline, a collection of shader stages are specified. The QRhiShaderStage contains a QShader and some associated metadata, such as the graphics pipeline stage, and the \l{QShader::Variant}{shader variant} to select. There is no need to specify the shader language or version because the QRhi backend in use at runtime will take care of choosing the appropriate shader version from the collection within the QShader.
The typical usage is in combination with QRhiGraphicsPipeline::setShaderStages(), shown here with a simple approach to load the QShader from {.qsb} files generated offline or at build time:
Specifies the type of the shader stage.
\value TessellationControl Tessellation control (hull shader) stage. Must be used only when the QRhi::Tessellation feature is supported.
\value TessellationEvaluation Tessellation evaluation (domain shader) stage. Must be used only when the QRhi::Tessellation feature is supported.
\value Fragment Fragment (pixel shader) stage
\value Compute Compute stage. Must be used only when the QRhi::Compute feature is supported.
\value Geometry Geometry stage. Must be used only when the QRhi::GeometryShader feature is supported.
Enumerator | |
---|---|
Vertex | |
TessellationControl | |
TessellationEvaluation | |
Geometry | |
Fragment | |
Compute |
|
default |
Constructs a shader stage description for the vertex stage with an empty QShader.
QRhiShaderStage::QRhiShaderStage | ( | Type | type, |
const QShader & | shader, | ||
QShader::Variant | v = QShader::StandardShader |
||
) |
Constructs a shader stage description with the type of the stage and the shader.
The shader variant v defaults to QShader::StandardShader. A QShader contains multiple source and binary versions of a shader. In addition, it can also contain variants of the shader with slightly modified code. v can then be used to select the desired variant.
|
inline |
Sets the type of the stage to t.
Setters should rarely be needed in pratice. Most applications will likely use the QRhiShaderStage constructor in most cases.
|
inline |
Definition at line 389 of file qrhi.h.
Referenced by addOpaqueDepthPrePassBindings(), QSSGRhiShaderPipeline::addStage(), QD3D11ComputePipeline::create(), QGles2ComputePipeline::create(), QMetalComputePipeline::create(), QVkComputePipeline::create(), and QRhiGles2::shaderSource().
|
inline |
Definition at line 392 of file qrhi.h.
Referenced by QD3D11ComputePipeline::create(), QGles2ComputePipeline::create(), QMetalComputePipeline::create(), QVkComputePipeline::create(), and QRhiGles2::shaderSource().
|
inline |
Definition at line 386 of file qrhi.h.
Referenced by QSSGRhiShaderPipeline::addStage(), QRhiGles2::compileShader(), QVkComputePipeline::create(), isGraphicsStage(), and QRhiGles2::tryLoadFromDiskOrPipelineCache().
|
friend |
false
if the values in the two QRhiShaderStage objects a and b are equal; otherwise returns true
.
|
friend |
true
if the values in the two QRhiShaderStage objects a and b are equal.
|
friend |