wflinfo: window/context creation, glGetStringi init order
Select the order of
A: getting the address of glGetStringi, and B: creating a context, creating a window, making the context current
at runtime based on the OS:
Windows requires order=BA; see commit 6ae99a47, WGL requires that an active context [be] available [when] wglGetProcAddress is called;
Linux/Unix and other OSes require order=AB, otherwise there is a path that attempts to call glGetStringi through an uninitialized pointer; test by restricting Mesa to llvmpipe and running wflinfo as Piglit does (cf. /framework/wflinfo.py):
% export DISPLAY=:0 % export LIBGL_ALWAYS_SOFTWARE=1 % gdb .../wflinfo (gdb) run --platform glx --api gl --profile compat stack trace: at ../src/utils/wflinfo.c:982 at ../src/utils/wflinfo.c:998 out_ctx=0x7fffffffc560, out_config=0x7fffffffc568, exit_if_ctx_creation_fails=false) at ../src/utils/wflinfo.c:1096 out_config=0x7fffffffc568) at ../src/utils/wflinfo.c:1141
Select the ordering via order[] array and for/switch construct so that each instance of the actual A & B code need appear only once. 0001-wflinfo-window-context-creation-glGetStringi-init-or.patch