PySide6.QtGui.QRhiShaderStage¶
- class QRhiShaderStage¶
Specifies the type and the shader code for a shader stage in the pipeline.
Details
When setting up a
QRhiGraphicsPipeline, a collection of shader stages are specified. TheQRhiShaderStagecontains aQShaderand some associated metadata, such as the graphics pipeline stage, and theshader variantto select. There is no need to specify the shader language or version because theQRhibackend in use at runtime will take care of choosing the appropriate shader version from the collection within theQShader.The typical usage is in combination with
setShaderStages(), shown here with a simple approach to load theQShaderfrom.qsbfiles generated offline or at build time: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 } });Note
This is a RHI API with limited compatibility guarantees, see
QRhifor details.Added in version 6.6.
Synopsis¶
Methods¶
def
__init__()def
__ne__()def
__eq__()def
setShader()def
setType()def
shader()def
shaderVariant()def
type()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- class Type¶
Specifies the type of the shader stage.
Constant
Description
QRhiShaderStage.Type.Vertex
Vertex stage
QRhiShaderStage.Type.TessellationControl
Tessellation control (hull shader) stage. Must be used only when the
Tessellationfeature is supported.QRhiShaderStage.Type.TessellationEvaluation
Tessellation evaluation (domain shader) stage. Must be used only when the
Tessellationfeature is supported.QRhiShaderStage.Type.Fragment
Fragment (pixel shader) stage
QRhiShaderStage.Type.Compute
Compute stage. Must be used only when the
Computefeature is supported.QRhiShaderStage.Type.Geometry
Geometry stage. Must be used only when the
GeometryShaderfeature is supported.
- __init__()¶
Constructs a shader stage description for the vertex stage with an empty
QShader.- __init__(type, shader[, v=QShader.StandardShader])
Constructs a shader stage description with the
typeof the stage and theshader.The shader variant
vdefaults toStandardShader. AQShadercontains multiple source and binary versions of a shader. In addition, it can also contain variants of the shader with slightly modified code.vcan then be used to select the desired variant.- __ne__(b)¶
- Parameters:
b –
QRhiShaderStage- Return type:
bool
- __eq__(b)¶
- Parameters:
b –
QRhiShaderStage- Return type:
bool
Sets the shader collection
s.See also
Sets the requested shader variant
v.See also
Sets the type of the stage to
t. Setters should rarely be needed in pratice. Most applications will likely use theQRhiShaderStageconstructor in most cases.See also
Returns the
QShaderto be used for this stage in the graphics pipeline.See also
Returns the requested shader variant.
See also
Returns the type of the stage.
See also