Evas GL: Error out on surfaceless make_current with OSMesa
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 14 Oct 2015 12:35:09 +0000 (21:35 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 15 Oct 2015 07:20:53 +0000 (16:20 +0900)
While OSMesa may support surfaceless contexts, we don't support
them yet in the SW engine. Instead of switching to NULL, NULL,
let's error out and do nothing instead.

src/modules/evas/engines/software_generic/evas_engine.c

index 721c4ee..7002378 100644 (file)
@@ -123,7 +123,6 @@ typedef OSMesaContext          (*glsym_func_osm_ctx) ();
 static Evas_GL_API gl_funcs;
 static void *gl_lib_handle;
 static int gl_lib_is_gles = 0;
-static Evas_GL_API gl_funcs;
 
 static Eina_Bool _tls_init = EINA_FALSE;
 static Eina_TLS gl_current_ctx_key = 0;
@@ -3087,6 +3086,12 @@ eng_gl_make_current(void *data EINA_UNUSED, void *surface, void *context)
 
    _tls_check();
 
+   if ((!sfc) ^ (!ctx))
+     {
+        ERR("Evas GL on SW engine does not support surfaceless contexts.");
+        return 0;
+     }
+
    // Unset surface/context
    if ((!sfc) || (!ctx))
      {
@@ -3101,15 +3106,15 @@ eng_gl_make_current(void *data EINA_UNUSED, void *surface, void *context)
    if (!ctx->initialized)
      {
         if (ctx->share_ctx)
-           share_ctx = ctx->share_ctx->context;
+          share_ctx = ctx->share_ctx->context;
         else
-           share_ctx = NULL;
+          share_ctx = NULL;
 
-        ctx->context =  _sym_OSMesaCreateContextExt(sfc->internal_fmt, 
-                                                    sfc->depth_bits,
-                                                    sfc->stencil_bits,
-                                                    0,
-                                                    share_ctx);
+        ctx->context = _sym_OSMesaCreateContextExt(sfc->internal_fmt,
+                                                   sfc->depth_bits,
+                                                   sfc->stencil_bits,
+                                                   0,
+                                                   share_ctx);
         if (!ctx->context)
           {
              ERR("Error initializing context.");
@@ -4939,7 +4944,7 @@ evgl_glGetString(GLenum name)
 static void
 override_gl_apis(Evas_GL_API *api)
 {
-
+   memset(&gl_funcs, 0, sizeof(gl_funcs));
    api->version = EVAS_GL_API_VERSION;
 
 #define ORD(f) EVAS_API_OVERRIDE(f, api, _sym_)