gles20 branch ShaderTest problem on win32, and observations

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):

  1. Removing the “if( program != s_uCurrentShaderProgram )” condition in ccGLUseProgram, since the value can’t be fully trusted at the moment
  2. 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.

We will check it.

Thank you.

Did you use it to develop games now?

Hi, we have tested gles20 branch only in VS2008, so we cannot make sure that it will work fine on WIN8. :slight_smile:

Minggo Zhang wrote:

Did you use it to develop games now?

I haven’t used it for development yet, and it’s my first time using any type of cocos2d… so I’m not in a very good position to judge its suitability for development yet. I decided to try starting with this branch because I’m interested in the shader support and would rather become familiar with the future API. My impression is good so far, because the tests are generally working and VS is well enough supported that it didn’t take much time to get it building.