ShaderState

Encapsulates a GPU shader and its associated render state.

Constructor

  • ShaderState(
        fragment_file_path: str,
        uniform_buffer_count: int = 0
    ) ShaderState

Encapsulates a GPU shader and its associated render state.

Methods


Bind

bind() None

Binds this shader state to the current render pass, making it active for subsequent draw calls.

Unbind

unbind() None

Unbinds the current shader state, reverting to the default render state.

Set Uniform

set_uniform(
    binding: int,
    data: Annotated[NDArray, dict(order='C', device='cpu')]
) None

Set uniform data for the fragment shader at the specified binding point.

Args

  • binding : Uniform buffer binding index.
  • data : Buffer or bytes object containing the uniform data to upload.