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 TypeMethodDescriptionint
default void
include
(GlslTree tree, String name, GlslTree loadedImport, ShaderPreProcessor.IncludeOverloadStrategy strategy) Adds the specified import to this source tree.default void
include
(GlslTree tree, net.minecraft.resources.ResourceLocation name, ShaderPreProcessor.IncludeOverloadStrategy strategy) Loads the specified import from fileassets/modid/pinwheel/shaders/include/path.glsl
and adds it to this source tree.default boolean
default boolean
boolean
default boolean
default boolean
default boolean
isVertex()
macros()
modifyInclude
(@Nullable net.minecraft.resources.ResourceLocation name, String source) Runs the specified source through the entire processing list.@Nullable net.minecraft.resources.ResourceLocation
name()
default ShaderPreDefinitions
int
type()
default String
typeName()
-
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 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 sourceGlslSyntaxException
- If there was an error in the syntax of the source codeLexerException
- 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
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
- 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 fileassets/modid/pinwheel/shaders/include/path.glsl
and 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 fileGlslSyntaxException
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 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 fileGlslSyntaxException
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
-