I found that with a recent version of the gles20 branch, the ShaderTest only succeeded in displaying the first shader. Clicking an arrow would lead to blackness. I compiled with VS2011 Developer Preview (after tweaking the solution to work with the latest updates) and am running with AMD’s latest driver for Win8 Consumer Preview.
I investigated it a bit and it seems that at time of deletion, s_uCurrentShaderProgram may report a shader which isn’t actually working. Calling glUseProgram() with that same shader program can get it working. So, I was able to work around the problem with two changes (not a long-term fix, but it’s a workaround and may contain useful information):
- Removing the “if( program != s_uCurrentShaderProgram )” condition in ccGLUseProgram, since the value can’t be fully trusted at the moment
- In CCGLProgram::~CCGLProgram(), I retrieve the current program name (a GLint) before calling ccGLDeleteProgram(). If it’s not the same one I’m deleting, I call ccGLUseProgram() to restore it after the deletion. To support this, I added a ccGLGetCurrentProgram() function to ccGLStateCache.
I did notice that the order of how this is done is related to the CCDirector and scenes, and to the ShaderTest code itself, but I didn’t see anything necessarily wrong with the code for either of those.
Since it’s still a work in progress, I’m aware that this may just be known stuff and that it’s a work in progress… but I figured I’d share since I have it functional enough to work with and perhaps someone else just wants this as well.