cogl-gles2-context: Cast func pointers to void* when filling
vtable (Sorry, I had to re-apply Neil's patch as the original one somehow did not apply) The function prototypes for the GL functions in CoglContext have the GLAPIENTRY attribute which on Windows makes them use the stdcall calling convention. The function pointers exposed from cogl-gles2.h don't have GLAPIENTRY so they end up having a different calling convention on Windows. When Cogl is compiled there it ends up giving a lot of warnings because it assigns a pointer to an incompatible function type. We probably don't want to make the functions exposed in cogl-gles2.h use the stdcall calling convention because we control that API so there is no need to introduce a second calling convention. The GLES2 context support currently isn't going to work on Windows anyway because there is no EGL or GLES2 implementation. Eventually if we make the Cogl GLES2 context virtualized on top of Cogl then we will provide our own implementations of all these functions so we can easily keep the C calling convention even on Windows. Until then to avoid the warnings on Windows we can just cast the function pointers temporarily to (void*) when filling in the vtable. This will also fix the build on Windows using Visual Studio, as it is more picky on calling convention mismatches. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
fefa6bc929
commit
491618a74c
@ -1597,7 +1597,7 @@ cogl_gles2_context_new (CoglContext *ctx, GError **error)
|
||||
extension_suffixes, extension_names)
|
||||
|
||||
#define COGL_EXT_FUNCTION(ret, name, args) \
|
||||
gles2_ctx->vtable->name = ctx->name;
|
||||
gles2_ctx->vtable->name = (void *) ctx->name;
|
||||
|
||||
#define COGL_EXT_END()
|
||||
|
||||
@ -1607,10 +1607,15 @@ cogl_gles2_context_new (CoglContext *ctx, GError **error)
|
||||
#undef COGL_EXT_FUNCTION
|
||||
#undef COGL_EXT_END
|
||||
|
||||
gles2_ctx->vtable->glBindFramebuffer = gl_bind_framebuffer_wrapper;
|
||||
gles2_ctx->vtable->glReadPixels = gl_read_pixels_wrapper;
|
||||
gles2_ctx->vtable->glCopyTexImage2D = gl_copy_tex_image_2d_wrapper;
|
||||
gles2_ctx->vtable->glCopyTexSubImage2D = gl_copy_tex_sub_image_2d_wrapper;
|
||||
gles2_ctx->vtable->glBindFramebuffer =
|
||||
(void *) gl_bind_framebuffer_wrapper;
|
||||
gles2_ctx->vtable->glReadPixels =
|
||||
(void *) gl_read_pixels_wrapper;
|
||||
gles2_ctx->vtable->glCopyTexImage2D =
|
||||
(void *) gl_copy_tex_image_2d_wrapper;
|
||||
gles2_ctx->vtable->glCopyTexSubImage2D =
|
||||
(void *) gl_copy_tex_sub_image_2d_wrapper;
|
||||
|
||||
gles2_ctx->vtable->glCreateShader = gl_create_shader_wrapper;
|
||||
gles2_ctx->vtable->glDeleteShader = gl_delete_shader_wrapper;
|
||||
gles2_ctx->vtable->glCreateProgram = gl_create_program_wrapper;
|
||||
|
Loading…
Reference in New Issue
Block a user