Interface ShaderPreProcessor.Context

Enclosing interface:
ShaderPreProcessor

public static interface ShaderPreProcessor.Context
Context for modifying source code and shader behavior.
  • Method Details

    • modify

      String modify(@Nullable @Nullable net.minecraft.resources.ResourceLocation name, String source) throws IOException
      Runs the specified source through the entire processing list.
      Parameters:
      name - The name of the shader file to modify or null if the source is a raw string
      source - The shader source code to modify
      Returns:
      The modified source
      Throws:
      IOException - If any error occurs while editing the source
    • addUniformBinding

      void addUniformBinding(String name, int binding)
      Sets the uniform binding for a shader.
      Parameters:
      name - The name of the uniform
      binding - The binding to set it to
    • addDefinitionDependency

      void addDefinitionDependency(String name)
      Marks this shader as dependent on the specified pre-definition. When definitions change, only shaders marked as dependent on that definition will be recompiled.
      Parameters:
      name - The name of the definition to depend on
    • addInclude

      void addInclude(net.minecraft.resources.ResourceLocation name)
      Parameters:
      name - The name of the definition to depend on
    • includes

      Set<net.minecraft.resources.ResourceLocation> includes()
      Returns:
      A view of all includes in this shader
    • name

      @Nullable @Nullable net.minecraft.resources.ResourceLocation name()
      Returns:
      The id of the shader being compiled or null if the shader is compiled from a raw string
    • isSourceFile

      boolean isSourceFile()
      Returns:
      Whether the processor is being run for a source file and not a #include file
    • definition

      @Nullable @Nullable ProgramDefinition definition()
      Returns:
      The definition of the program this is being compiled for or null if the shader is standalone
    • preDefinitions

      @Nullable @Nullable ShaderPreDefinitions preDefinitions()
      Returns:
      The set of pre-definitions for shaders