-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Labels
Description
In luaTest/OpenGLTest.lua,the sample function createShaderRetroEffect
use GLProgram as
local program = cc.GLProgram:create("Shaders/example_ColorBars.vsh", "Shaders/example_ColorBars.fsh")
program:bindAttribLocation(cc.ATTRIBUTE_NAME_POSITION, cc.VERTEX_ATTRIB_POSITION)
program:bindAttribLocation(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORD)
label:setGLProgram( program )
Use GLProgram like this can result in memory leak because Node hold the GLState and GLState hold GLProgram, while GLState will create in GLProgramStateCache and never be release automatically.
We must use removeUnusedGLProgramState by ourself.
What's more, lua do not bind GLProgramStateCache::removeUnusedGLProgramState().