From f53afe412de49dbc41bddb58c91e46a15dfc8172 Mon Sep 17 00:00:00 2001 From: "huiyu.eun" Date: Wed, 23 Jun 2021 17:03:43 +0900 Subject: [PATCH] Revert "[Tizen] Revert "Make to use right egl image extension name in the glsl 3.x"" This reverts commit b78e02cf65bbccf774b29d7f023b6b0c93b67e92. --- dali/internal/graphics/gles/egl-graphics.h | 5 ++++ dali/internal/graphics/gles/gl-implementation.h | 31 ++++++++++++++++++---- .../android/native-image-source-impl-android.cpp | 6 ----- .../tizen/native-image-source-impl-tizen.cpp | 10 ++++--- .../imaging/tizen/native-image-source-impl-tizen.h | 7 ++--- .../tizen/native-image-source-queue-impl-tizen.cpp | 10 ++++--- .../tizen/native-image-source-queue-impl-tizen.h | 21 ++++++++------- 7 files changed, 58 insertions(+), 32 deletions(-) diff --git a/dali/internal/graphics/gles/egl-graphics.h b/dali/internal/graphics/gles/egl-graphics.h index 5a5e78d..8c8d80c 100644 --- a/dali/internal/graphics/gles/egl-graphics.h +++ b/dali/internal/graphics/gles/egl-graphics.h @@ -187,6 +187,11 @@ public: return mGLES->GetShadingLanguageVersion(); } + const char* GetEglImageExtensionString() + { + return mGLES->GetEglImageExtensionString(); + } + void CacheConfigurations(ConfigurationManager& configurationManager) override; private: diff --git a/dali/internal/graphics/gles/gl-implementation.h b/dali/internal/graphics/gles/gl-implementation.h index 4f3b8dc..40d764d 100644 --- a/dali/internal/graphics/gles/gl-implementation.h +++ b/dali/internal/graphics/gles/gl-implementation.h @@ -40,19 +40,23 @@ namespace Adaptor { namespace { -const int32_t INITIAL_GLES_VERSION = 30; -const int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32; -const char* KHR_BLEND_EQUATION_ADVANCED = "GL_KHR_blend_equation_advanced"; +static constexpr int32_t INITIAL_GLES_VERSION = 30; +static constexpr int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32; +static constexpr const char* KHR_BLEND_EQUATION_ADVANCED = "GL_KHR_blend_equation_advanced"; -const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX = +static constexpr const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX = "#extension GL_KHR_blend_equation_advanced : enable\n" "#if GL_KHR_blend_equation_advanced==1 || __VERSION__>=320\n" " layout(blend_support_all_equations) out;\n" "#endif\n"; -const char* FRAGMENT_SHADER_OUTPUT_COLOR_STRING = +static constexpr const char* FRAGMENT_SHADER_OUTPUT_COLOR_STRING = "out mediump vec4 fragColor;\n"; + +static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING = "#extension GL_OES_EGL_image_external:require\n"; + +static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3 = "#extension GL_OES_EGL_image_external_essl3:require\n"; } // namespace /** @@ -353,6 +357,23 @@ public: return mShadingLanguageVersion; } + const char* GetEglImageExtensionString() + { + ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition); + if(!mIsContextCreated) + { + mContextCreatedWaitCondition.Wait(lock); + } + if(mShadingLanguageVersion < 300) + { + return OES_EGL_IMAGE_EXTERNAL_STRING; + } + else + { + return OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3; + } + } + /* OpenGL ES 2.0 */ void ActiveTexture(GLenum texture) override diff --git a/dali/internal/imaging/android/native-image-source-impl-android.cpp b/dali/internal/imaging/android/native-image-source-impl-android.cpp index c3f8493..0754ecf 100644 --- a/dali/internal/imaging/android/native-image-source-impl-android.cpp +++ b/dali/internal/imaging/android/native-image-source-impl-android.cpp @@ -34,12 +34,6 @@ #include #include -namespace -{ -const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n"; -const char* SAMPLER_TYPE = "samplerExternalOES"; -} // namespace - namespace Dali { namespace Internal diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp index bbc14a7..f0b7a0e 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -38,8 +38,7 @@ namespace Adaptor { namespace { -const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n"; -const char* SAMPLER_TYPE = "samplerExternalOES"; +const char* SAMPLER_TYPE = "samplerExternalOES"; // clang-format off tbm_format FORMATS_BLENDING_REQUIRED[] = { @@ -75,7 +74,8 @@ NativeImageSourceTizen* NativeImageSourceTizen::New(uint32_t width, uint32_t hei } NativeImageSourceTizen::NativeImageSourceTizen(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) -: mWidth(width), +: mCustomFragmentPrefix(), + mWidth(width), mHeight(height), mOwnTbmSurface(false), mTbmSurface(NULL), @@ -94,6 +94,8 @@ NativeImageSourceTizen::NativeImageSourceTizen(uint32_t width, uint32_t height, GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface()); mEglGraphics = static_cast(graphics); + mCustomFragmentPrefix = mEglGraphics->GetEglImageExtensionString(); + mTbmSurface = GetSurfaceFromAny(nativeImageSource); if(mTbmSurface != NULL) @@ -465,7 +467,7 @@ void NativeImageSourceTizen::PrepareTexture() const char* NativeImageSourceTizen::GetCustomFragmentPrefix() const { - return FRAGMENT_PREFIX; + return mCustomFragmentPrefix; } const char* NativeImageSourceTizen::GetCustomSamplerTypename() const diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h index 7f48b92..2fa10a8 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h @@ -190,9 +190,10 @@ private: void DestroySurface(); private: - uint32_t mWidth; ///< image width - uint32_t mHeight; ///< image height - bool mOwnTbmSurface; ///< Whether we created pixmap or not + const char* mCustomFragmentPrefix; ///< Prefix for CustomFragment + uint32_t mWidth; ///< image width + uint32_t mHeight; ///< image height + bool mOwnTbmSurface; ///< Whether we created pixmap or not tbm_surface_h mTbmSurface; tbm_format mTbmFormat; bool mBlendingRequired; ///< Whether blending is required diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp index 8028efd..7f72939 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp @@ -38,8 +38,7 @@ namespace { #define TBM_SURFACE_QUEUE_SIZE 3 -const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n"; -const char* SAMPLER_TYPE = "samplerExternalOES"; +const char* SAMPLER_TYPE = "samplerExternalOES"; // clang-format off int FORMATS_BLENDING_REQUIRED[] = { @@ -73,7 +72,8 @@ NativeImageSourceQueueTizen* NativeImageSourceQueueTizen::New(uint32_t width, ui } NativeImageSourceQueueTizen::NativeImageSourceQueueTizen(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue) -: mMutex(), +: mCustomFragmentPrefix(), + mMutex(), mWidth(width), mHeight(height), mTbmQueue(NULL), @@ -89,6 +89,8 @@ NativeImageSourceQueueTizen::NativeImageSourceQueueTizen(uint32_t width, uint32_ GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface()); mEglGraphics = static_cast(graphics); + mCustomFragmentPrefix = mEglGraphics->GetEglImageExtensionString(); + mTbmQueue = GetSurfaceFromAny(nativeImageSourceQueue); if(mTbmQueue != NULL) @@ -280,7 +282,7 @@ void NativeImageSourceQueueTizen::PrepareTexture() const char* NativeImageSourceQueueTizen::GetCustomFragmentPrefix() const { - return FRAGMENT_PREFIX; + return mCustomFragmentPrefix; } const char* NativeImageSourceQueueTizen::GetCustomSamplerTypename() const diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h index 4f86eb4..5702eaf 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h @@ -171,16 +171,17 @@ private: private: typedef std::pair EglImagePair; - Dali::Mutex mMutex; ///< Mutex - uint32_t mWidth; ///< image width - uint32_t mHeight; ///< image height - tbm_surface_queue_h mTbmQueue; ///< Tbm surface queue handle - tbm_surface_h mConsumeSurface; ///< The current tbm surface - std::vector mEglImages; ///< EGL Image vector - EglGraphics* mEglGraphics; ///< EGL Graphics - EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions - bool mOwnTbmQueue; ///< Whether we created tbm queue - bool mBlendingRequired; ///< Whether blending is required + const char* mCustomFragmentPrefix; ///< Prefix for CustomFragment + Dali::Mutex mMutex; ///< Mutex + uint32_t mWidth; ///< image width + uint32_t mHeight; ///< image height + tbm_surface_queue_h mTbmQueue; ///< Tbm surface queue handle + tbm_surface_h mConsumeSurface; ///< The current tbm surface + std::vector mEglImages; ///< EGL Image vector + EglGraphics* mEglGraphics; ///< EGL Graphics + EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions + bool mOwnTbmQueue; ///< Whether we created tbm queue + bool mBlendingRequired; ///< Whether blending is required }; } // namespace Adaptor -- 2.7.4