Gsk.ShaderArgsBuilder

Fields

None

Methods

class

new (shader, initial_values)

ref ()

set_bool (idx, value)

set_float (idx, value)

set_int (idx, value)

set_uint (idx, value)

set_vec2 (idx, value)

set_vec3 (idx, value)

set_vec4 (idx, value)

to_args ()

unref ()

Details

class Gsk.ShaderArgsBuilder

An object to build the uniforms data for a GskGLShader.

classmethod new(shader, initial_values)
Parameters:
Returns:

The newly allocated builder, free with [method`Gsk`.ShaderArgsBuilder.unref]

Return type:

Gsk.ShaderArgsBuilder

Allocates a builder that can be used to construct a new uniform data chunk.

ref()
Returns:

the passed in GskShaderArgsBuilder

Return type:

Gsk.ShaderArgsBuilder

Increases the reference count of a GskShaderArgsBuilder by one.

set_bool(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (bool) – value to set the uniform to

Sets the value of the uniform idx.

The uniform must be of bool type.

set_float(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (float) – value to set the uniform to

Sets the value of the uniform idx.

The uniform must be of float type.

set_int(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (int) – value to set the uniform to

Sets the value of the uniform idx.

The uniform must be of int type.

set_uint(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (int) – value to set the uniform to

Sets the value of the uniform idx.

The uniform must be of uint type.

set_vec2(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (Graphene.Vec2) – value to set the uniform too

Sets the value of the uniform idx.

The uniform must be of vec2 type.

set_vec3(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (Graphene.Vec3) – value to set the uniform too

Sets the value of the uniform idx.

The uniform must be of vec3 type.

set_vec4(idx, value)
Parameters:
  • idx (int) – index of the uniform

  • value (Graphene.Vec4) – value to set the uniform too

Sets the value of the uniform idx.

The uniform must be of vec4 type.

to_args()
Returns:

the newly allocated buffer with all the args added to self

Return type:

GLib.Bytes

Creates a new GBytes args from the current state of the given self.

Any uniforms of the shader that have not been explicitly set on the self are zero-initialized.

The given GskShaderArgsBuilder is reset once this function returns; you cannot call this function multiple times on the same self instance.

This function is intended primarily for bindings. C code should use [method`Gsk`.ShaderArgsBuilder.free_to_args].

unref()

Decreases the reference count of a GskShaderArgBuilder by one.

If the resulting reference count is zero, frees the builder.