Sunday, July 28, 2013
Summary
Ok, that was seriously some of the most intense debugging sessions that I've done in a long time. An hour is bad enough. But that GL problem took almost 5 hours to solve
For better or worse, the problem ended up being an exceptionally sneaky one, so at least I don't feel stupid. It was legitimately a difficult issue, and what's worse is that different drivers were behaving differently, so the issue only occurred on certain configurations. Oh wow, who would haved guessed...drivers implementing the spec differently!! I'm certain we've never heard of that before...
So if you're interested (if not, skip this paragraph), here was the deal: generated textures were being clipped to a certain region when generated at particular times. For example, a 2048 x 2048 plating texture only having plating in a 1620 x 1080 region, the rest being blank (resulting in one heck of an ugly ship). Immediately we deduce that the problem is related to the framebuffer in some way, because 1620 x 1080 is not a coincidence - it's the framebuffer resolution. But what could cause it to clip? 1) depth test? 2) scissor test? 3) stencil test? 4) incorrect viewport? These are all of the things that I immediately think to check when something is failing to render in a framebuffer. But....1) was off, 2) was off, 3) was off, and 4) was absolutely 100% correct Five hours later, I now know that there's one more thing that can cause clipping when rendering to a framebuffer, and I didn't realize it before: framebuffer attachments having different resolutions. Ok, I knew that you weren't allowed to attach render targets of different resolutions to the same framebuffer. That's invalid, and should cause everything to fail. Well, guess what? Apparently it's not a problem on most drivers, because everything was working fine on my other setups, even though this issue was indeed occurring. But as if that's not good enough, it appears that another way for the driver to handle the problem is simply to clip to the smallest target. Ugh...really?? Drivers allowing things that shouldn't be allowed....STRIKES AGAIN!
At this point, I feel like my entire career will be dedicated to learning the nuances of OpenGL framebuffers. They're like Ruffles Cheddar and Sour Cream chips. Every time you think you're done with them, they manage to sneak back into your life. (Nope, I was not paid for that advertisement, I legitimately have an addiction to them. Considering getting help.)
In other news, working on planet surfaces Secret stuff. Maybe ready in time for the update, maybe not
[ You can visit devtime.ltheory.com for more detailed information on today's work. ]
Post
Sun Jul 28, 2013 11:54 pm
#1
Week of July 28, 2013
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford