Qbs

Blog Documentation Get Qbs Community
  • Qbs Manual
  • QbsModules
  • Qt.shadertools
  • Qbs 3.0.1
  • Qt.shadertools

    Provides Qt Shader Tools support. More...

    Properties

    Detailed Description

    The Qt.shadertools module provides functionality for compiling and processing shaders in Qbs projects. It supports various shader languages including GLSL, HLSL, and MSL.

    Relevant File Tags

    TagAuto-tagged File NamesSinceDescription
    qt.shader*.vert, *.tesc, *.tese, *.frag, *.comp3.0Source files with these extensions are considered shaders and are processed by the qsb tool.
    qt.shader.vertex*.vert3.0Source files with this extension are considered vertex shaders.
    qt.shader.fragment*.frag3.0Source files with this extension are considered fragment shaders.
    qt.shader.compute*.comp3.0Source files with this extension are considered compute shaders.
    qt.shader.tessellation*.tesc3.0Source files with this extension are considered tessellation shaders. These shaders are automatically processed by using tessellation properties.
    qt.compiled_shadern/a3.0This tag is attached to the output artifacts of the rule that runs the qsb tool.

    Example

    QtApplication {
        name: "shader-app"
        type: "application"
    
        Depends { name: "Qt.shadertools" }
    
        files: ["shader.frag", "shader.vert"]
        Qt.shadertools.glslVersions: ["300 es", "330"]
        Qt.shadertools.hlslVersions: ["50"]
        Qt.shadertools.mslVersions: ["12"]
    }

    For more details on the qsb tool, see its documentation

    Property Documentation

    addResourceData : bool

    Whether to automatically add the compiled shaders to the Qt resource data.

    Default: true


    batchable : bool

    Whether vertex shaders should be made batchable for use with Qt Quick.

    Default: false


    debugInformation : bool

    Whether to generate full debug information for SPIR-V.

    Default: false


    defines : stringList

    List of preprocessor defines to be active during shader compilation.

    Defines should be added as "<name>=<value>" pairs.

    Default: []


    enableLinking : bool

    Set this property to true to enable linking to the QtShaderTools library.

    For example:

    QtApplication {
        name: "shader-app"
        Depends { name: "Qt.shadertools" }
        Qt.shadertools.enableLinking: true
    }

    The Qt.shadertools module can be used in two ways:

    This property and useCompiler property controls which mode is used. You can also enable both modes by setting both properties to true.

    Default: false


    generatedShadersDir : string

    The directory where compiled shaders will be placed.

    Default: "shaders"


    glslVersions : stringList

    List of GLSL versions to generate. Each version should be specified as a string, for example "100 es" for GLSL ES 1.00.

    If this property is set to [], GLSL generation is disabled.

    Default: []


    hlslVersions : stringList

    List of HLSL (shader model) versions to generate. The versions follow GLSL-style version numbers, where 50 corresponds to Shader Model 5.0.

    If this property is set to [], HLSL generation is disabled.

    Default: []


    mslVersions : stringList

    List of Metal Shading Language versions to generate. 12 corresponds to version 1.2.

    If this property is set to [], MSL generation is disabled.

    Default: []


    optimized : bool

    Whether to perform SPIR-V optimizations using spirv-opt.

    Default: false


    qsbName : string

    The name of the Qt Shader Tools compiler executable.

    Default: "qsb"


    tessellation : bool

    Whether the shaders are used in a pipeline that uses tessellation.

    By default, Qbs adds flags contolled by tessellationMode and tessellationVertexCount properties for all files with the "qt.shader.tessellation" file tag. Set this property to false to disable tessellation options for such files.

    Default: true


    tessellationMode : string

    The tessellation mode. Can be either "triangles" or "quads".

    This property must be specified when a tessellation control shader is used.

    Default: "triangles"


    tessellationVertexCount : int

    The output vertex count from the tessellation control stage.

    Default: 3


    useCompiler : bool

    Whether to use the Qt Shader Tools compiler.

    Set this property to false to disable the qsb tool. This is set to false by default if enableLinking is true.

    Default: true


    useQt6Versions : bool

    Use default version used by Qt6.

    This is equivalent to passing --qt6 switch to the qsb tool.

    Default: false


    viewCount : int

    The number of views a vertex shader is used with. Relevant for multiview functionality (GL_OVR_multiview2, VK_KHR_multiview, D3D12 view instancing).

    Default: undefined


    zOrderLocation : int

    When batchable is true, this specifies the location for the additional vertex input that is injected with location 7 by default.

    Use this property to change the location of the injected vertex input to another value.

    This becomes relevant if the vertex shader has many inputs and 7 is in use and would clash.

    Default: undefined