user: How do I use GPU Types (gpu.types) in Blender? Include parameters, examples, warnings and best practices.

assistant: are less than the depth value in the output buffer.

    fragment_out(*slot*, *type*, *name*, *\**, *blend='NONE'*)
    :   Specify a fragment output corresponding to a framebuffer target slot.

        Parameters:
        :   - **slot** (*int*) – The attribute index.
            - **type** (*str*) –

              One of these types:

              - `FLOAT`
              - `VEC2`
              - `VEC3`
              - `VEC4`
              - `MAT3`
              - `MAT4`
              - `UINT`
              - `UVEC2`
              - `UVEC3`
              - `UVEC4`
              - `INT`
              - `IVEC2`
              - `IVEC3`
              - `IVEC4`
              - `BOOL`
            - **name** (*str*) – Name of the attribute.
            - **blend** (*str*) – Dual Source Blending Index. It can be ‘NONE’, ‘SRC_0’ or ‘SRC_1’.

    fragment_source(*source*)
    :   Fragment shader source code written in GLSL.

        Example:

        ```
        "void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}"
        ```

        Parameters:
        :   **source** (*str*) – The fragment shader source code.

    image(*slot*, *format*, *type*, *name*, *\**, *qualifiers={'NO_RESTRICT'}*)
    :   Specify an image resource used for arbitrary load and store operations.

        Parameters:
        :   - **slot** (*int*) – The image resource index.
            - **format** (*str*) –

              The GPUTexture format that is passed to the shader. Possible values are:

              - `RGBA8UI`
              - `RGBA8I`
              - `RGBA8`
              - `RGBA32UI`
              - `RGBA32I`
              - `RGBA32F`
              - `RGBA16UI`
              - `RGBA16I`
              - `RGBA16F`
              - `RGBA16`
              - `RG8UI`
              - `RG8I`
              - `RG8`
              - `RG32UI`
              - `RG32I`
              - `RG32F`
              - `RG16UI`
              - `RG16I`
              - `RG16F`
              - `RG16`
              - `R8UI`
              - `R8I`
              - `R8`
              - `R32UI`
              - `R32I`
              - `R32F`
              - `R16UI`
              - `R16I`
              - `R16F`
              - `R16`
              - `R11F_G11F_B10F`
              - `DEPTH32F_STENCIL8`
              - `DEPTH24_STENCIL8` (deprecated, use `DEPTH32F_STENCIL8`)
              - `SRGB8_A8`
              - `RGB16F`
              - `SRGB8_A8_DXT1`
              - `SRGB8_A8_DXT3`
              - `SRGB8_A8_DXT5`
              - `RGBA8_DXT1`
              - `RGBA8_DXT3`
              - `RGBA8_DXT5`
              - `DEPTH_COMPONENT32F`
              - `DEPTH_COMPONENT24` (deprecated, use `DEPTH_COMPONENT32F`)
              - `DEPTH_COMPONENT16`
            - **type** (*str*) –

              The data type describing how the image is to be read in the shader. Possible values are:

              - `FLOAT_BUFFER`
              - `FLOAT_1D`
              - `FLOAT_1D_ARRAY`
              - `FLOAT_2D`
              - `FLOAT_2D_ARRAY`
              - `FLOAT_3D`
              - `FLOAT_CUBE`
              - `FLOAT_CUBE_ARRAY`
              - `INT_BUFFER`
              - `INT_1D`
              - `INT_1D_ARRAY`
              - `INT_2D`
              - `INT_2D_ARRAY`
              - `INT_3D`
              - `INT_CUBE`
              - `INT_CUBE_ARRAY`
              - `UINT_BUFFER`
              - `UINT_1D`
              - `UINT_1D_ARRAY`
              - `UINT_2D`
              - `UINT_2D_ARRAY`
              - `UINT_3D`
              - `UINT_CUBE`
              - `UINT_CUBE_ARRAY`
              - `SHADOW_2D`
              - `SHADOW_2D_ARRAY`
              - `SHADOW_CUBE`
              - `SHADOW_CUBE_ARRAY`
              - `DEPTH_2D`
              - `DEPTH_2D_ARRAY`
              - `DEPTH_CUBE`
              - `DEPTH_CUBE_ARRAY`
            - **name** (*str*) – The image resource name.
            - **qualifiers** (*set**[**str**]*) – Set containing values that describe how the image resource is to be read or written. Possible values are:
              - `NO_RESTRICT`
              - `READ`
              - `WRITE`

    local_group_size(*x*, *y=1*, *z=1*)
    :   Specify the local group size for compute shaders.

        Parameters:
        :   - **x** (*int*) – The local group size in the x dimension.
            - **y** (*int*) – The local group size in the y dimension. Optional. Defaults to 1.
            - **z** (*int*) – The local group size in the z dimension. Optional. Defaults to 1.

    push_constant(*type*, *name*, *size=0*)
    :   Specify a global access constant.

        Parameters:
        :   - **type** (*str*) –

              One of these types:

              - `FLOAT`
              - `VEC2`
              - `VEC3`
              - `VEC4`
              - `MAT3`
              - `MAT4`
              - `UINT`
              - `UVEC2`
              - `UVEC3`
              - `UVEC4`
              - `INT`
              - `IVEC2`
              - `IVEC3`
              - `IVEC4`
              - `BOOL`
            - **name** (*str*) – Name of the constant.
            - **size** (*int*) – If not zero, indicates that the constant is an array with the specified size.

    sampler(*slot*, *type*, *name*)
    :   Specify an image texture sampler.

        Parameters:
        :   - **slot** (*int*) – The image texture sampler index.
            - **type** (*str*) –

              The data type describing the format of each sampler unit. Possible values are:

              - `FLOAT_BUFFER`
              - `FLOAT_1D`
              - `FLOAT_1D_ARRAY`
              - `FLOAT_2D`
              - `FLOAT_2D_ARRAY`
              - `FLOAT_3D`
              - `FLOAT_CUBE`
              - `FLOAT_CUBE_ARRAY`
              - `INT_BUFFER`
              - `INT_1D`
              - `INT_1D_ARRAY`
              - `INT_2D`
              - `INT_2D_ARRAY`
              - `INT_3D`
              - `INT_CUBE`
              - `INT_CUBE_ARRAY`
              - `UINT_BUFFER`
              - `UINT_1D`
              - `UINT_1D_ARRAY`
              - `UINT_2D`
              - `UINT_2D_ARRAY`
              - `UINT_3D`
              - `UINT_CUBE`
              - `UINT_CUBE_ARRAY`
              - `SHADOW_2D`
              - `SHADOW_2D_ARRAY`
              - `SHADOW_CUBE`
              - `SHADOW_CUBE_ARRAY`
              - `DEPTH_2D`
              - `DEPTH_2D_ARRAY`
              - `DEPTH_CUBE`
              - `DEPTH_CUBE_ARRAY`
            - **name** (*str*) – The image texture sampler name.

    typedef_source(*source*)
    :   Source code included before resource declaration. Useful for defining structs used by Uniform Buffers.

        Example:

        ```
        "struct MyType {int foo; float bar;};"
        ```

        Parameters:
        :   **source** (*str*) – The source code defining types.

    uniform_buf(*slot*, *type_name*, *name*)
    :   Specify a uniform variable whose type can be one of those declared in [`gpu.types.GPUShaderCreateInfo.typedef_source()`](#gpu.types.GPUShaderCreateInfo.typedef_source "gpu.types.GPUShaderCreateInfo.typedef_source").

        Parameters:
        :   - **slot** (*int*) – The uniform variable index.
            - **type_name** (*str*) – Name of the data type. It can be a struct type defined in the source passed through the [`gpu.types.GPUShaderCreateInfo.typedef_source()`](#gpu.types.GPUShaderCreateInfo.typedef_source "gpu.types.GPUShaderCreateInfo.typedef_source").
            - **name** (*str*) – The uniform variable name.

    vertex_in(*slot*, *type*, *name*)
    :   Add a vertex shader input attribute.

        Parameters:
        :   - **slot** (*int*) – The attribute index.
            - **type** (*str*) –

              One of these types:

              - `FLOAT`
              - `VEC2`
              - `VEC3`
              - `VEC4`
              - `MAT3`
              - `MAT4`
              - `UINT`
              - `UVEC2`
              - `UVEC3`
              - `UVEC4`
              - `INT`
              - `IVEC2`
              - `IVEC3`
              - `IVEC4`
              - `BOOL`
            - **name** (*str*) – name of the attribute.

    vertex_out(*interface*)
    :   Add a vertex shader output interface block.

        Parameters:
        :   **interface** ([`gpu.types.GPUStageInterfaceInfo`](#gpu.types.GPUStageInterfaceInfo "gpu.types.GPUStageInterfaceInfo")) – Object describing the block.

    vertex_source(*source*)
    :   Vertex shader source code written in GLSL.

        Example:

        ```
        "void main {gl_Position = vec4(pos, 1.0);}"
        ```

        Parameters:
        :   **source** (*str*) – The vertex shader source code.

*class* gpu.types.GPUStageInterfaceInfo(*name*)
:   List of varyings between shader stages.

    Parameters:
    :   **name** – Name of the interface block.

    flat(*type*, *name*)
    :   Add an attribute with qualifier of type `flat` to the interface block.

        Parameters:
        :   - **type** (*str*) –

              One of these types:

              - `FLOAT`
              - `VEC2`
              - `VEC3`
              - `VEC4`
              - `MAT3`
              - `MAT4`
              - `UINT`
              - `UVEC2`
              - `UVEC3`
              - `UVEC4`
              - `INT`
              - `IVEC2`
              - `IVEC3`
              - `IVEC4`
              - `BOOL`
            - **name** (*str*) – name of the attribute.

    no_perspective(*type*, *name*)
    :   Add an attribute with qualifier of type `no_perspective` to the interface block.

        Parameters:
        :   - **type** (*str*) –

              One of these types:

              - `FLOAT`
              - `VEC2`
              - `VEC3`
              - `VEC4`
              - `MAT3`
              - `MAT4`
              - `UINT`
              - `UVEC2`
              - `UVEC3`
              - `UVEC4`
              - `INT`
              - `IVEC2`
              - `IVEC3`
              - `IVEC4`
              - `BOOL`
            - **name** (*str*) – name of the attribute.

    smooth(*type*, *name*)
    :   Add an attribute with qualifier of type *smooth* to the interface block.

        Parameters:
        :   - **type** (*str*) –

              One of these types:

              - `FLOAT`
              - `VEC2`
              - `VEC3`
              - `VEC4`
              - `MAT3`
              - `MAT4`
              - `UINT`
              - `UVEC2`
              - `UVEC3`
              - `UVEC4`
              - `INT`
              - `IVEC2`
              - `IVEC3`
              - `IVEC4`
              - `BOOL`
            - **name** (*str*) – name of the attribute.

    name
    :   Name of the interface block.

        Type:
        :   str

*class* gpu.types.GPUTexture(*size*, *\**, *layers=0*, *is_cubemap=False*, *format='RGBA8'*, *data=None*)
:   This object gives access to off GPU textures.

    Parameters:
    :   - **size** (*int* *|* *Sequence**[**int**]*) – Dimensions of the texture 1D, 2D, 3D or cubemap.
        - **layers** (*int*) – Number of layers in texture array or number of cubemaps in cubemap array
        - **is_cubemap** (*int*) – Indicates the creation of a cubemap texture.
        - **format** (*str*) – Internal data format inside GPU memory. Possible values are:
          `RGBA8UI`,
          `RGBA8I`,
          `RGBA8`,
          `RGBA32UI`,
          `RGBA32I`,
          `RGBA32F`,
          `RGBA16UI`,
          `RGBA16I`,
          `RGBA16F`,
          `RGBA16`,
          `RG8UI`,
          `RG8I`,
          `RG8`,
          `RG32UI`,
          `RG32I`,
          `RG32F`,
          `RG16UI`,
          `RG16I`,
          `RG16F`,
          `RG16`,
          `R8UI`,
          `R8I`,
          `R8`,
          `R32UI`,
          `R32I`,
          `R32F`,
          `R16UI`,
          `R16I`,
          `R16F`,
          `R16`,
          `R11F_G11F_B10F`,
          `DEPTH32F_STENCIL8`,
          `DEPTH24_STENCIL8` (deprecated, use `DEPTH32F_STENCIL8`),
          `SRGB8_A8`,
          `RGB16F`,
          `SRGB8_A8_DXT1`,
          `SRGB8_A8_DXT3`,
          `SRGB8_A8_DXT5`,
          `RGBA8_DXT1`,
          `RGBA8_DXT3`,
          `RGBA8_DXT5`,
          `DEPTH_COMPONENT32F`,
          `DEPTH_COMPONENT24`, (deprecated, use `DEPTH_COMPONENT32F`),
          `DEPTH_COMPONENT16`.
        - **data** ([`gpu.types.Buffer`](#gpu.types.Buffer "gpu.types.Buffer")) – Buffer object to fill the texture.

    clear(*format='FLOAT'*, *value=(0.0, 0.0, 0.0, 1.0)*)
    :   Fill texture with specific value.

        Parameters:
        :   - **format** (*str*) – The format that describes the content of a single item.
              Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` & `10_11_11_REV`.
              `UINT_24_8` is deprecated, use `FLOAT` instead.
            - **value** (*Sequence**[**float**]*) – Sequence each representing the value to fill. Sizes 1..4 are supported.

    read()
    :   Creates a buffer with the value of all pixels.

    format
    :   Format of the texture.

        Type:
        :   str

    height
    :   Height of the texture.

        Type:
        :   int

    width
    :   Width of the texture.

        Type:
        :   int

*class* gpu.types.GPUUniformBuf(*data*)
:   This object gives access to off uniform buffers.

    Parameters:
    :   **data** (*object exposing buffer interface*) – Data to fill the buffer.

    update(*data*)
    :   Update the data of the uniform buffer object.

*class* gpu.types.GPUVertBuf(*format*, *len*)
:   Contains a VBO.

    Parameters:
    :   - **format** ([`gpu.types.GPUVertFormat`](#gpu.types.GPUVertFormat "gpu.types.GPUVertFormat")) – Vertex format.
        - **len** (*int*) – Amount of vertices that will fit into this buffer.

    attr_fill(*id*, *data*)
    :   Insert data into the buffer for a single attribute.

        Parameters:
        :   - **id** (*int* *|* *str*) – Either the name or the id of the attribute.
            - **data** ([*Buffer*](#gpu.types.Buffer "gpu.types.Buffer") *|* *Sequence**[**float**]* *|* *Sequence**[**int**]* *|* *Sequence**[**Sequence**[**float**]**]* *|* *Sequence**[**Sequence**[**int**]**]*) – Buffer or sequence of data that should be stored in the buffer

*class* gpu.types.GPUVertFormat
:   This object contains information about the structure of a vertex buffer.

    attr_add(*id*, *comp_type*, *len*, *fetch_mode*)
    :   Add a new attribute to the format.

        Parameters:
        :   - **id** (*str*) – Name the attribute. Often `position`, `normal`, …
            - **comp_type** (*str*) – The data type that will be used store the value in memory.
              Possible values are `I8`, `U8`, `I16`, `U16`, `I32`, `U32`, `F32` & `I10`.
            - **len** (*int*) – How many individual values the attribute consists of
              (e.g. 2 for uv coordinates).
            - **fetch_mode** (*str*) – How values from memory will be converted when used in the shader.
              This is mainly useful for memory optimizations when you want to store values with
              reduced precision. E.g. you can store a float in only 1 byte but it will be
              converted to a normal 4 byte float when used.
              Possible values are `FLOAT`, `INT` or `INT_TO_FLOAT_UNIT`.