Cocos2d-x  v4
ShaderCache Class Reference

Create and reuse shader module. More...

Inherits Ref.

Public Member Functions

void removeUnusedShader ()
 Remove all unused shaders.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Static Public Member Functions

static ShaderCachegetInstance ()
 returns the shared instance
 
static void destroyInstance ()
 purges the cache. More...
 
static backend::ShaderModulenewVertexShaderModule (const std::string &shaderSource)
 Create a vertex shader module and add it to cache. More...
 
static backend::ShaderModulenewFragmentShaderModule (const std::string &shaderSource)
 Create a fragment shader module. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

Create and reuse shader module.

Member Function Documentation

◆ destroyInstance()

static void destroyInstance ( )
static

purges the cache.

It releases the retained instance.

◆ newVertexShaderModule()

static backend::ShaderModule* newVertexShaderModule ( const std::string &  shaderSource)
static

Create a vertex shader module and add it to cache.

If it is created before, then just return the cached shader module.

Parameters
shaderSourceThe source code of the shader.

◆ newFragmentShaderModule()

static backend::ShaderModule* newFragmentShaderModule ( const std::string &  shaderSource)
static

Create a fragment shader module.

If it is created before, then just return the cached shader module.

Parameters
shaderSourceThe source code of the shader.

The documentation for this class was generated from the following file: