Class ShaderArgsBuilder

All Implemented Interfaces:
PointerInterface

public class ShaderArgsBuilder extends Record
An object to build the uniforms data for a `GskGLShader`.

https://docs.gtk.org/gsk4/struct.ShaderArgsBuilder.html

  • Constructor Details

    • ShaderArgsBuilder

      public ShaderArgsBuilder(PointerContainer pointer)
    • ShaderArgsBuilder

      public ShaderArgsBuilder(@Nonnull GLShader shader, @Nullable Bytes initial_values)
      Allocates a builder that can be used to construct a new uniform data
      chunk.
      Parameters:
      shader - a `GskGLShader`
      initial_values - optional `GBytes` with initial values
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • freeToArgs

      public Bytes freeToArgs()
      Creates a new `GBytes` args from the current state of the
      given @builder, and frees the @builder instance.

      Any uniforms of the shader that have not been explicitly set
      on the @builder are zero-initialized.
      Returns:
      the newly allocated buffer with all the args added to @builder
    • ref

      public ShaderArgsBuilder ref()
      Increases the reference count of a `GskShaderArgsBuilder` by one.
      Returns:
      the passed in `GskShaderArgsBuilder`
    • setBool

      public void setBool(int idx, boolean value)
      Sets the value of the uniform @idx.

      The uniform must be of bool type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform to
    • setFloat

      public void setFloat(int idx, float value)
      Sets the value of the uniform @idx.

      The uniform must be of float type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform to
    • setInt

      public void setInt(int idx, int value)
      Sets the value of the uniform @idx.

      The uniform must be of int type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform to
    • setUint

      public void setUint(int idx, int value)
      Sets the value of the uniform @idx.

      The uniform must be of uint type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform to
    • setVec2

      public void setVec2(int idx, @Nonnull Vec2 value)
      Sets the value of the uniform @idx.

      The uniform must be of vec2 type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform too
    • setVec3

      public void setVec3(int idx, @Nonnull Vec3 value)
      Sets the value of the uniform @idx.

      The uniform must be of vec3 type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform too
    • setVec4

      public void setVec4(int idx, @Nonnull Vec4 value)
      Sets the value of the uniform @idx.

      The uniform must be of vec4 type.
      Parameters:
      idx - index of the uniform
      value - value to set the uniform too
    • toArgs

      public Bytes toArgs()
      Creates a new `GBytes` args from the current state of the
      given @builder.

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

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

      This function is intended primarily for bindings. C code should use
      [method@Gsk.ShaderArgsBuilder.free_to_args].
      Returns:
      the newly allocated buffer with all the args added to @builder
    • unref

      public void unref()
      Decreases the reference count of a `GskShaderArgBuilder` by one.

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

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()