summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2012-11-24 00:18:29 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2012-11-24 00:18:29 +0800
commit491618a74c46eb492bba3afb7e33c6d1de2a1224 (patch)
tree5502c02b6d77a43e40033bab554c5c33afbc62bc
parentfefa6bc929dbfd284551fc1a7abc1ace3c314451 (diff)
downloadcogl-491618a74c46eb492bba3afb7e33c6d1de2a1224.tar.gz
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>
-rw-r--r--cogl/cogl-gles2-context.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c
index 2e727861..ed95b696 100644
--- a/cogl/cogl-gles2-context.c
+++ b/cogl/cogl-gles2-context.c
@@ -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;