Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QShaderDescription Class Reference

\inmodule QtGui More...

#include <qshaderdescription.h>

+ Collaboration diagram for QShaderDescription:

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...
 

Public Types

enum  VariableType {
  Unknown = 0 , Float , Vec2 , Vec3 ,
  Vec4 , Mat2 , Mat2x3 , Mat2x4 ,
  Mat3 , Mat3x2 , Mat3x4 , Mat4 ,
  Mat4x2 , Mat4x3 , Int , Int2 ,
  Int3 , Int4 , Uint , Uint2 ,
  Uint3 , Uint4 , Bool , Bool2 ,
  Bool3 , Bool4 , Double , Double2 ,
  Double3 , Double4 , DMat2 , DMat2x3 ,
  DMat2x4 , DMat3 , DMat3x2 , DMat3x4 ,
  DMat4 , DMat4x2 , DMat4x3 , Sampler1D ,
  Sampler2D , Sampler2DMS , Sampler3D , SamplerCube ,
  Sampler1DArray , Sampler2DArray , Sampler2DMSArray , Sampler3DArray ,
  SamplerCubeArray , SamplerRect , SamplerBuffer , SamplerExternalOES ,
  Sampler , Image1D , Image2D , Image2DMS ,
  Image3D , ImageCube , Image1DArray , Image2DArray ,
  Image2DMSArray , Image3DArray , ImageCubeArray , ImageRect ,
  ImageBuffer , Struct , Half , Half2 ,
  Half3 , Half4
}
 Represents the type of a variable or block member. More...
 
enum  ImageFormat {
  ImageFormatUnknown = 0 , ImageFormatRgba32f = 1 , ImageFormatRgba16f = 2 , ImageFormatR32f = 3 ,
  ImageFormatRgba8 = 4 , ImageFormatRgba8Snorm = 5 , ImageFormatRg32f = 6 , ImageFormatRg16f = 7 ,
  ImageFormatR11fG11fB10f = 8 , ImageFormatR16f = 9 , ImageFormatRgba16 = 10 , ImageFormatRgb10A2 = 11 ,
  ImageFormatRg16 = 12 , ImageFormatRg8 = 13 , ImageFormatR16 = 14 , ImageFormatR8 = 15 ,
  ImageFormatRgba16Snorm = 16 , ImageFormatRg16Snorm = 17 , ImageFormatRg8Snorm = 18 , ImageFormatR16Snorm = 19 ,
  ImageFormatR8Snorm = 20 , ImageFormatRgba32i = 21 , ImageFormatRgba16i = 22 , ImageFormatRgba8i = 23 ,
  ImageFormatR32i = 24 , ImageFormatRg32i = 25 , ImageFormatRg16i = 26 , ImageFormatRg8i = 27 ,
  ImageFormatR16i = 28 , ImageFormatR8i = 29 , ImageFormatRgba32ui = 30 , ImageFormatRgba16ui = 31 ,
  ImageFormatRgba8ui = 32 , ImageFormatR32ui = 33 , ImageFormatRgb10a2ui = 34 , ImageFormatRg32ui = 35 ,
  ImageFormatRg16ui = 36 , ImageFormatRg8ui = 37 , ImageFormatR16ui = 38 , ImageFormatR8ui = 39
}
 Image format. More...
 
enum  ImageFlag { ReadOnlyImage = 1 << 0 , WriteOnlyImage = 1 << 1 }
 Image flags. More...
 
enum  QualifierFlag {
  QualifierReadOnly = 1 << 0 , QualifierWriteOnly = 1 << 1 , QualifierCoherent = 1 << 2 , QualifierVolatile = 1 << 3 ,
  QualifierRestrict = 1 << 4
}
 Qualifier flags. More...
 
enum  BuiltinType {
  PositionBuiltin = 0 , PointSizeBuiltin = 1 , ClipDistanceBuiltin = 3 , CullDistanceBuiltin = 4 ,
  VertexIdBuiltin = 5 , InstanceIdBuiltin = 6 , PrimitiveIdBuiltin = 7 , InvocationIdBuiltin = 8 ,
  LayerBuiltin = 9 , ViewportIndexBuiltin = 10 , TessLevelOuterBuiltin = 11 , TessLevelInnerBuiltin = 12 ,
  TessCoordBuiltin = 13 , PatchVerticesBuiltin = 14 , FragCoordBuiltin = 15 , PointCoordBuiltin = 16 ,
  FrontFacingBuiltin = 17 , SampleIdBuiltin = 18 , SamplePositionBuiltin = 19 , SampleMaskBuiltin = 20 ,
  FragDepthBuiltin = 22 , NumWorkGroupsBuiltin = 24 , WorkgroupSizeBuiltin = 25 , WorkgroupIdBuiltin = 26 ,
  LocalInvocationIdBuiltin = 27 , GlobalInvocationIdBuiltin = 28 , LocalInvocationIndexBuiltin = 29 , VertexIndexBuiltin = 42 ,
  InstanceIndexBuiltin = 43
}
 \variable QShaderDescription::BuiltinVariable::type More...
 
enum  TessellationMode { UnknownTessellationMode , TrianglesTessellationMode , QuadTessellationMode , IsolineTessellationMode }
 \value UnknownTessellationMode \value TrianglesTessellationMode \value QuadTessellationMode \value IsolineTessellationMode More...
 
enum  TessellationWindingOrder { UnknownTessellationWindingOrder , CwTessellationWindingOrder , CcwTessellationWindingOrder }
 \value UnknownTessellationWindingOrder \value CwTessellationWindingOrder \value CcwTessellationWindingOrder More...
 
enum  TessellationPartitioning { UnknownTessellationPartitioning , EqualTessellationPartitioning , FractionalEvenTessellationPartitioning , FractionalOddTessellationPartitioning }
 \value UnknownTessellationPartitioning \value EqualTessellationPartitioning \value FractionalEvenTessellationPartitioning \value FractionalOddTessellationPartitioning More...
 

Public Member Functions

 QShaderDescription ()
 Constructs a new, empty QShaderDescription.
 
 QShaderDescription (const QShaderDescription &other)
 Constructs a copy of other.
 
QShaderDescriptionoperator= (const QShaderDescription &other)
 Assigns other to this object.
 
 ~QShaderDescription ()
 Destructor.
 
void detach ()
 
bool isValid () const
 
void serialize (QDataStream *stream, int version) const
 Serializes this QShaderDescription to stream.
 
QByteArray toJson () const
 
QList< InOutVariableinputVariables () const
 
QList< InOutVariableoutputVariables () const
 
QList< UniformBlockuniformBlocks () const
 
QList< PushConstantBlockpushConstantBlocks () const
 
QList< StorageBlockstorageBlocks () const
 
QList< InOutVariablecombinedImageSamplers () const
 
QList< InOutVariableseparateImages () const
 
QList< InOutVariableseparateSamplers () const
 
QList< InOutVariablestorageImages () const
 
QList< BuiltinVariableinputBuiltinVariables () const
 
QList< BuiltinVariableoutputBuiltinVariables () const
 
std::array< uint, 3 > computeShaderLocalSize () const
 
uint tessellationOutputVertexCount () const
 
TessellationMode tessellationMode () const
 
TessellationWindingOrder tessellationWindingOrder () const
 
TessellationPartitioning tessellationPartitioning () const
 

Static Public Member Functions

static QShaderDescription deserialize (QDataStream *stream, int version)
 

Friends

struct QShaderDescriptionPrivate
 
Q_GUI_EXPORT QDebug operator<< (QDebug, const QShaderDescription &)
 
Q_GUI_EXPORT bool operator== (const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept
 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 &lhs, const QShaderDescription &rhs) noexcept
 Returns true if the two QShaderDescription objects lhs and rhs are equal.
 

Detailed Description

\inmodule QtGui

Since
6.6

Describes the interface of a shader.

Warning
The QRhi family of classes in the Qt Gui module, including QShader and QShaderDescription, offer limited compatibility guarantees. There are no source or binary compatibility guarantees for these classes, meaning the API is only guaranteed to work with the Qt version the application was developed against. Source incompatible changes are however aimed to be kept at a minimum and will only be made in minor releases (6.7, 6.8, and so on). To use these classes in an application, link to {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.

Member Enumeration Documentation

◆ BuiltinType

\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

Enumerator
PositionBuiltin 
PointSizeBuiltin 
ClipDistanceBuiltin 
CullDistanceBuiltin 
VertexIdBuiltin 
InstanceIdBuiltin 
PrimitiveIdBuiltin 
InvocationIdBuiltin 
LayerBuiltin 
ViewportIndexBuiltin 
TessLevelOuterBuiltin 
TessLevelInnerBuiltin 
TessCoordBuiltin 
PatchVerticesBuiltin 
FragCoordBuiltin 
PointCoordBuiltin 
FrontFacingBuiltin 
SampleIdBuiltin 
SamplePositionBuiltin 
SampleMaskBuiltin 
FragDepthBuiltin 
NumWorkGroupsBuiltin 
WorkgroupSizeBuiltin 
WorkgroupIdBuiltin 
LocalInvocationIdBuiltin 
GlobalInvocationIdBuiltin 
LocalInvocationIndexBuiltin 
VertexIndexBuiltin 
InstanceIndexBuiltin 

Definition at line 247 of file qshaderdescription.h.

◆ ImageFlag

Image flags.

\value ReadOnlyImage \value WriteOnlyImage

Enumerator
ReadOnlyImage 
WriteOnlyImage 

Definition at line 169 of file qshaderdescription.h.

◆ ImageFormat

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

Enumerator
ImageFormatUnknown 
ImageFormatRgba32f 
ImageFormatRgba16f 
ImageFormatR32f 
ImageFormatRgba8 
ImageFormatRgba8Snorm 
ImageFormatRg32f 
ImageFormatRg16f 
ImageFormatR11fG11fB10f 
ImageFormatR16f 
ImageFormatRgba16 
ImageFormatRgb10A2 
ImageFormatRg16 
ImageFormatRg8 
ImageFormatR16 
ImageFormatR8 
ImageFormatRgba16Snorm 
ImageFormatRg16Snorm 
ImageFormatRg8Snorm 
ImageFormatR16Snorm 
ImageFormatR8Snorm 
ImageFormatRgba32i 
ImageFormatRgba16i 
ImageFormatRgba8i 
ImageFormatR32i 
ImageFormatRg32i 
ImageFormatRg16i 
ImageFormatRg8i 
ImageFormatR16i 
ImageFormatR8i 
ImageFormatRgba32ui 
ImageFormatRgba16ui 
ImageFormatRgba8ui 
ImageFormatR32ui 
ImageFormatRgb10a2ui 
ImageFormatRg32ui 
ImageFormatRg16ui 
ImageFormatRg8ui 
ImageFormatR16ui 
ImageFormatR8ui 

Definition at line 125 of file qshaderdescription.h.

◆ QualifierFlag

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.

◆ TessellationMode

\value UnknownTessellationMode \value TrianglesTessellationMode \value QuadTessellationMode \value IsolineTessellationMode

Enumerator
UnknownTessellationMode 
TrianglesTessellationMode 
QuadTessellationMode 
IsolineTessellationMode 

Definition at line 293 of file qshaderdescription.h.

◆ TessellationPartitioning

\value UnknownTessellationPartitioning \value EqualTessellationPartitioning \value FractionalEvenTessellationPartitioning \value FractionalOddTessellationPartitioning

Enumerator
UnknownTessellationPartitioning 
EqualTessellationPartitioning 
FractionalEvenTessellationPartitioning 
FractionalOddTessellationPartitioning 

Definition at line 310 of file qshaderdescription.h.

◆ TessellationWindingOrder

\value UnknownTessellationWindingOrder \value CwTessellationWindingOrder \value CcwTessellationWindingOrder

Enumerator
UnknownTessellationWindingOrder 
CwTessellationWindingOrder 
CcwTessellationWindingOrder 

Definition at line 302 of file qshaderdescription.h.

◆ VariableType

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

Enumerator
Unknown 
Float 
Vec2 
Vec3 
Vec4 
Mat2 
Mat2x3 
Mat2x4 
Mat3 
Mat3x2 
Mat3x4 
Mat4 
Mat4x2 
Mat4x3 
Int 
Int2 
Int3 
Int4 
Uint 
Uint2 
Uint3 
Uint4 
Bool 
Bool2 
Bool3 
Bool4 
Double 
Double2 
Double3 
Double4 
DMat2 
DMat2x3 
DMat2x4 
DMat3 
DMat3x2 
DMat3x4 
DMat4 
DMat4x2 
DMat4x3 
Sampler1D 
Sampler2D 
Sampler2DMS 
Sampler3D 
SamplerCube 
Sampler1DArray 
Sampler2DArray 
Sampler2DMSArray 
Sampler3DArray 
SamplerCubeArray 
SamplerRect 
SamplerBuffer 
SamplerExternalOES 
Sampler 
Image1D 
Image2D 
Image2DMS 
Image3D 
ImageCube 
Image1DArray 
Image2DArray 
Image2DMSArray 
Image3DArray 
ImageCubeArray 
ImageRect 
ImageBuffer 
Struct 
Half 
Half2 
Half3 
Half4 

Definition at line 42 of file qshaderdescription.h.

Constructor & Destructor Documentation

◆ QShaderDescription() [1/2]

QShaderDescription::QShaderDescription ( )

Constructs a new, empty QShaderDescription.

Note
Being empty implies that isValid() returns false for the newly constructed instance.

Definition at line 551 of file qshaderdescription.cpp.

◆ QShaderDescription() [2/2]

QShaderDescription::QShaderDescription ( const QShaderDescription & other)

Constructs a copy of other.

Definition at line 567 of file qshaderdescription.cpp.

References QBasicAtomicInteger< T >::ref(), and QShaderDescriptionPrivate::ref.

+ Here is the call graph for this function:

◆ ~QShaderDescription()

QShaderDescription::~QShaderDescription ( )

Destructor.

Definition at line 585 of file qshaderdescription.cpp.

References QBasicAtomicInteger< T >::deref(), and QShaderDescriptionPrivate::ref.

+ Here is the call graph for this function:

Member Function Documentation

◆ combinedImageSamplers()

QList< QShaderDescription::InOutVariable > QShaderDescription::combinedImageSamplers ( ) const
Returns
the list of combined image samplers

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.

References QShaderDescriptionPrivate::combinedImageSamplers.

Referenced by addOpaqueDepthPrePassBindings(), and QSSGRhiShaderPipeline::addStage().

+ Here is the caller graph for this function:

◆ computeShaderLocalSize()

std::array< uint, 3 > QShaderDescription::computeShaderLocalSize ( ) const
Returns
the local size of a compute shader.

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.

References QShaderDescriptionPrivate::localSize.

◆ deserialize()

QShaderDescription QShaderDescription::deserialize ( QDataStream * stream,
int version )
static
Returns
a new QShaderDescription loaded from stream. version specifies the qsb version.
See also
serialize()

Definition at line 633 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::get().

Referenced by QShader::fromSerialized().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detach()

void QShaderDescription::detach ( )

Definition at line 559 of file qshaderdescription.cpp.

References qAtomicDetach().

+ Here is the call graph for this function:

◆ inputBuiltinVariables()

QVector< QShaderDescription::BuiltinVariable > QShaderDescription::inputBuiltinVariables ( ) const
Returns
the list of active builtins used as input. For example, a tessellation evaluation shader reading the value of gl_TessCoord and gl_Position will have TessCoordBuiltin and PositionBuiltin listed here.

Definition at line 822 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::inBuiltins.

◆ inputVariables()

QList< QShaderDescription::InOutVariable > QShaderDescription::inputVariables ( ) const
Returns
the list of input variables. This includes vertex inputs (sometimes called attributes) for the vertex stage, and inputs for other stages (sometimes called varyings).

Definition at line 645 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::inVars.

Referenced by QSSGRhiShaderPipeline::addStage().

+ Here is the caller graph for this function:

◆ isValid()

bool QShaderDescription::isValid ( ) const

◆ operator=()

QShaderDescription & QShaderDescription::operator= ( const QShaderDescription & other)

Assigns other to this object.

Definition at line 576 of file qshaderdescription.cpp.

References other(), and qAtomicAssign().

+ Here is the call graph for this function:

◆ outputBuiltinVariables()

QVector< QShaderDescription::BuiltinVariable > QShaderDescription::outputBuiltinVariables ( ) const
Returns
the list of active built-in variables used as input. For example, a vertex shader will very often have PositionBuiltin as an output built-in.

Definition at line 831 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::outBuiltins.

◆ outputVariables()

QList< QShaderDescription::InOutVariable > QShaderDescription::outputVariables ( ) const
Returns
the list of output variables.

Definition at line 653 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::outVars.

◆ pushConstantBlocks()

QList< QShaderDescription::PushConstantBlock > QShaderDescription::pushConstantBlocks ( ) const
Returns
the list of push constant blocks.
Note
Avoid relying on push constant blocks for shaders that are to be used in combination with the Qt Rendering Hardware Interface since that currently has no support for them.

Definition at line 673 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::pushConstantBlocks.

◆ separateImages()

QList< QShaderDescription::InOutVariable > QShaderDescription::separateImages ( ) const

Definition at line 780 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::separateImages.

◆ separateSamplers()

QList< QShaderDescription::InOutVariable > QShaderDescription::separateSamplers ( ) const

◆ serialize()

void QShaderDescription::serialize ( QDataStream * stream,
int version ) const

Serializes this QShaderDescription to stream.

version specifies the qsb version.

See also
deserialize(), toJson()

Definition at line 622 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::writeToStream().

Referenced by QShader::serialized().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storageBlocks()

QList< QShaderDescription::StorageBlock > QShaderDescription::storageBlocks ( ) const
Returns
the list of shader storage blocks.

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 } ]

Note
The size of the last member in the storage block is undefined. This shows up as 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.
SSBOs are not available with some graphics APIs, such as, OpenGL 2.x or OpenGL ES older than 3.1.

Definition at line 748 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::storageBlocks.

Referenced by QMetalComputePipeline::create().

+ Here is the caller graph for this function:

◆ storageImages()

QList< QShaderDescription::InOutVariable > QShaderDescription::storageImages ( ) const
Returns
the list of image variables.

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" } ]

Note
Separate image objects are not compatible with some graphics APIs, such as, OpenGL 2.x or OpenGL ES older than 3.1.

Definition at line 812 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::storageImages.

◆ tessellationMode()

QShaderDescription::TessellationMode QShaderDescription::tessellationMode ( ) const
Returns
the tessellation execution mode for a tessellation control or evaluation shader.

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.

References QShaderDescriptionPrivate::tessMode.

◆ tessellationOutputVertexCount()

uint QShaderDescription::tessellationOutputVertexCount ( ) const
Returns
the number of output vertices.

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.

References QShaderDescriptionPrivate::tessOutVertCount.

◆ tessellationPartitioning()

QShaderDescription::TessellationPartitioning QShaderDescription::tessellationPartitioning ( ) const
Returns
the tessellation partitioning mode for a tessellation control or evaluation shader.

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.

References QShaderDescriptionPrivate::tessPart.

◆ tessellationWindingOrder()

QShaderDescription::TessellationWindingOrder QShaderDescription::tessellationWindingOrder ( ) const
Returns
the tessellation winding order for a tessellation control or evaluation shader.

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.

References QShaderDescriptionPrivate::tessWind.

◆ toJson()

QByteArray QShaderDescription::toJson ( ) const
Returns
a serialized JSON text version of the data.
Note
There is no deserialization method provided for JSON text.
See also
serialize()

Definition at line 611 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::makeDoc(), and QJsonDocument::toJson().

+ Here is the call graph for this function:

◆ uniformBlocks()

QList< QShaderDescription::UniformBlock > QShaderDescription::uniformBlocks ( ) const
Returns
the list of uniform blocks.

Definition at line 661 of file qshaderdescription.cpp.

References QShaderDescriptionPrivate::uniformBlocks.

Referenced by QSSGRhiShaderPipeline::addStage().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

Q_GUI_EXPORT QDebug operator<< ( QDebug ,
const QShaderDescription &  )
friend

Definition at line 1194 of file qshaderdescription.cpp.

◆ operator==() [1/2]

bool operator== ( const QShaderDescription & lhs,
const QShaderDescription & rhs )
related

Returns true if the two QShaderDescription objects lhs and rhs are equal.

Definition at line 1980 of file qshaderdescription.cpp.

◆ operator== [2/2]

bool operator== ( const QShaderDescription & lhs,
const QShaderDescription & rhs )
friend

Returns true if the two QShaderDescription objects lhs and rhs are equal.

Definition at line 1980 of file qshaderdescription.cpp.

◆ QShaderDescriptionPrivate

friend struct QShaderDescriptionPrivate
friend

Definition at line 321 of file qshaderdescription.h.


The documentation for this class was generated from the following files: