[Solved] Engine not running properly on AMD/Intel drivers

Started by pieisnotpi, November 02, 2016, 20:17:47

Previous topic - Next topic

pieisnotpi

Hi, I've been developing a game engine as a hobby for the past several months, and I've noticed that somewhere along the line, it stopped running on AMD/Intel hardware. My question is, what exactly could cause discrepancies like this to occur? The engine is mesh-based and uses modern OpenGL, and the (moderately outdated) source code is available here, but it's a giant mess, so let me know if you need specific snippets of code and I'll fetch them. It's worth noting that I have the OpenGL debug callback enabled, and it doesn't throw any errors. Additionally, all of the shaders are compiling properly and without error. For comparison, I've attached some screenshots of what it looks like vs. what it should look like. The 'what it looks like' screenshots were taken on Intel hardware, and the 'what it should look like' were taken on Nvidia hardware, though both were taken on the same device.

SOLUTION:
I've found the solution. I had hardcoded the locations of the vertex attributes, which was causing incompatibility issues because apparently AMD/Intel drivers don't order the attribute locations the same way as Nvidia drivers do. I had originally hardcoded these locations as a workaround for a previous flaw that was solved awhile ago, which meant I didn't actually need to hardcode them anymore. So now, the attribute locations are grabbed from the shader program, which fixed all compatibility errors.

CoDi

In my experience, such issues usually boil down to:

- Undefined GL states. Sometimes the nVidia drivers seem to be more "relaxed" in using sensible default parameters if you forget to change/set/reset some state.
- I've seen some very weird behaviour with vertex shaders, e.g. one on a Surface Pro 4 w/ Intel GPU which I "fixed" by swapping a few lines of shader code. To this day I still don't know how I managed to trigger this problem, since the code in question is very simple, and I've seen similar code in other projects.

Hunting down such bugs can get pretty difficult if you don't notice them early.

pieisnotpi

What really bothers me, though, is that the ADS shader (used for the floor in broken/fixed 1) works properly across both Intel and Nvidia, but, internally, it's handled identically to the other shaders.