[PATCH 3/5] opengl32: Fix extension checks on OpenGL core profile contexts.
Matteo Bruni
matteo.mystral at gmail.com
Mon Jan 5 13:19:32 CST 2015
2015-01-05 18:33 GMT+01:00 Henri Verbeet <hverbeet at gmail.com>:
> On 5 January 2015 at 17:17, Matteo Bruni <mbruni at codeweavers.com> wrote:
>> static BOOL has_extension( const char *list, const char *ext, size_t len )
>> {
>> + if (!list)
>> + {
>> + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
>> + const char *gl_ext;
>> + unsigned int i;
>> + GLint extensions_count;
>> +
>> + glGetIntegerv(GL_NUM_EXTENSIONS, &extensions_count);
>> + for (i = 0; i < extensions_count; ++i)
>> + {
>> + gl_ext = (const char *)funcs->ext.p_glGetStringi(GL_EXTENSIONS, i);
>> + if (!strncmp(gl_ext, ext, len) && !gl_ext[len])
>> + return TRUE;
>> + }
>> + return FALSE;
>> + }
>> +
> If I'm reading this correctly, this effectively ignores
> DisabledExtensions for anything newer than GL 3.0. (And at least as
> far as wglGetProcAddress() is concerned it affects both compatibility
> and core contexts.)
Hmm, it should still work via filter_extensions(). On the other hand
we don't filter the extensions the application queries through
glGetStringi(GL_EXTENSIONS, i), so yeah, that is missing and I should
add that (maybe in a separate patch?)
>> + gl_version = (const char *)glGetString(GL_VERSION);
>> + sscanf(gl_version, "%u", &major);
>> + if (major >= 3)
>> + {
> It seems tempting to just flag the context in
> wglCreateContextAttribsARB() under the appropriate conditions, perhaps
> in a similar way to wgl_handle_type. Not sure if it would really make
> it better though.
I'm going to give it a try and see how it looks.
> As an aside, note that winex11.drv also uses
> "glGetString(GL_EXTENSIONS);" in X11DRV_WineGL_InitOpenglInfo().
That should be fine, that's always a compatibility context created
with glXCreateContext().
More information about the wine-devel
mailing list