It turns out that the most capricious, buggy, unpredictable, and mysterious part of my program is the vertex shader. This is frustrating because it’s the thing I know the least about, the thing with the least documentation, and the thing that’s hardest to debug. Of course, these are also the reasons the problem exists in the first place.
The vertex shader malfunctions on about half of the testing machines, and it malfunctions in a different way in each place. There’s no pattern to these behaviors as far as I can tell. It works fine on one Linux machine, and malfunctions on another. Fine on one XP machine, not on the other. Works great on my Windows 7 machine, but goes crazy on another. Maybe I could nail something down if I started collecting data on driver versions and graphics card manufacturers, but that’s probably not a good way to spend my time. I mean, if I discover the problem is with laptops using ATI cards, that doesn’t help me solve the problem. I’m not John Carmack and I don’t have encyclopedic knowledge of all the various drivers and their quirks and exceptions. For me, knowing where the problem happens doesn’t put me any closer to the solution.
I need the game to run properly on all these machines, and the stuff I’m doing is so stone-age simple that there’s no reason for this chaos. It should just work. Barring that, I would hope the system could at least have the decency to fail predictably.
I’m sure all of these problems are either from bugs in my shader code or from holes in the documentation. But I can’t find the problem if I don’t understand it.
I’ve described how shaders work before. You might remember this diagram:
Continue reading 〉〉 “Project Good Robot 26: Shader Shenanigans”
Shamus Young is a programmer, an author, and nearly a composer. He works on this site full time. If you'd like to support him, you can do so via Patreon or PayPal.