Class ShaderCache
java.lang.Object
gaiasky.util.gdx.shader.ShaderCache
Implements shader caching to disk.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteBufferByte buffer to get binary shaders.protected IntBufferInt for shader binary format.protected IntBufferAux integer buffer.protected IntBufferInt for shader length.protected StringOutput log.protected intprotected IntBufferInt buffer for types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()int[]compileShaders(String name, String computeShader) Loads and compiles the compute shader, creates a new program and links it.int[]compileShaders(String name, String vertexShader, String fragmentShader) Loads and compiles the shaders, creates a new program and links the shaders.int[]compileShaders(String name, String vertexShader, String geometryShader, String fragmentShader) Loads and compiles the shaders, creates a new program and links the shaders.int[]compileShaders(String name, String vertexShader, String tessControlShader, String tessEvalShader, String fragmentShader) Loads and compiles the shaders, creates a new program and links the shaders.protected intgetLog()intstatic ShaderCacheinstance()
-
Field Details
-
type
Int buffer for types. -
len
Int for shader length. -
format
Int for shader binary format. -
intBuffer
Aux integer buffer. -
byteBuffer
Byte buffer to get binary shaders. -
program
protected int program -
log
Output log.
-
-
Constructor Details
-
ShaderCache
public ShaderCache()
-
-
Method Details
-
instance
-
getLog
-
getProgram
public int getProgram() -
clear
public void clear() -
compileShaders
public int[] compileShaders(String name, String vertexShader, String tessControlShader, String tessEvalShader, String fragmentShader) Loads and compiles the shaders, creates a new program and links the shaders.- Parameters:
name- The name of the shader.vertexShader- The vertex shader code.tessControlShader- The tessellation control shader code.tessEvalShader- The tessellation evaluation shader code.fragmentShader- The fragment shader code.- Returns:
- Integer array with the program handle, and the handle of every shader stage.
-
compileShaders
public int[] compileShaders(String name, String vertexShader, String geometryShader, String fragmentShader) Loads and compiles the shaders, creates a new program and links the shaders.- Parameters:
name- The name of the shader.vertexShader- The vertex shader code.geometryShader- The geometry shader code.fragmentShader- The fragment shader code.- Returns:
- Integer array with the program handle, and the handle of every shader stage.
-
compileShaders
Loads and compiles the shaders, creates a new program and links the shaders.- Parameters:
name- The name of the shader.vertexShader- The vertex shader code.fragmentShader- The fragment shader code.- Returns:
- Integer array with the compile status, the program handle, and the handle of every shader stage.
-
compileShaders
Loads and compiles the compute shader, creates a new program and links it.- Parameters:
name- The name of the shader.computeShader- The compute shader code.- Returns:
- Integer array with the program handle, and the handle of every shader stage.
-
createProgram
protected int createProgram()
-