From 509c873c847c7b95c242e3d1d42c5619560ccde3 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 25 Oct 2022 18:14:24 +0900 Subject: [PATCH] Fix native rendering context Change-Id: I729f0f7d8edac23978f0816c8a10a7cafa6d4bc2 --- dali/internal/graphics/gles-impl/gles-context.cpp | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/dali/internal/graphics/gles-impl/gles-context.cpp b/dali/internal/graphics/gles-impl/gles-context.cpp index f2962a0..2f2d617 100644 --- a/dali/internal/graphics/gles-impl/gles-context.cpp +++ b/dali/internal/graphics/gles-impl/gles-context.cpp @@ -1024,13 +1024,20 @@ void Context::PrepareForNativeRendering() if(!mImpl->mNativeDrawContext) { EGLint configId{0u}; - EGLint size{0u}; - eglGetConfigs(display, nullptr, 0, &size); - std::vector configs; - configs.resize(size); - eglGetConfigs(display, configs.data(), configs.size(), &size); + eglQueryContext(display, mImpl->mController.GetSharedContext(), EGL_CONFIG_ID, &configId); - eglQueryContext(display, context, EGL_CONFIG_ID, &configId); + EGLint configAttribs[3]; + configAttribs[0] = EGL_CONFIG_ID; + configAttribs[1] = configId; + configAttribs[2] = EGL_NONE; + + EGLConfig config; + EGLint numConfigs; + if(eglChooseConfig(display, configAttribs, &config, 1, &numConfigs) != EGL_TRUE) + { + DALI_LOG_ERROR("eglChooseConfig failed!\n"); + return; + } auto version = int(mImpl->mController.GetGLESVersion()); @@ -1041,7 +1048,12 @@ void Context::PrepareForNativeRendering() attribs.push_back(version % 10); attribs.push_back(EGL_NONE); - mImpl->mNativeDrawContext = eglCreateContext(display, configs[configId], mImpl->mController.GetSharedContext(), attribs.data()); + mImpl->mNativeDrawContext = eglCreateContext(display, config, mImpl->mController.GetSharedContext(), attribs.data()); + if(mImpl->mNativeDrawContext == EGL_NO_CONTEXT) + { + DALI_LOG_ERROR("eglCreateContext failed!\n"); + return; + } } eglMakeCurrent(display, drawSurface, readSurface, mImpl->mNativeDrawContext); -- 2.7.4