Class CachedShaderCompiler

java.lang.Object
foundry.veil.impl.client.render.shader.DirectShaderCompiler
foundry.veil.impl.client.render.shader.CachedShaderCompiler
All Implemented Interfaces:
ShaderCompiler, AutoCloseable, org.lwjgl.system.NativeResource

@Internal public class CachedShaderCompiler extends DirectShaderCompiler
Attempts to cache the exact same shader sources to reduce the number of compiled shaders.
  • Constructor Details

  • Method Details

    • compile

      public CompiledShader compile(int type, net.minecraft.resources.ResourceLocation path) throws IOException, ShaderException
      Description copied from interface: ShaderCompiler
      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.
      Specified by:
      compile in interface ShaderCompiler
      Overrides:
      compile in class DirectShaderCompiler
      Parameters:
      type - The type of shader to create
      path - 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 found
      ShaderException - If an error occurs while compiling the shader
    • compile

      public CompiledShader compile(int type, VeilShaderSource source) throws ShaderException
      Description copied from interface: ShaderCompiler
      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.
      Specified by:
      compile in interface ShaderCompiler
      Overrides:
      compile in class DirectShaderCompiler
      Parameters:
      type - The type of shader to create
      source - 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
    • free

      public void free()
      Specified by:
      free in interface org.lwjgl.system.NativeResource
      Overrides:
      free in class DirectShaderCompiler