Interface ShaderCompiler
- All Superinterfaces:
AutoCloseable,org.lwjgl.system.NativeResource
- All Known Implementing Classes:
CachedShaderCompiler,DirectShaderCompiler
public interface ShaderCompiler
extends org.lwjgl.system.NativeResource
Creates and compiles shaders for shader programs.
Create a compiler using direct(ShaderProvider) for a single program,
or cached(ShaderProvider) if compiling multiple.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides shader sources for the compiler. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShaderCompilercached(@Nullable ShaderCompiler.ShaderProvider provider) Constructs a shader compiler that caches duplicate shader sources.compile(int type, VeilShaderSource source) Creates a new shader and attempts to attach the specified sources to it.compile(int type, net.minecraft.resources.ResourceLocation path) Creates a new shader and attempts to attach sources read from file to it.static ShaderCompilerdirect(@Nullable ShaderCompiler.ShaderProvider provider) Constructs a shader compiler that creates a new shader for each requested type.Methods inherited from interface org.lwjgl.system.NativeResource
close, free
-
Method Details
-
compile
CompiledShader compile(int type, net.minecraft.resources.ResourceLocation path) throws IOException, ShaderException Creates a new shader and attempts to attach sources read from file to it. The sources are read from The shader will automatically be deleted at some point in the future.- Parameters:
type- The type of shader to createpath- The location of the shader to attach- Returns:
- A new shader that can be attached to programs
- Throws:
IOException- If the file could not be foundShaderException- If an error occurs while compiling the shader
-
compile
Creates a new shader and attempts to attach the specified sources to it. The shader will automatically be deleted at some point in the future.- Parameters:
type- The type of shader to createsource- The source of the shader to attach- Returns:
- A new shader that can be attached to programs
- Throws:
ShaderException- If an error occurs while compiling the shader
-
direct
Constructs a shader compiler that creates a new shader for each requested type.- Parameters:
provider- The source of shader files- Returns:
- shader compiler
-
cached
Constructs a shader compiler that caches duplicate shader sources.- Parameters:
provider- The source of shader files- Returns:
- cached shader compiler
-