summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-10 20:55:30 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-09-17 14:48:45 +0000
commit0cea6384ae641b955d0f51bc344b0fb6bb1ae029 (patch)
treec90d61f46100a5c2a80e06d8dbf7e2b05034741e
parent0dbed05bbc16c37483bea90b3eff3db899a0bf07 (diff)
android: Implement nativeResourceForContext
To bring the plugin on par with xcb and eglfs in this regard. New code has a better way to query these via QOpenGLContext::nativeInterface() (or, more correctly, will have a better way once the ability to query the config and display is added in a follow up patch), but having some symmetry between the EGL-based plugins won't hurt. This is relevant in particular with OpenXR: not knowing the EGLConfig makes it impossible to use the API on Android: https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsBindingOpenGLESAndroidKHR Pick-to: 6.2 Change-Id: I163aed070096a4b58d3f650906c2f70ea31b3231 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp13
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 7b4102fac6..c9ef977816 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -143,6 +143,19 @@ void *QAndroidPlatformNativeInterface::nativeResourceForWindow(const QByteArray
return nullptr;
}
+void *QAndroidPlatformNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
+{
+ if (QEGLPlatformContext *platformContext = static_cast<QEGLPlatformContext *>(context->handle())) {
+ if (resource == "eglcontext")
+ return platformContext->eglContext();
+ else if (resource == "eglconfig")
+ return platformContext->eglConfig();
+ else if (resource == "egldisplay")
+ return platformContext->eglDisplay();
+ }
+ return nullptr;
+}
+
void QAndroidPlatformNativeInterface::customEvent(QEvent *event)
{
if (event->type() != QEvent::User)
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h
index d579bc29ae..52442e87af 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/qandroidplatformintegration.h
@@ -65,6 +65,7 @@ class QAndroidPlatformNativeInterface: public QPlatformNativeInterface
public:
void *nativeResourceForIntegration(const QByteArray &resource) override;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
+ void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
std::shared_ptr<AndroidStyle> m_androidStyle;
protected: