|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.util.ResourceCache
com.threerings.opengl.util.ShaderCache
public class ShaderCache
Caches loaded shaders and shader programs.
| Nested Class Summary | |
|---|---|
protected static class |
ShaderCache.ProgramKey
Identifies a linked shader program. |
protected static class |
ShaderCache.ShaderKey
Identifies a loaded shader. |
| Nested classes/interfaces inherited from class com.threerings.opengl.util.ResourceCache |
|---|
ResourceCache.CachedResource<T>, ResourceCache.Subcache<K,V> |
| Field Summary | |
|---|---|
protected SoftCache<ShaderCache.ProgramKey,Program> |
_programs
The set of linked shader programs. |
protected ResourceCache.Subcache<ShaderCache.ShaderKey,Shader> |
_shaders
The shader cache. |
protected ResourceCache.Subcache<String,String> |
_source
The source file cache. |
protected static HashMap<String,Integer> |
_types
Maps file extensions to shader types. |
protected static boolean |
CHECK_LOGS
Whether or not we should check the logs even if the shader compiles/links successfully. |
| Fields inherited from class com.threerings.opengl.util.ResourceCache |
|---|
_checkTimestamps, _ctx |
| Constructor Summary | |
|---|---|
ShaderCache(GlContext ctx,
boolean checkTimestamps)
Creates a new shader cache. |
|
| Method Summary | |
|---|---|
Program |
getProgram(Shader vertex,
Shader fragment)
Returns an instance of a program with the supplied vertex and fragment shaders. |
Shader |
getShader(String path,
String... defs)
Loads and returns the shader at the specified path with the supplied preprocessor definitions. |
Shader |
getShader(String path,
String[] defs,
String[] ddefs)
Loads and returns the shader at the specified path with the supplied preprocessor definitions as well as a set of derived definitions (not used to find the shader, but included if the shader is compiled). |
String |
getSource(String path)
Retrieves the shader source at the specified path. |
protected static void |
maybeCheckLog(ShaderObject object,
Object... args)
If so configured, checks the specified log for the dreaded "software" keyword. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ResourceCache.Subcache<ShaderCache.ShaderKey,Shader> _shaders
protected ResourceCache.Subcache<String,String> _source
protected SoftCache<ShaderCache.ProgramKey,Program> _programs
protected static final HashMap<String,Integer> _types
protected static final boolean CHECK_LOGS
| Constructor Detail |
|---|
public ShaderCache(GlContext ctx,
boolean checkTimestamps)
checkTimestamps - if true, check the last-modified timestamp of each resource file
when we retrieve it from the cache, reloading the resource if the file has been modified
externally.| Method Detail |
|---|
public Shader getShader(String path,
String... defs)
public Shader getShader(String path,
String[] defs,
String[] ddefs)
public String getSource(String path)
public Program getProgram(Shader vertex,
Shader fragment)
protected static void maybeCheckLog(ShaderObject object,
Object... args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||