Package gaiasky.util.gdx.shader
Class ShaderCache
java.lang.Object
gaiasky.util.gdx.shader.ShaderCache
Implements shader caching to disk.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected ByteBuffer
Byte buffer to get binary shaders.protected IntBuffer
Int for shader binary format.protected IntBuffer
Aux integer buffer.protected IntBuffer
Int for shader length.protected String
Output log.protected int
protected IntBuffer
Int buffer for types. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
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 int
getLog()
int
static ShaderCache
instance()
boolean
-
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
-
isCompiled
public boolean isCompiled() -
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 program handle, and the handle of every shader stage.
-
createProgram
protected int createProgram()
-