QShaderVersion Class

Specifies the shading language version. 更多...

頭: #include <QShaderVersion>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Since: Qt 6.6

公共類型

enum Flag { GlslEs }
flags Flags

公共函數

QShaderVersion ()
QShaderVersion (int v , QShaderVersion::Flags f = Flags())
QShaderVersion::Flags flags () const
void setFlags (QShaderVersion::Flags f )
void setVersion (int v )
int version () const
bool operator!= (const QShaderVersion & lhs , const QShaderVersion & rhs )
bool operator< (const QShaderVersion & lhs , const QShaderVersion & rhs )
bool operator== (const QShaderVersion & lhs , const QShaderVersion & rhs )

詳細描述

While languages like SPIR-V or the Metal Shading Language use traditional version numbers, shaders for other APIs can use slightly different versioning schemes. All those are mapped to a single version number in here, however. For HLSL, the version refers to the Shader Model version, like 5.0, 5.1, or 6.0. For GLSL an additional flag is needed to choose between GLSL and GLSL/ES.

Below is a list with the most common examples of shader versions for different graphics APIs:

  • Vulkan (SPIR-V): 100
  • OpenGL: 120, 330, 440, etc.
  • OpenGL ES: 100 with GlslEs , 300 with GlslEs ,等。
  • Direct3D: 50, 51, 60
  • Metal: 12, 20

A default constructed QShaderVersion contains a version of 100 and no flags set.

注意: This is a RHI API with limited compatibility guarantees, see QShader 瞭解細節。

成員類型文檔編製

enum QShaderVersion:: Flag
flags QShaderVersion:: Flags

Describes the flags that can be set.

常量 描述
QShaderVersion::GlslEs 0x01 Indicates that GLSL/ES is meant in combination with GlslShader

Flags 類型是 typedef 對於 QFlags <Flag>。它存儲 Flag 值的 OR (或) 組閤。

成員函數文檔編製

[constexpr noexcept] QShaderVersion:: QShaderVersion ()

QShaderVersion:: QShaderVersion ( int v , QShaderVersion::Flags f = Flags())

Constructs a new QShaderVersion with version v and flags f .

QShaderVersion::Flags QShaderVersion:: flags () const

Returns the flags.

另請參閱 setFlags ().

void QShaderVersion:: setFlags ( QShaderVersion::Flags f )

Sets the flags f .

另請參閱 flags ().

void QShaderVersion:: setVersion ( int v )

Sets the shading language version to v .

另請參閱 version ().

int QShaderVersion:: version () const

Returns the version.

另請參閱 setVersion ().

相關非成員

[noexcept] bool operator!= (const QShaderVersion & lhs , const QShaderVersion & rhs )

返迴 false if the values in the two QShaderVersion 對象 lhs and rhs 相等;否則返迴 true .

[noexcept] bool operator< (const QShaderVersion & lhs , const QShaderVersion & rhs )

返迴 true 若 lhs < rhs .

Establishes a sorting order between the two QShaderVersion lhs and rhs .

[noexcept] bool operator== (const QShaderVersion & lhs , const QShaderVersion & rhs )

返迴 true 若兩 QShaderVersion 對象 lhs and rhs 相等。