Interface ShaderPreProcessor.Context
- Enclosing interface:
- ShaderPreProcessor
public static interface ShaderPreProcessor.Context
Context for modifying source code and shader behavior.
-
Method Summary
Modifier and TypeMethodDescriptionvoidMarks this shader as dependent on the specified pre-definition.voidaddUniformBinding(String name, int binding) Sets the uniform binding for a shader.net.minecraft.resources.FileToIdConverter@Nullable ProgramDefinitiongetInput()@Nullable net.minecraft.resources.ResourceLocationgetName()intgetType()default StringbooleanRuns the specified source through the entire processing list.
-
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 ornullif the source is a raw stringsource- The shader source code to modify- Returns:
- The modified source
- Throws:
IOException- If any error occurs while editing the source
-
addUniformBinding
Sets the uniform binding for a shader.- Parameters:
name- The name of the uniformbinding- The binding to set it to
-
addDefinitionDependency
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
-
getName
@Nullable @Nullable net.minecraft.resources.ResourceLocation getName()- Returns:
- The id of the shader being compiled or
nullif the shader is compiled from a raw string
-
getInput
String getInput()- Returns:
- The input source code. This is GLSL
-
getType
int getType()- Returns:
- The OpenGL type of the shader being compiled
-
getConverter
net.minecraft.resources.FileToIdConverter getConverter()- Returns:
- The file to id converter for the loading shader file type
-
getTypeName
- Returns:
- The readable name of the loading shader file type
-
isSourceFile
boolean isSourceFile()- Returns:
- Whether the processor is being run for a source file and not an include file
-
getDefinition
- Returns:
- The definition of the program this is being compiled for or
nullif the shader is standalone
-
getPreDefinitions
ShaderPreDefinitions getPreDefinitions()- Returns:
- The set of pre-definitions for shaders
-