This combines the Mesa fix (16e929e6ff by @brita_) with the Mac fix (89e23c743e by @merwin). And uses the same fix for another call to glFramebufferTexture introduced in f1fb605ec9.
16e929e6ff
89e23c743e
f1fb605ec9