Interface ShaderPreProcessor.Context
- Enclosing interface:
ShaderPreProcessor
public static interface ShaderPreProcessor.Context
Context for modifying source code and shader behavior.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Marks this shader as dependent on the specified pre-definition.void
addInclude
(net.minecraft.resources.ResourceLocation name) void
addUniformBinding
(String name, int binding) Sets the uniform binding for a shader.@Nullable ProgramDefinition
Set
<net.minecraft.resources.ResourceLocation> includes()
boolean
Runs the specified source through the entire processing list.@Nullable net.minecraft.resources.ResourceLocation
name()
@Nullable ShaderPreDefinitions
@Nullable String
int
type()
@Nullable com.mojang.blaze3d.vertex.VertexFormat
-
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 ornull
if 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
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
- Returns:
- The definition of the program this is being compiled for or
null
if the shader is standalone
-
shaderInstance
- Returns:
- The name of the shader instance this was compiled with or
null
if not a vanilla shader
-
preDefinitions
- Returns:
- The set of pre-definitions for shaders
-
vertexFormat
@Nullable @Nullable com.mojang.blaze3d.vertex.VertexFormat vertexFormat()- Returns:
- The vertex format specified in the shader or
null
if a vanilla shader
-
type
int type()- Returns:
- The OpenGL type of the compiling shader
-