Well, we discussed a few different ways of handling this, and here are the results:
1) We can flip the texture we get from the framebuffer in Device_LoadTexture. Getting images from the back framebuffer always are upside down, so we'll need to manually flip it before setting it as the next render target.
a) Use glCopyTexSubImage2D() to swap each row
b) Use glReadPixels() to copy to a buffer, flip the image, then use glTexImage2D() to write it back.
Both of these methods fixed the upside down rendering, but the issue of the disconnected/broken models is still there, although less prevalent now that things look more normal to begin with. I've attached both patches. However, performance takes a pretty serious hit:
Max Payne 2 with pixel shaders enabled in High detail mode (there are still some lighting bugs, though): Current git (upside-down): ~65 fps 1a: ~35 fps 1b: ~15 fps
Civ4 with pixel shaders enabled Current git (some upside-down stuff and very broken models): 30-50 fps 1a (still some broken models): ~35 fps 1b (still some broken modles): 25-35 fps
2) Try to do some kind of fixup in the shader itself. I'm not entirely sure how to do this other than being creative with the small hack I posted originally. There are no noticable performance losses, but visually, some things are broken (the sky in Tomb Raider Legends as well as Half Life 2 are completely wrong, but Max Payne is about 99% right).
Any other suggestions? Also, the models are still broke, so that may be a separate topic and not related like I thought it was.