Interface ShaderPreProcessor.Context

All Known Subinterfaces:
ShaderPreProcessor.MinecraftContext, ShaderPreProcessor.SodiumContext, ShaderPreProcessor.VeilContext
Enclosing interface:
ShaderPreProcessor

public static sealed interface ShaderPreProcessor.Context permits ShaderPreProcessor.MinecraftContext, ShaderPreProcessor.VeilContext, ShaderPreProcessor.SodiumContext
Context for modifying source code and shader behavior.
  • Method Details

    • modifyInclude

      GlslTree modifyInclude(@Nullable @Nullable net.minecraft.resources.ResourceLocation name, String source) throws IOException, GlslSyntaxException, LexerException
      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
      GlslSyntaxException - If there was an error in the syntax of the source code
      LexerException - If an error occurs during shader C preprocessing
    • customProgramData

      Map<String,Object> customProgramData()
      Returns:
      A custom map of data shared for a shader program
    • 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
    • activeBuffers

      int activeBuffers()
      Returns:
      The currently active dynamic buffers
    • type

      int type()
      Returns:
      The OpenGL type of the compiling shader
    • typeName

      default String typeName()
      Returns:
      The name of this shader type
    • isVertex

      default boolean isVertex()
      Returns:
      Whether the current shader file is the vertex program
    • isFragment

      default boolean isFragment()
      Returns:
      Whether the current shader file is the fragment program
    • isGeometry

      default boolean isGeometry()
      Returns:
      Whether the current shader file is the geometry program
    • isTessellationControl

      default boolean isTessellationControl()
      Returns:
      Whether the current shader file is the tessellation control program
    • isTessellationEvaluation

      default boolean isTessellationEvaluation()
      Returns:
      Whether the current shader file is the tessellation evaluation program
    • include

      default void include(GlslTree tree, net.minecraft.resources.ResourceLocation name, ShaderPreProcessor.IncludeOverloadStrategy strategy) throws IOException, GlslSyntaxException, LexerException
      Loads the specified import from file assets/modid/pinwheel/shaders/include/path.glsl and adds it to this source tree.
      Parameters:
      tree - The tree to include the file into
      name - The name of the import to load
      strategy - How duplicate shader methods should be handled
      Throws:
      IOException - If there was an error loading the import file
      GlslSyntaxException
      LexerException
    • include

      default void include(GlslTree tree, String name, GlslTree loadedImport, ShaderPreProcessor.IncludeOverloadStrategy strategy) throws IOException, GlslSyntaxException, LexerException
      Adds the specified import to this source tree.
      Parameters:
      tree - The tree to include the file into
      name - The name of the import
      loadedImport - The loaded import source code
      strategy - How duplicate shader methods should be handled
      Throws:
      IOException - If there was an error loading the import file
      GlslSyntaxException
      LexerException
    • shaderImporter

      ShaderImporter shaderImporter()
      Returns:
      The importer instance
      See Also:
    • preDefinitions

      default ShaderPreDefinitions preDefinitions()
      Returns:
      The set of pre-definitions for shaders
    • macros

      Map<String,String> macros()
      Returns:
      All macros used to compile shaders