Hi.
I have noticed that if one of my shaders can’t be compiled my application just crashes without any detailed messages. My investigation showed that the crash takes place in CCGLProgram::logForOpenGLObject during the invocation of infoFunc. Further investigation discovered that on the Windows platform (which I use for development and testing) glGetShaderiv uses __stdcall call convention, while GLInfoFunction uses default __cdecl. Moreover, it seems that with Windows’ version of glew there is no need to get the pointer to those GL-functions, thus instead of
There is no need to have a special shader. Just make some stupid syntax errors in any built-in shader, thus it fails to compile. If cocos2d-x shows an error report in the console and terminates the app correctly, then everything goes fine on the platfrom you’re testing.
I attached the patch to this message, but it contains the ‘fix’ only for Windows platfrom. But I expect it should be enough and other platforms do not require any changes.
OMG!
Is it so hard to fix this issue? If you did not notice, it’s still present and it migrated to v3.0. The app still crashes / throws an exception if it can’t load the shader. And in fact, the code that causes this issue is for debugging. That’s ridiculous.
You have the patch with the fix. It requires to change only a couple of lines of code to implement it in v3.0.
@dotsquid this is fixed in Cocos2d-x 3.6. If someone uses older cocos2d-x and on shader compile cocos crashes (when the shader has a syntax error) here is the fix. In CCGLProgram.cpp change the function from: