Class ShaderLoader

java.lang.Object
lol.trq.helios.shader.ShaderLoader

public final class ShaderLoader extends Object
Compiles and links programs from preprocessed sources, and reloads them.

Compile and link failures throw a ShaderException whose message carries the driver log with file:line locations. reloadAll() rebuilds every program from its sources; a program that fails to rebuild keeps its last good version.

  • Constructor Details

    • ShaderLoader

      public ShaderLoader(GlBackend gl, SourceResolver resolver)
      Creates a loader.
      Parameters:
      gl - the backend
      resolver - loads source files
  • Method Details

    • load

      public ShaderProgram load(String vertex, String fragment, Map<String,String> defines)
      Loads a program.
      Parameters:
      vertex - the vertex shader entry file
      fragment - the fragment shader entry file
      defines - defines injected into both stages
      Returns:
      the linked program
      Throws:
      ShaderException - on a preprocess, compile or link failure
    • reloadAll

      public List<String> reloadAll()
      Rebuilds every program this loader made and still owns.
      Returns:
      the failures, one message per program that kept its old version