Class ProgramCompiler<P extends GlProgram>
java.lang.Object
com.jozufozu.flywheel.core.compile.Memoizer<ProgramContext,P>
com.jozufozu.flywheel.core.compile.ProgramCompiler<P>
A caching compiler.
This class is responsible for compiling programs on the fly. An instance of this class will keep a cache of compiled programs, and will only compile a program if it is not already in the cache.
-
Constructor Summary
ConstructorsConstructorDescriptionProgramCompiler(GlProgram.Factory<P> factory, VertexCompiler vertexCompiler, FragmentCompiler fragmentCompiler) -
Method Summary
Modifier and TypeMethodDescriptionprotected P_create(ProgramContext ctx) protected voidstatic <T extends VertexData,P extends GlProgram>
ProgramCompiler<P>create(Template<T> template, GlProgram.Factory<P> factory, FileResolution header) Creates a program compiler using this template.getProgram(ProgramContext ctx) Get or compile a spec to the given vertex type, accounting for all game state conditions specified by the spec.voidstatic void
-
Constructor Details
-
ProgramCompiler
public ProgramCompiler(GlProgram.Factory<P> factory, VertexCompiler vertexCompiler, FragmentCompiler fragmentCompiler)
-
-
Method Details
-
create
public static <T extends VertexData,P extends GlProgram> ProgramCompiler<P> create(Template<T> template, GlProgram.Factory<P> factory, FileResolution header) Creates a program compiler using this template.- Type Parameters:
P- The type of program to compile.- Parameters:
template- The vertex template to use.factory- A factory to add meaning to compiled programs.header- The header file to use for the program.- Returns:
- A program compiler.
-
getProgram
Get or compile a spec to the given vertex type, accounting for all game state conditions specified by the spec.- Parameters:
ctx- The context of compilation.- Returns:
- A compiled GlProgram.
-
invalidate
public void invalidate()- Overrides:
invalidatein classMemoizer<ProgramContext,P extends GlProgram>
-
_create
- Specified by:
_createin classMemoizer<ProgramContext,P extends GlProgram>
-
_destroy
- Specified by:
_destroyin classMemoizer<ProgramContext,P extends GlProgram>
-
invalidateAll
-