[waffle] [PATCH] wflinfo: find glGetStringi on both Mali and WGL
Jose Fonseca
jfonseca at vmware.com
Wed Jan 28 03:43:15 PST 2015
On 26/01/15 23:25, Frank Henigman wrote:
> Do the glGetStringi lookup after making context current so it works on WGL.
> Remove an incorrect glGetStringi lookup, which returned NULL on Mali.
>
> Signed-off-by: Frank Henigman <fjhenigman at google.com>
> ---
> Not sure what happened but wflinfo is still broken on mali because of the glGetStringi madness.
> Chad put in a fix:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_waffle-2Dgl_waffle_commit_0543d0d12aa16e0daf361937619998c8995fd6fc&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=jj_3KkjKndz1s137tbSUUg5KMJt2V9GA1zfYN2FD3NM&s=MqMB3pPMPv0XARCwxF4eXGARoUaWTUMgtf36lr6r18k&e=
> and ten days before that Emil had moved the offending waffle_get_proc_address("glGetStringi") down about 20 lines:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_waffle-2Dgl_waffle_commit_6ae99a4701bd5117a182c2e555a0c0a2061254d3&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=jj_3KkjKndz1s137tbSUUg5KMJt2V9GA1zfYN2FD3NM&s=nva4AmJVhqxaYMvR3ci1RRFczSckPxLwyQrku1kjGkg&e=
> It looks like both changes to that line got in, because after Chad's change successfully sets the address the old, wrong line later sets it to null.
> Sorry but I'm not able to test on Windows.
>
> src/utils/wflinfo.c | 40 +++++++++++++++++++---------------------
> 1 file changed, 19 insertions(+), 21 deletions(-)
>
> diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> index 5a9195c..5e173b7 100644
> --- a/src/utils/wflinfo.c
> +++ b/src/utils/wflinfo.c
> @@ -1076,6 +1076,25 @@ main(int argc, char **argv)
> if (!glGetString)
> error_get_gl_symbol("glGetString");
>
> + const struct wflinfo_config_attrs config_attrs = {
> + .api = opts.context_api,
> + .profile = opts.context_profile,
> + .major = opts.context_major,
> + .minor = opts.context_minor,
> + .forward_compat = opts.context_forward_compatible,
> + .debug = opts.context_debug,
> + };
After this change, MSVC 2013 started to fail with:
[1/3] Building C object src\utils\CMakeFiles\wflinfo.dir\wflinfo.c.obj
FAILED: C:\PROGRA~2\MICROS~2.0\VC\bin\cl.exe /nologo /DWIN32
/D_WINDOWS /W3 /MT /O1 /Ob1 /D NDEBUG -I..\include -I..\include\waffle
-I..\src -I..\third_party\threads -I..\third_party\getopt /showIncludes
-DWAFFLE_HAS_WGL -DWINVER=0x0601 -D_CRT_NONSTDC_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS -D_WIN32_WINNT=0x0601
/Fosrc\utils\CMakeFiles\wflinfo.dir\wflinfo.c.obj
/Fdsrc\utils\CMakeFiles\wflinfo.dir/ /FS -c ..\src\utils\wflinfo.c
..\src\utils\wflinfo.c(1079) : error C2143: syntax error : missing ';'
before 'const'
..\src\utils\wflinfo.c(1088) : error C2065: 'config_attrs' : undeclared
identifier
..\src\utils\wflinfo.c(1088) : error C2440: 'function' : cannot convert
from 'int' to 'wflinfo_config_attrs'
..\src\utils\wflinfo.c(1088) : warning C4024: 'wflinfo_create_context' :
different types for formal and actual parameter 2
But this change makes MSVC happy:
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
index 5e173b7..30d04cd 100644
--- a/src/utils/wflinfo.c
+++ b/src/utils/wflinfo.c
@@ -1073,8 +1073,9 @@ main(int argc, char **argv)
error_get_gl_symbol("glGetIntegerv");
glGetString = waffle_dl_sym(opts.dl, "glGetString");
- if (!glGetString)
+ if (!glGetString) {
error_get_gl_symbol("glGetString");
+ }
const struct wflinfo_config_attrs config_attrs = {
.api = opts.context_api,
That is, there's a bug in MSVC 2013 C99 grammar/parser...
Jose
> +
> + wflinfo_create_context(dpy, config_attrs, &ctx, &config);
> +
> + window = waffle_window_create(config, WINDOW_WIDTH, WINDOW_HEIGHT);
> + if (!window)
> + error_waffle();
> +
> + ok = waffle_make_current(dpy, window, ctx);
> + if (!ok)
> + error_waffle();
> +
> // Retrieving GL functions is tricky. When glGetStringi is supported, here
> // are some boggling variations as of 2014-11-19:
> // - Mali drivers on EGL 1.4 expose glGetStringi statically from
> @@ -1099,27 +1118,6 @@ main(int argc, char **argv)
> glGetStringi = waffle_get_proc_address("glGetStringi");
> }
>
> - const struct wflinfo_config_attrs config_attrs = {
> - .api = opts.context_api,
> - .profile = opts.context_profile,
> - .major = opts.context_major,
> - .minor = opts.context_minor,
> - .forward_compat = opts.context_forward_compatible,
> - .debug = opts.context_debug,
> - };
> -
> - wflinfo_create_context(dpy, config_attrs, &ctx, &config);
> -
> - window = waffle_window_create(config, WINDOW_WIDTH, WINDOW_HEIGHT);
> - if (!window)
> - error_waffle();
> -
> - ok = waffle_make_current(dpy, window, ctx);
> - if (!ok)
> - error_waffle();
> -
> - glGetStringi = waffle_get_proc_address("glGetStringi");
> -
> ok = print_wflinfo(&opts);
> if (!ok)
> error_waffle();
>
More information about the waffle
mailing list