From 10f72c1c9d47897deb7155556c99d2fee39aabfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 17 Apr 2012 09:07:09 +0200 Subject: Use the new QPlatformNativeInterface native resource function getter Change-Id: I5b4e0a48247573e3fc03a87a53c02fa5b5a984d9 Reviewed-by: Paul Olav Tvete --- .../wayland_egl/waylandeglintegration.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp b/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp index 655407378..fb25d2620 100644 --- a/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp +++ b/src/compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp @@ -104,6 +104,8 @@ public: PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image; PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d; + + QPlatformNativeInterface::NativeResourceForContextFunction get_egl_context; }; WaylandEglIntegration::WaylandEglIntegration(WaylandCompositor *compositor) @@ -123,6 +125,10 @@ void WaylandEglIntegration::initializeHardware(Wayland::Display *waylandDisplay) const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS); if (extensionString && strstr(extensionString, "EGL_WL_bind_wayland_display")) { + d->get_egl_context = nativeInterface->nativeResourceFunctionForContext("get_egl_context"); + if (!d->get_egl_context) { + qWarning("Failed to retrieve the get_egl_context function"); + } d->egl_bind_wayland_display = reinterpret_cast(eglGetProcAddress("eglBindWaylandDisplayWL")); d->egl_unbind_wayland_display = @@ -135,6 +141,7 @@ void WaylandEglIntegration::initializeHardware(Wayland::Display *waylandDisplay) reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); if (d->egl_bind_wayland_display + && d->get_egl_context && d->egl_unbind_wayland_display && d->egl_create_image && d->egl_destroy_image @@ -160,8 +167,7 @@ GLuint WaylandEglIntegration::createTextureFromBuffer(wl_buffer *buffer, QOpenGL } QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); -//#####jl: fix to use functions pointer - EGLContext egl_context = nativeInterface->nativeResourceForContext("EglContext", context); + EGLContext egl_context = d->get_egl_context(context); EGLImageKHR image = d->egl_create_image(d->egl_display, egl_context, EGL_WAYLAND_BUFFER_WL, @@ -228,8 +234,7 @@ void *WaylandEglIntegration::lockNativeBuffer(struct wl_buffer *buffer, QOpenGLC Q_D(const WaylandEglIntegration); QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); -//#####jl: fix to use functions pointer - EGLContext egl_context = nativeInterface->nativeResourceForContext("EglContext", context); + EGLContext egl_context = d->get_egl_context(context); EGLImageKHR image = d->egl_create_image(d->egl_display, egl_context, EGL_WAYLAND_BUFFER_WL, -- cgit v1.2.3