Cocos2d-x  v4
Program Class Referenceabstract

A program. More...

Inherits Ref.

Inherited by ProgramGL, and ProgramMTL.

Public Member Functions

virtual UniformLocation getUniformLocation (const std::string &uniform) const =0
 Get uniform location by name. More...
 
virtual UniformLocation getUniformLocation (backend::Uniform name) const =0
 Get uniform location by engine built-in uniform enum name. More...
 
virtual int getAttributeLocation (const std::string &name) const =0
 Get attribute location by attribute name. More...
 
virtual int getAttributeLocation (backend::Attribute name) const =0
 Get attribute location by engine built-in attribute enum name. More...
 
virtual int getMaxVertexLocation () const =0
 Get maximum vertex location. More...
 
virtual int getMaxFragmentLocation () const =0
 Get maximum fragment location. More...
 
virtual const std::unordered_map< std::string, AttributeBindInfo > getActiveAttributes () const =0
 Get active vertex attributes. More...
 
const std::string & getVertexShader () const
 Get vertex shader. More...
 
const std::string & getFragmentShader () const
 Get fragment shader. More...
 
ProgramType getProgramType () const
 Get engine built-in program type. More...
 
virtual std::size_t getUniformBufferSize (ShaderStage stage) const =0
 Get uniform buffer size in bytes that can hold all the uniforms. More...
 
virtual const UniformInfo & getActiveUniformInfo (ShaderStage stage, int location) const =0
 Get a uniformInfo in given location from the specific shader stage. More...
 
virtual const std::unordered_map< std::string, UniformInfo > & getAllActiveUniformInfo (ShaderStage stage) const =0
 Get all uniformInfos. More...
 
- 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 ProgramgetBuiltinProgram (ProgramType type)
 Get engine built-in program. 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

A program.

Member Function Documentation

◆ getBuiltinProgram()

static Program* getBuiltinProgram ( ProgramType  type)
static

Get engine built-in program.

Parameters
typeSpecifies the built-in program type.

◆ getUniformLocation() [1/2]

virtual UniformLocation getUniformLocation ( const std::string &  uniform) const
pure virtual

Get uniform location by name.

Parameters
uniformSpecifies the uniform name.
Returns
The uniform location.

Implemented in ProgramGL, and ProgramMTL.

◆ getUniformLocation() [2/2]

virtual UniformLocation getUniformLocation ( backend::Uniform  name) const
pure virtual

Get uniform location by engine built-in uniform enum name.

Parameters
nameSpecifies the engine built-in uniform enum name.
Returns
The uniform location.

Implemented in ProgramGL, and ProgramMTL.

◆ getAttributeLocation() [1/2]

virtual int getAttributeLocation ( const std::string &  name) const
pure virtual

Get attribute location by attribute name.

Parameters
nameSpecifies the attribute name.
Returns
The attribute location.

Implemented in ProgramGL, and ProgramMTL.

◆ getAttributeLocation() [2/2]

virtual int getAttributeLocation ( backend::Attribute  name) const
pure virtual

Get attribute location by engine built-in attribute enum name.

Parameters
nameSpecifies the engine built-in attribute enum name.
Returns
The attribute location.

Implemented in ProgramGL, and ProgramMTL.

◆ getMaxVertexLocation()

virtual int getMaxVertexLocation ( ) const
pure virtual

Get maximum vertex location.

Returns
Maximum vertex locaiton.

Implemented in ProgramGL, and ProgramMTL.

◆ getMaxFragmentLocation()

virtual int getMaxFragmentLocation ( ) const
pure virtual

Get maximum fragment location.

Returns
Maximum fragment location.

Implemented in ProgramGL, and ProgramMTL.

◆ getActiveAttributes()

virtual const std::unordered_map<std::string, AttributeBindInfo> getActiveAttributes ( ) const
pure virtual

Get active vertex attributes.

Returns
Active vertex attributes. key is active attribute name, Value is corresponding attribute info.

Implemented in ProgramGL, and ProgramMTL.

◆ getVertexShader()

const std::string& getVertexShader ( ) const
inline

Get vertex shader.

Returns
Vertex shader.

◆ getFragmentShader()

const std::string& getFragmentShader ( ) const
inline

Get fragment shader.

@ Fragment shader.

◆ getProgramType()

ProgramType getProgramType ( ) const
inline

Get engine built-in program type.

Returns
The built-in program type.

◆ getUniformBufferSize()

virtual std::size_t getUniformBufferSize ( ShaderStage  stage) const
pure virtual

Get uniform buffer size in bytes that can hold all the uniforms.

Parameters
stageSpecifies the shader stage. The symbolic constant can be either VERTEX or FRAGMENT.
Returns
The uniform buffer size in bytes.

Implemented in ProgramGL, and ProgramMTL.

◆ getActiveUniformInfo()

virtual const UniformInfo& getActiveUniformInfo ( ShaderStage  stage,
int  location 
) const
pure virtual

Get a uniformInfo in given location from the specific shader stage.

Parameters
stageSpecifies the shader stage. The symbolic constant can be either VERTEX or FRAGMENT.
locationSpecifies the uniform locaion.
Returns
The uniformInfo.

Implemented in ProgramGL, and ProgramMTL.

◆ getAllActiveUniformInfo()

virtual const std::unordered_map<std::string, UniformInfo>& getAllActiveUniformInfo ( ShaderStage  stage) const
pure virtual

Get all uniformInfos.

Returns
The uniformInfos.

Implemented in ProgramGL, and ProgramMTL.


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