Dear people from the forum, I am trying to develop a game prototype which uses OpenGL and I am designing the entire graphic engine. My game requires some tricks with the shaders, and therefore I had to write a very complex geometry shader with lots of ifs and for loops, it increases the complexity of the geometrical models.
I program on a linux OS and I was using an AMD graphic card with the MESA drivers (which have a very limited OpenGL support) but I managed it to work by forcing the driver to use newer versions of the api (by putting this before the command: MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330) and the program worked fine. But even then, I had been struggling with the glsl shaders compilation. Sometimes there was nothing wrong with the code, but the compilation would raise an error and it would be fixed by adding a blank line somewhere in the source, by deleting one irrelevant line, multiplying some float by 1., or any ridiculous patch. Doing this would solve it. However, at least I know there is something wrong because the compiler tells me. But sometimes there could be an undefined behavior because some variable is not initialized or something like that, and there is no way of finding out what the problem is, especially if the shader is very complex like mine.
Right now I am using an nVidia graphic card with the proprietary drivers, therefore I don't need to force the driver to support a 'new' version of OpenGL, but the shader does not work. It compiles but it doesn't work, I suspect there could be an undefined behavior but I cannot find it. The code is really complex and I cannot upload it here.
I am wondering why the ridiculous errors mentioned above occur (sometimes they appear when there is a REAL error, which is not detected), and if there is a way to get the warnings or undefined behaviors when the shaders are compiled successfully because the compilations logs are blank. I would not like to rewrite my shader entirely when it works perfectly with other graphic cards. Thank you in advance!