Created attachment 131764 [details] [review]
Patch: Allow context creation without prior SetPixelFormat()
Currently, when creating a context without having called SetPixelFormat() on the DC earlier, context creation fails.
However, looking at stw_make_current(), the intention there is to support that scenario; there, if the pixel format wasn't set, that function falls back to a default.
So it looks like context creation should work as well.
Attached patch does that by using pretty much the same logic as stw_make_current().
I may not have time to look at this for a few days. But one question: did you find this because a particular app is working differently with Mesa than NVIDIA/AMD/Intel? I guess I'd like to hear more background info about this.
I'm trying to coerce a Chromium-based browser component to render WebGL using an llvmpipe Mesa.
At one point during initialization, it creates a short-lived context just to obtain some function addresses. It wants to create a context on the display DC, which apparently has no pixel format set - or at least a 'framebuffer' can't be determined.
If that early context creation fails desktop GL, if requested, won't be used and features requiring it disabled.
FWIW, Chrome makes use of NVIDIA's desktop GL when forced to do so, presumably that particular context creation succeeds there.
Thanks for the info. The patch looks good. I'll push it soon with minor reformatting.
Patch 0ef39e588f92236f9e2fb1909a314c7eb70db8c2 pushed. Thanks, Frank.