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 Summary
Modifier and TypeMethodDescriptionintdefault booleanhasFeatures(ShaderFeature... features) Checks if the requested shader features are available.default voidinclude(io.github.ocelot.glslprocessor.api.node.GlslTree tree, String name, io.github.ocelot.glslprocessor.api.node.GlslTree loadedImport, ShaderPreProcessor.IncludeOverloadStrategy strategy) Adds the specified import to this source tree.default voidinclude(io.github.ocelot.glslprocessor.api.node.GlslTree tree, net.minecraft.resources.ResourceLocation name, ShaderPreProcessor.IncludeOverloadStrategy strategy) Loads the specified import from fileassets/modid/pinwheel/shaders/include/path.glsland adds it to this source tree.default booleandefault booleanbooleandefault booleandefault booleandefault booleanisVertex()macros()io.github.ocelot.glslprocessor.api.node.GlslTreemodifyInclude(@Nullable net.minecraft.resources.ResourceLocation name, String source) Runs the specified source through the entire processing list.@Nullable net.minecraft.resources.ResourceLocationname()default ShaderPreDefinitionsinttype()default StringtypeName()
-
Method Details
-
modifyInclude
io.github.ocelot.glslprocessor.api.node.GlslTree modifyInclude(@Nullable @Nullable net.minecraft.resources.ResourceLocation name, String source) throws IOException, io.github.ocelot.glslprocessor.api.GlslSyntaxException, io.github.ocelot.glslprocessor.lib.anarres.cpp.LexerException 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 sourceio.github.ocelot.glslprocessor.api.GlslSyntaxException- If there was an error in the syntax of the source codeio.github.ocelot.glslprocessor.lib.anarres.cpp.LexerException- If an error occurs during shader C preprocessing
-
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
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
-
activeBuffers
int activeBuffers()- Returns:
- The currently active dynamic buffers
-
type
int type()- Returns:
- The OpenGL type of the compiling shader
-
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
-
hasFeatures
Checks if the requested shader features are available.- Parameters:
features- The features to check for- Returns:
- Whether those features are supported
- Since:
- 2.0.0
-
include
default void include(io.github.ocelot.glslprocessor.api.node.GlslTree tree, net.minecraft.resources.ResourceLocation name, ShaderPreProcessor.IncludeOverloadStrategy strategy) throws IOException, io.github.ocelot.glslprocessor.api.GlslSyntaxException, io.github.ocelot.glslprocessor.lib.anarres.cpp.LexerException Loads the specified import from fileassets/modid/pinwheel/shaders/include/path.glsland adds it to this source tree.- Parameters:
tree- The tree to include the file intoname- The name of the import to loadstrategy- How duplicate shader methods should be handled- Throws:
IOException- If there was an error loading the import fileio.github.ocelot.glslprocessor.api.GlslSyntaxExceptionio.github.ocelot.glslprocessor.lib.anarres.cpp.LexerException
-
include
default void include(io.github.ocelot.glslprocessor.api.node.GlslTree tree, String name, io.github.ocelot.glslprocessor.api.node.GlslTree loadedImport, ShaderPreProcessor.IncludeOverloadStrategy strategy) throws IOException, io.github.ocelot.glslprocessor.api.GlslSyntaxException, io.github.ocelot.glslprocessor.lib.anarres.cpp.LexerException Adds the specified import to this source tree.- Parameters:
tree- The tree to include the file intoname- The name of the importloadedImport- The loaded import source codestrategy- How duplicate shader methods should be handled- Throws:
IOException- If there was an error loading the import fileio.github.ocelot.glslprocessor.api.GlslSyntaxExceptionio.github.ocelot.glslprocessor.lib.anarres.cpp.LexerException
-
shaderImporter
ShaderImporter shaderImporter()- Returns:
- The importer instance
- See Also:
-
preDefinitions
- Returns:
- The set of pre-definitions for shaders
-
macros
- Returns:
- All macros used to compile shaders
-