openglglslnvidiaamd-gpu

Fixing GLSL shaders for Nvidia and AMD


I am having problems getting my GLSL shaders to work on both AMD and Nvidia hardware.

I am not looking for help fixing a particular shader, but how to generally avoid getting these problems. Is it possible to check if a shader will compile on AMD/Nvidia drivers without running the application on a machine with the respective hardware and actually trying it?

I know, in the end, testing is the only way to be sure, but during development I would like to at least avoid the obvious problems.

Everyone using GLSL must have these problems, so why can't I find a good way to fix them?


Solution

  • Is it possible to check if a shader will compile on AMD/Nvidia drivers without running the application on a machine with the respective hardware and actually trying it?

    No. If you are going to be serious about developing applications, testing on a variety of hardware is the only reliable way to go about it.

    Generally speaking, the easiest way to handle this for a small team is to avoid the problem altogether. Most driver incompatibilities come from attempting to do something unorthodox: passing arrays as output/input varying variables, passing matrices as attributes, using more recent driver features, etc. So... don't do that. Use only solid, safe stuff that's been around in GLSL and has been almost certainly used in real-world OpenGL applications.