On 02/25/2016 01:23 PM, Matteo Bruni wrote:
Ah, I think I see now why this is using a temporary context: there is no guarantee that the current GL context is compatible with the pbuffer. That means a glXMakeCurrent() for the pbuffer and the current context might fail thus a temporary context is probably necessary in the general case after all.
There is no reason to create a new context each time wglBindTexImageARB is called though. You could store the temporary GL context into struct wgl_pbuffer and reuse it for all the following calls with the same pbuffer (as long as the current context stays the same - if it changes the temporary context needs to be recreated so that it's shared with the "new" current context). The temporary context will have to be destroyed when the (WGL) pbuffer is destroyed.
When you're resending please change the patch subject to something like "winex11: Don't create a temporary context each time X11DRV_wglBindTexImageARB is called."
Actually, GL contexts are quite flexible at working with different draw buffers, but you're right, it might be incompatible (however, this is extremely unlikely). I was afraid that going back to using a tmp context would re-introduce the MSAA problem, but it seems that was fixed by my patch to Mesa, and not this one :) I should have tested it better. I'll post the new patch shortly.
MM