![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtGui More...
#include <qshaderdescription.h>
Classes | |
struct | BlockVariable |
\variable QShaderDescription::InOutVariable::name More... | |
struct | BuiltinVariable |
\variable QShaderDescription::StorageBlock::blockName More... | |
struct | InOutVariable |
\inmodule QtGui More... | |
struct | PushConstantBlock |
\variable QShaderDescription::UniformBlock::blockName More... | |
struct | StorageBlock |
\variable QShaderDescription::PushConstantBlock::name More... | |
struct | UniformBlock |
\variable QShaderDescription::BlockVariable::name More... | |
Static Public Member Functions | |
static QShaderDescription | deserialize (QDataStream *stream, int version) |
Friends | |
struct | QShaderDescriptionPrivate |
Q_GUI_EXPORT QDebug | operator<< (QDebug dbg, const QShaderDescription &sd) |
Q_GUI_EXPORT bool | operator== (const QShaderDescription &lhs, const QShaderDescription &rhs) |
Returns true if the two QShaderDescription objects lhs and rhs are equal. | |
Related Symbols | |
(Note that these are not member symbols.) | |
bool | operator== (const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept |
Returns true if the two InOutVariable objects lhs and rhs are equal. | |
bool | operator== (const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept |
Returns true if the two BlockVariable objects lhs and rhs are equal. | |
bool | operator== (const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept |
Returns true if the two UniformBlock objects lhs and rhs are equal. | |
bool | operator== (const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept |
Returns true if the two PushConstantBlock objects lhs and rhs are equal. | |
bool | operator== (const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept |
Returns true if the two StorageBlock objects lhs and rhs are equal. | |
bool | operator== (const QShaderDescription::BuiltinVariable &lhs, const QShaderDescription::BuiltinVariable &rhs) noexcept |
Returns true if the two BuiltinVariable objects lhs and rhs are equal. | |
\inmodule QtGui
Describes the interface of a shader.
{Qt::GuiPrivate} (if using CMake), and include the headers with the rhi
prefix, for example
{#include <rhi/qshaderdescription.h>}.A shader typically has a set of inputs and outputs. A vertex shader for example has a number of input variables and may use one or more uniform buffers to access data (e.g. a modelview matrix) provided by the application. The shader for the fragment stage receives data from the vertex stage (in a simple setup) and may also rely on data from uniform buffers, images, and samplers.
When it comes to vertex inputs and the layout of the uniform buffers (what are the names of the members? what is there size, offset, and so on), applications and frameworks may need to discover this dynamically at run time. This is typical when the shader is not built-in but provided by an external entity, like the user.
Modern and lean graphics APIs may no longer provide a way to query shader reflection information at run time. Therefore, such data is now automatically generated by QShaderBaker and is provided as a QShaderDescription object for each and every QShader.
Definition at line 26 of file qshaderdescription.h.
\variable QShaderDescription::BuiltinVariable::type
\variable QShaderDescription::BuiltinVariable::varType
\variable QShaderDescription::BuiltinVariable::arrayDims
Built-in variable type.
\value PositionBuiltin \value PointSizeBuiltin \value ClipDistanceBuiltin \value CullDistanceBuiltin \value VertexIdBuiltin \value InstanceIdBuiltin \value PrimitiveIdBuiltin \value InvocationIdBuiltin \value LayerBuiltin \value ViewportIndexBuiltin \value TessLevelOuterBuiltin \value TessLevelInnerBuiltin \value TessCoordBuiltin \value PatchVerticesBuiltin \value FragCoordBuiltin \value PointCoordBuiltin \value FrontFacingBuiltin \value SampleIdBuiltin \value SamplePositionBuiltin \value SampleMaskBuiltin \value FragDepthBuiltin \value NumWorkGroupsBuiltin \value WorkgroupSizeBuiltin \value WorkgroupIdBuiltin \value LocalInvocationIdBuiltin \value GlobalInvocationIdBuiltin \value LocalInvocationIndexBuiltin \value VertexIndexBuiltin \value InstanceIndexBuiltin
Definition at line 247 of file qshaderdescription.h.
Image flags.
\value ReadOnlyImage \value WriteOnlyImage
Enumerator | |
---|---|
ReadOnlyImage | |
WriteOnlyImage |
Definition at line 169 of file qshaderdescription.h.
Image format.
\value ImageFormatUnknown \value ImageFormatRgba32f \value ImageFormatRgba16f \value ImageFormatR32f \value ImageFormatRgba8 \value ImageFormatRgba8Snorm \value ImageFormatRg32f \value ImageFormatRg16f \value ImageFormatR11fG11fB10f \value ImageFormatR16f \value ImageFormatRgba16 \value ImageFormatRgb10A2 \value ImageFormatRg16 \value ImageFormatRg8 \value ImageFormatR16 \value ImageFormatR8 \value ImageFormatRgba16Snorm \value ImageFormatRg16Snorm \value ImageFormatRg8Snorm \value ImageFormatR16Snorm \value ImageFormatR8Snorm \value ImageFormatRgba32i \value ImageFormatRgba16i \value ImageFormatRgba8i \value ImageFormatR32i \value ImageFormatRg32i \value ImageFormatRg16i \value ImageFormatRg8i \value ImageFormatR16i \value ImageFormatR8i \value ImageFormatRgba32ui \value ImageFormatRgba16ui \value ImageFormatRgba8ui \value ImageFormatR32ui \value ImageFormatRgb10a2ui \value ImageFormatRg32ui \value ImageFormatRg16ui \value ImageFormatRg8ui \value ImageFormatR16ui \value ImageFormatR8ui
Definition at line 125 of file qshaderdescription.h.
Qualifier flags.
\value QualifierReadOnly \value QualifierWriteOnly \value QualifierCoherent \value QualifierVolatile \value QualifierRestrict
Enumerator | |
---|---|
QualifierReadOnly | |
QualifierWriteOnly | |
QualifierCoherent | |
QualifierVolatile | |
QualifierRestrict |
Definition at line 175 of file qshaderdescription.h.
\value UnknownTessellationMode \value TrianglesTessellationMode \value QuadTessellationMode \value IsolineTessellationMode
Enumerator | |
---|---|
UnknownTessellationMode | |
TrianglesTessellationMode | |
QuadTessellationMode | |
IsolineTessellationMode |
Definition at line 293 of file qshaderdescription.h.
\value UnknownTessellationPartitioning \value EqualTessellationPartitioning \value FractionalEvenTessellationPartitioning \value FractionalOddTessellationPartitioning
Enumerator | |
---|---|
UnknownTessellationPartitioning | |
EqualTessellationPartitioning | |
FractionalEvenTessellationPartitioning | |
FractionalOddTessellationPartitioning |
Definition at line 310 of file qshaderdescription.h.
\value UnknownTessellationWindingOrder \value CwTessellationWindingOrder \value CcwTessellationWindingOrder
Enumerator | |
---|---|
UnknownTessellationWindingOrder | |
CwTessellationWindingOrder | |
CcwTessellationWindingOrder |
Definition at line 302 of file qshaderdescription.h.
Represents the type of a variable or block member.
\value Unknown \value Float \value Vec2 \value Vec3 \value Vec4 \value Mat2 \value Mat2x3 \value Mat2x4 \value Mat3 \value Mat3x2 \value Mat3x4 \value Mat4 \value Mat4x2 \value Mat4x3 \value Int \value Int2 \value Int3 \value Int4 \value Uint \value Uint2 \value Uint3 \value Uint4 \value Bool \value Bool2 \value Bool3 \value Bool4 \value Double \value Double2 \value Double3 \value Double4 \value DMat2 \value DMat2x3 \value DMat2x4 \value DMat3 \value DMat3x2 \value DMat3x4 \value DMat4 \value DMat4x2 \value DMat4x3 \value Sampler1D \value Sampler2D \value Sampler2DMS \value Sampler3D \value SamplerCube \value Sampler1DArray \value Sampler2DArray \value Sampler2DMSArray \value Sampler3DArray \value SamplerCubeArray \value SamplerRect \value SamplerBuffer \value SamplerExternalOES \value Sampler For separate samplers. \value Image1D \value Image2D \value Image2DMS \value Image3D \value ImageCube \value Image1DArray \value Image2DArray \value Image2DMSArray \value Image3DArray \value ImageCubeArray \value ImageRect \value ImageBuffer \value Struct \value Half \value Half2 \value Half3 \value Half4
Definition at line 42 of file qshaderdescription.h.
QShaderDescription::QShaderDescription | ( | ) |
Constructs a new, empty QShaderDescription.
false
for the newly constructed instance. Definition at line 551 of file qshaderdescription.cpp.
QShaderDescription::QShaderDescription | ( | const QShaderDescription & | other | ) |
Constructs a copy of other.
Definition at line 567 of file qshaderdescription.cpp.
QShaderDescription::~QShaderDescription | ( | ) |
Destructor.
Definition at line 585 of file qshaderdescription.cpp.
QList< QShaderDescription::InOutVariable > QShaderDescription::combinedImageSamplers | ( | ) | const |
With GLSL/Vulkan shaders as source a {layout(binding = 1) uniform sampler2D tex;} uniform generates the following: (shown as textual JSON here)
\badcode "combinedImageSamplers": [ { "binding": 1, "name": "tex", "set": 0, "type": "sampler2D" } ]
This does not mean that other language versions of the shader must also use a combined image sampler, especially considering that the concept may not exist everywhere. For instance, a HLSL version will likely just use a Texture2D and SamplerState object with registers t1 and s1, respectively.
Definition at line 775 of file qshaderdescription.cpp.
std::array< uint, 3 > QShaderDescription::computeShaderLocalSize | ( | ) | const |
For example, for a compute shader with the following declaration the function returns { 256, 16, 1}.
\badcode layout(local_size_x = 256, local_size_y = 16, local_size_z = 1) in;
Definition at line 846 of file qshaderdescription.cpp.
|
static |
Definition at line 633 of file qshaderdescription.cpp.
void QShaderDescription::detach | ( | ) |
Definition at line 559 of file qshaderdescription.cpp.
QVector< QShaderDescription::BuiltinVariable > QShaderDescription::inputBuiltinVariables | ( | ) | const |
Definition at line 822 of file qshaderdescription.cpp.
QList< QShaderDescription::InOutVariable > QShaderDescription::inputVariables | ( | ) | const |
Definition at line 645 of file qshaderdescription.cpp.
bool QShaderDescription::isValid | ( | ) | const |
Definition at line 595 of file qshaderdescription.cpp.
QShaderDescription & QShaderDescription::operator= | ( | const QShaderDescription & | other | ) |
Assigns other to this object.
Definition at line 576 of file qshaderdescription.cpp.
QVector< QShaderDescription::BuiltinVariable > QShaderDescription::outputBuiltinVariables | ( | ) | const |
Definition at line 831 of file qshaderdescription.cpp.
QList< QShaderDescription::InOutVariable > QShaderDescription::outputVariables | ( | ) | const |
Definition at line 653 of file qshaderdescription.cpp.
QList< QShaderDescription::PushConstantBlock > QShaderDescription::pushConstantBlocks | ( | ) | const |
Definition at line 673 of file qshaderdescription.cpp.
QList< QShaderDescription::InOutVariable > QShaderDescription::separateImages | ( | ) | const |
Definition at line 780 of file qshaderdescription.cpp.
QList< QShaderDescription::InOutVariable > QShaderDescription::separateSamplers | ( | ) | const |
Definition at line 785 of file qshaderdescription.cpp.
void QShaderDescription::serialize | ( | QDataStream * | stream, |
int | version ) const |
Serializes this QShaderDescription to stream.
version specifies the qsb version.
Definition at line 622 of file qshaderdescription.cpp.
QList< QShaderDescription::StorageBlock > QShaderDescription::storageBlocks | ( | ) | const |
For example, with GLSL/Vulkan shaders as source, the declaration
\badcode struct Stuff { vec2 a; vec2 b; }; layout(std140, binding = 0) buffer StuffSsbo { vec4 whatever; Stuff stuff[]; } buf;
generates the following: (shown as textual JSON here)
\badcode "storageBlocks": [ { "binding": 0, "blockName": "StuffSsbo", "instanceName": "buf", "knownSize": 16, "runtimeArrayStride": 16 "members": [ { "name": "whatever", "offset": 0, "size": 16, "type": "vec4" }, { "arrayDims": [ 0 ], "name": "stuff", "offset": 16, "size": 0, "structMembers": [ { "name": "a", "offset": 0, "size": 8, "type": "vec2" }, { "name": "b", "offset": 8, "size": 8, "type": "vec2" } ], "type": "struct" } ], "set": 0 } ]
size
0 and an array dimension of
{[0]}. The storage block's knownSize
excludes the size of the last member since that will only be known at run time. The stride in bytes between array items for a last member with undefined array size is runtimeArrayStride
. This value is determined according to the specified buffer memory layout standard (std140, std430) rules.Definition at line 748 of file qshaderdescription.cpp.
QList< QShaderDescription::InOutVariable > QShaderDescription::storageImages | ( | ) | const |
These will likely occur in compute shaders. For example, {layout (binding = 0, rgba8) uniform readonly image2D inputImage;} generates the following: (shown as textual JSON here)
\badcode "storageImages": [ { "binding": 0, "imageFormat": "rgba8", "name": "inputImage", "set": 0, "type": "image2D" } ]
Definition at line 812 of file qshaderdescription.cpp.
QShaderDescription::TessellationMode QShaderDescription::tessellationMode | ( | ) | const |
When not set, the returned value is UnknownTessellationMode.
For example, for a tessellation evaluation shader with the following declaration the function returns TrianglesTessellationMode.
\badcode layout(triangles) in;
Definition at line 888 of file qshaderdescription.cpp.
uint QShaderDescription::tessellationOutputVertexCount | ( | ) | const |
For example, for a tessellation control shader with the following declaration the function returns 3.
\badcode layout(vertices = 3) out;
Definition at line 861 of file qshaderdescription.cpp.
QShaderDescription::TessellationPartitioning QShaderDescription::tessellationPartitioning | ( | ) | const |
When not set, the returned value is UnknownTessellationPartitioning.
For example, for a tessellation evaluation shader with the following declaration the function returns FractionalOddTessellationPartitioning.
\badcode layout(triangles, fractional_odd_spacing, ccw) in;
Definition at line 941 of file qshaderdescription.cpp.
QShaderDescription::TessellationWindingOrder QShaderDescription::tessellationWindingOrder | ( | ) | const |
When not set, the returned value is UnknownTessellationWindingOrder.
For example, for a tessellation evaluation shader with the following declaration the function returns CcwTessellationWindingOrder.
\badcode layout(triangles, fractional_odd_spacing, ccw) in;
Definition at line 914 of file qshaderdescription.cpp.
QByteArray QShaderDescription::toJson | ( | ) | const |
Definition at line 611 of file qshaderdescription.cpp.
QList< QShaderDescription::UniformBlock > QShaderDescription::uniformBlocks | ( | ) | const |
Definition at line 661 of file qshaderdescription.cpp.
|
friend |
Definition at line 1194 of file qshaderdescription.cpp.
|
friend |
Returns true
if the two QShaderDescription objects lhs and rhs are equal.
Definition at line 1980 of file qshaderdescription.cpp.
|
friend |
Definition at line 321 of file qshaderdescription.h.