summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-03-14 16:49:01 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-03-14 17:01:24 +0900
commitc68a40987404375b36460b6a7f5ccceb45444b57 (patch)
treebbca59ba6b6766547653ff15be566fd8d4eebfe1
parent0b5b5e44a53c73b4ec64ada2c52e8a7aac3e5033 (diff)
evas gl: Add a hack for GLES 3.1 with NVIDIA + GLVND
I believe there's a limitation in libglvnd where it doesn't propagate the calls to eglGetProcAddress() properly to the vendor library. See also 265c851a8f2ac3cd1f93d523736d4cce0454fe2c
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c
index 14378143e0..47feb44e62 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -25,6 +25,7 @@
25 } 25 }
26 26
27static void *_gles3_handle = NULL; 27static void *_gles3_handle = NULL;
28static void *_gles3_handle_fallback = NULL;
28static Evas_GL_API _gles3_api; 29static Evas_GL_API _gles3_api;
29//---------------------------------------// 30//---------------------------------------//
30// API Debug Error Checking Code 31// API Debug Error Checking Code
@@ -3366,8 +3367,49 @@ _evgl_load_gles3_apis(void *dl_handle, Evas_GL_API *funcs, int minor_version,
3366 3367
3367 if (minor_version > 0) 3368 if (minor_version > 0)
3368 { 3369 {
3369 //GLES 3.1 3370 // OpenGL ES 3.1
3370 ret_value = EINA_TRUE; 3371 ret_value = EINA_TRUE;
3372
3373 /* HACK for libglvnd (The GL Vendor-Neutral Dispatch library)
3374 *
3375 * For NVIDIA driver using libglvnd, GLES 3.0 symbols are exposed in
3376 * libGLESv2.so and properly forwarded to libGLESv2_nvidia.so.
3377 *
3378 * But for GLES 3.1+ the symbols are not present in libGLESv2.so so
3379 * the following dlsym() would invariably fail. eglGetProcAddress also
3380 * fails to find the symbols. I believe this is a bug in libglvnd's
3381 * libEGL.so, as it should be finding the symbol in nvidia's library.
3382 *
3383 * So we try here to link directly to the vendor library. This is ugly,
3384 * but this makes GLES 3.1 work.
3385 *
3386 * FIXME: This hack should be removed when libglvnd fixes support
3387 * for GLES 3.1+ properly.
3388 */
3389
3390 funcs->glDispatchCompute = dlsym(dl_handle, "glDispatchCompute");
3391 if (!funcs->glDispatchCompute && get_proc_address)
3392 get_proc_address("glDispatchCompute");
3393#ifdef GL_GLES
3394 if (!funcs->glDispatchCompute)
3395 {
3396 const char *vendor;
3397
3398 vendor = (const char *) funcs->glGetString(GL_VENDOR);
3399 if (!vendor) return ret_value;
3400
3401 // FIXME: Add other support for other vendors
3402 if (!strcmp(vendor, "NVIDIA Corporation"))
3403 _gles3_handle_fallback = dlopen("libGLESv2_nvidia.so", RTLD_NOW);
3404
3405 if (!_gles3_handle_fallback) return ret_value;
3406 dl_handle = _gles3_handle_fallback;
3407 get_proc_address = NULL;
3408 }
3409#else
3410 if (!funcs->glDispatchCompute) return ret_value;
3411#endif
3412
3371 ORD(glDispatchCompute); 3413 ORD(glDispatchCompute);
3372 ORD(glDispatchComputeIndirect); 3414 ORD(glDispatchComputeIndirect);
3373 ORD(glDrawArraysIndirect); 3415 ORD(glDrawArraysIndirect);