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.voidaddInclude(net.minecraft.resources.ResourceLocation name) voidaddUniformBinding(String name, int binding) Sets the uniform binding for a shader.@Nullable ProgramDefinitionSet<net.minecraft.resources.ResourceLocation> includes()booleanRuns the specified source through the entire processing list.@Nullable net.minecraft.resources.ResourceLocationname()@Nullable ShaderPreDefinitions
-
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
-
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
nullif 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
- Returns:
- The definition of the program this is being compiled for or
nullif the shader is standalone
-
preDefinitions
- Returns:
- The set of pre-definitions for shaders
-