From d6fed1031ead72f9a6f647c089965931e326ac6c Mon Sep 17 00:00:00 2001 From: seungho Date: Thu, 24 Jun 2021 16:13:34 +0900 Subject: [PATCH] Add ApplyCustomFragmentPrefix - Apply suitable prefix for the native image fragment shader Change-Id: I8315c904b08a7d1443458d877f202dfa62714fed Signed-off-by: seungho --- .../dali-test-suite-utils/test-native-image.h | 17 ++++++++ .../native-image-source-queue.cpp | 5 +++ .../adaptor-framework/native-image-source-queue.h | 5 +++ dali/internal/graphics/gles/egl-graphics.h | 4 +- dali/internal/graphics/gles/gl-implementation.h | 51 ++++++++++++++++++---- .../android/native-image-source-impl-android.cpp | 5 +++ .../android/native-image-source-impl-android.h | 5 +++ .../native-image-source-queue-impl-android.cpp | 15 +++---- .../native-image-source-queue-impl-android.h | 5 +++ .../imaging/common/native-bitmap-buffer-impl.cpp | 5 +++ .../imaging/common/native-bitmap-buffer-impl.h | 5 +++ .../imaging/common/native-image-source-impl.h | 5 +++ .../common/native-image-source-queue-impl.h | 5 +++ .../imaging/macos/native-image-source-impl-mac.cpp | 5 +++ .../imaging/macos/native-image-source-impl-mac.h | 5 +++ .../tizen/native-image-source-impl-tizen.cpp | 15 ++++--- .../imaging/tizen/native-image-source-impl-tizen.h | 12 +++-- .../tizen/native-image-source-queue-impl-tizen.cpp | 15 ++++--- .../tizen/native-image-source-queue-impl-tizen.h | 26 ++++++----- .../ubuntu-x11/native-image-source-impl-x.cpp | 5 +++ .../ubuntu-x11/native-image-source-impl-x.h | 5 +++ .../native-image-source-queue-impl-x.cpp | 13 +++--- .../ubuntu-x11/native-image-source-queue-impl-x.h | 5 +++ .../windows/native-image-source-impl-win.cpp | 5 +++ .../imaging/windows/native-image-source-impl-win.h | 5 +++ .../adaptor-framework/native-image-source.cpp | 5 +++ .../adaptor-framework/native-image-source.h | 5 +++ 27 files changed, 207 insertions(+), 51 deletions(-) diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h index d134942..fb9451c 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-native-image.h @@ -83,6 +83,23 @@ public: mCallStack.PushCall("GetCustomFragmentPrefix", ""); return "#extension GL_OES_EGL_image_external:require\n"; }; + inline virtual bool ApplyNativeFragmentShader(std::string& shader) + { + mCallStack.PushCall("ApplyNativeFragmentShader", ""); + shader = "#extension GL_OES_EGL_image_external:require\n" + shader; + + //Get custom sampler type name + const char* customSamplerTypename = GetCustomSamplerTypename(); + if(customSamplerTypename) + { + size_t samplerPosition = shader.find("sampler2D"); + if(samplerPosition != std::string::npos) + { + shader.replace(samplerPosition, strlen("sampler2D"), customSamplerTypename); + } + } + return true; + }; inline const char* GetCustomSamplerTypename() const override { mCallStack.PushCall("GetCustomSamplerTypename", ""); diff --git a/dali/devel-api/adaptor-framework/native-image-source-queue.cpp b/dali/devel-api/adaptor-framework/native-image-source-queue.cpp index a144139..f7d202e 100644 --- a/dali/devel-api/adaptor-framework/native-image-source-queue.cpp +++ b/dali/devel-api/adaptor-framework/native-image-source-queue.cpp @@ -105,6 +105,11 @@ const char* NativeImageSourceQueue::GetCustomFragmentPrefix() const return mImpl->GetCustomFragmentPrefix(); } +bool NativeImageSourceQueue::ApplyNativeFragmentShader(std::string& shader) +{ + return mImpl->ApplyNativeFragmentShader(shader); +} + const char* NativeImageSourceQueue::GetCustomSamplerTypename() const { return mImpl->GetCustomSamplerTypename(); diff --git a/dali/devel-api/adaptor-framework/native-image-source-queue.h b/dali/devel-api/adaptor-framework/native-image-source-queue.h index 788c565..1c90b81 100644 --- a/dali/devel-api/adaptor-framework/native-image-source-queue.h +++ b/dali/devel-api/adaptor-framework/native-image-source-queue.h @@ -121,6 +121,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/internal/graphics/gles/egl-graphics.h b/dali/internal/graphics/gles/egl-graphics.h index 1caa4a6..399ff1a 100644 --- a/dali/internal/graphics/gles/egl-graphics.h +++ b/dali/internal/graphics/gles/egl-graphics.h @@ -194,9 +194,9 @@ public: return mGLES->GetShadingLanguageVersion(); } - const char* GetEglImageExtensionString() + bool ApplyNativeFragmentShader(std::string& shader, const char* customSamplerType) { - return mGLES->GetEglImageExtensionString(); + return mGLES->ApplyNativeFragmentShader(shader, customSamplerType); } void CacheConfigurations(ConfigurationManager& configurationManager) override; diff --git a/dali/internal/graphics/gles/gl-implementation.h b/dali/internal/graphics/gles/gl-implementation.h index 40d764d..e60fb8f 100644 --- a/dali/internal/graphics/gles/gl-implementation.h +++ b/dali/internal/graphics/gles/gl-implementation.h @@ -25,6 +25,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -42,8 +43,11 @@ namespace { static constexpr int32_t INITIAL_GLES_VERSION = 30; static constexpr int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32; +static constexpr const char* LEGACY_SHADING_LANGUAGE_VERSION = "100"; static constexpr const char* KHR_BLEND_EQUATION_ADVANCED = "GL_KHR_blend_equation_advanced"; +static constexpr const char* DEFAULT_SAMPLER_TYPE = "sampler2D"; + static constexpr const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX = "#extension GL_KHR_blend_equation_advanced : enable\n" @@ -357,21 +361,52 @@ public: return mShadingLanguageVersion; } - const char* GetEglImageExtensionString() + bool ApplyNativeFragmentShader(std::string& shader, const char* customSamplerType) { - ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition); - if(!mIsContextCreated) + bool modified = false; + std::string versionString = "#version"; + size_t versionPosition = shader.find(versionString); + if(versionPosition != std::string::npos) { - mContextCreatedWaitCondition.Wait(lock); + std::string extensionString; + size_t shadingLanguageVersionPosition = shader.find_first_not_of(" \t", versionPosition + versionString.length()); + if(shadingLanguageVersionPosition != std::string::npos && + shader.substr(shadingLanguageVersionPosition, 3) == LEGACY_SHADING_LANGUAGE_VERSION) + { + extensionString = OES_EGL_IMAGE_EXTERNAL_STRING; + } + else + { + extensionString = OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3; + } + + if(shader.find(extensionString) == std::string::npos) + { + modified = true; + size_t extensionPosition = shader.find_first_of("\n", versionPosition) + 1; + shader.insert(extensionPosition, extensionString); + } } - if(mShadingLanguageVersion < 300) + else { - return OES_EGL_IMAGE_EXTERNAL_STRING; + if(shader.find(OES_EGL_IMAGE_EXTERNAL_STRING) == std::string::npos) + { + modified = true; + shader = OES_EGL_IMAGE_EXTERNAL_STRING + shader; + } } - else + + if(shader.find(customSamplerType) == std::string::npos) { - return OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3; + size_t pos = shader.find(DEFAULT_SAMPLER_TYPE); + if(pos != std::string::npos) + { + modified = true; + shader.replace(pos, strlen(DEFAULT_SAMPLER_TYPE), customSamplerType); + } } + + return modified; } /* OpenGL ES 2.0 */ 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 0754ecf..9584864 100644 --- a/dali/internal/imaging/android/native-image-source-impl-android.cpp +++ b/dali/internal/imaging/android/native-image-source-impl-android.cpp @@ -308,6 +308,11 @@ const char* NativeImageSourceAndroid::GetCustomFragmentPrefix() const return nullptr; } +bool NativeImageSourceAndroid::ApplyNativeFragmentShader(std::string& shader) +{ + return false; +} + const char* NativeImageSourceAndroid::GetCustomSamplerTypename() const { return nullptr; diff --git a/dali/internal/imaging/android/native-image-source-impl-android.h b/dali/internal/imaging/android/native-image-source-impl-android.h index 04e44bc..6cb21b8 100644 --- a/dali/internal/imaging/android/native-image-source-impl-android.h +++ b/dali/internal/imaging/android/native-image-source-impl-android.h @@ -135,6 +135,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageSource::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageSource::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp b/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp index 5df59b4..436fdd3 100644 --- a/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp +++ b/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp @@ -33,12 +33,6 @@ namespace Internal { namespace Adaptor { -namespace -{ -const char* FRAGMENT_PREFIX = "\n"; -const char* SAMPLER_TYPE = "sampler2D"; - -} // namespace NativeImageSourceQueueAndroid* NativeImageSourceQueueAndroid::New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue) { @@ -92,12 +86,17 @@ void NativeImageSourceQueueAndroid::PrepareTexture() const char* NativeImageSourceQueueAndroid::GetCustomFragmentPrefix() const { - return FRAGMENT_PREFIX; + return nullptr; +} + +bool NativeImageSourceQueueAndroid::ApplyNativeFragmentShader(std::string& shader) +{ + return false; } const char* NativeImageSourceQueueAndroid::GetCustomSamplerTypename() const { - return SAMPLER_TYPE; + return nullptr; } int NativeImageSourceQueueAndroid::GetTextureTarget() const diff --git a/dali/internal/imaging/android/native-image-source-queue-impl-android.h b/dali/internal/imaging/android/native-image-source-queue-impl-android.h index 92766b9..7e96038 100644 --- a/dali/internal/imaging/android/native-image-source-queue-impl-android.h +++ b/dali/internal/imaging/android/native-image-source-queue-impl-android.h @@ -127,6 +127,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp b/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp index 24a15ff..e754cdb 100644 --- a/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp +++ b/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp @@ -115,6 +115,11 @@ const char* NativeBitmapBuffer::GetCustomFragmentPrefix() const return nullptr; } +bool NativeBitmapBuffer::ApplyNativeFragmentShader(std::string& shader) +{ + return false; +} + const char* NativeBitmapBuffer::GetCustomSamplerTypename() const { return nullptr; diff --git a/dali/internal/imaging/common/native-bitmap-buffer-impl.h b/dali/internal/imaging/common/native-bitmap-buffer-impl.h index 5527fd4..2166c17 100644 --- a/dali/internal/imaging/common/native-bitmap-buffer-impl.h +++ b/dali/internal/imaging/common/native-bitmap-buffer-impl.h @@ -113,6 +113,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/internal/imaging/common/native-image-source-impl.h b/dali/internal/imaging/common/native-image-source-impl.h index f2d3295..077b9e0 100644 --- a/dali/internal/imaging/common/native-image-source-impl.h +++ b/dali/internal/imaging/common/native-image-source-impl.h @@ -120,6 +120,11 @@ public: virtual const char* GetCustomFragmentPrefix() const = 0; /** + * @copydoc Dali::NativeImageSource::ApplyNativeFragmentShader() + */ + virtual bool ApplyNativeFragmentShader(std::string& shader) = 0; + + /** * @copydoc Dali::NativeImageSource::GetCustomSamplerTypename() */ virtual const char* GetCustomSamplerTypename() const = 0; diff --git a/dali/internal/imaging/common/native-image-source-queue-impl.h b/dali/internal/imaging/common/native-image-source-queue-impl.h index 00ccbfc..612d49d 100644 --- a/dali/internal/imaging/common/native-image-source-queue-impl.h +++ b/dali/internal/imaging/common/native-image-source-queue-impl.h @@ -104,6 +104,11 @@ public: virtual const char* GetCustomFragmentPrefix() const = 0; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + virtual bool ApplyNativeFragmentShader(std::string& shader) = 0; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ virtual const char* GetCustomSamplerTypename() const = 0; diff --git a/dali/internal/imaging/macos/native-image-source-impl-mac.cpp b/dali/internal/imaging/macos/native-image-source-impl-mac.cpp index 5b80733..c0abb5d 100644 --- a/dali/internal/imaging/macos/native-image-source-impl-mac.cpp +++ b/dali/internal/imaging/macos/native-image-source-impl-mac.cpp @@ -159,6 +159,11 @@ const char* NativeImageSourceCocoa::GetCustomFragmentPrefix() const return nullptr; } +bool NativeImageSourceCocoa::ApplyNativeFragmentShader(std::string& shader) +{ + return false; +} + const char* NativeImageSourceCocoa::GetCustomSamplerTypename() const { return nullptr; diff --git a/dali/internal/imaging/macos/native-image-source-impl-mac.h b/dali/internal/imaging/macos/native-image-source-impl-mac.h index bd0e41b..a70f33c 100644 --- a/dali/internal/imaging/macos/native-image-source-impl-mac.h +++ b/dali/internal/imaging/macos/native-image-source-impl-mac.h @@ -119,6 +119,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; 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 16a5720..b3afaaa 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -38,7 +38,8 @@ namespace Adaptor { namespace { -const char* SAMPLER_TYPE = "samplerExternalOES"; +const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n"; +const char* SAMPLER_TYPE = "samplerExternalOES"; // clang-format off tbm_format FORMATS_BLENDING_REQUIRED[] = { @@ -74,8 +75,7 @@ NativeImageSourceTizen* NativeImageSourceTizen::New(uint32_t width, uint32_t hei } NativeImageSourceTizen::NativeImageSourceTizen(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) -: mCustomFragmentPrefix(), - mWidth(width), +: mWidth(width), mHeight(height), mOwnTbmSurface(false), mTbmSurface(NULL), @@ -94,8 +94,6 @@ 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) @@ -464,7 +462,12 @@ void NativeImageSourceTizen::PrepareTexture() const char* NativeImageSourceTizen::GetCustomFragmentPrefix() const { - return mCustomFragmentPrefix; + return FRAGMENT_PREFIX; +} + +bool NativeImageSourceTizen::ApplyNativeFragmentShader(std::string& shader) +{ + return mEglGraphics->ApplyNativeFragmentShader(shader, SAMPLER_TYPE); } 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 2fa10a8..7436a33 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h @@ -131,6 +131,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader(std::string& shader) + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; @@ -190,10 +195,9 @@ private: void DestroySurface(); private: - const char* mCustomFragmentPrefix; ///< Prefix for CustomFragment - uint32_t mWidth; ///< image width - uint32_t mHeight; ///< image height - bool mOwnTbmSurface; ///< Whether we created pixmap or not + 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 7f72939..e16fbc2 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,7 +38,8 @@ namespace { #define TBM_SURFACE_QUEUE_SIZE 3 -const char* SAMPLER_TYPE = "samplerExternalOES"; +const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n"; +const char* SAMPLER_TYPE = "samplerExternalOES"; // clang-format off int FORMATS_BLENDING_REQUIRED[] = { @@ -72,8 +73,7 @@ NativeImageSourceQueueTizen* NativeImageSourceQueueTizen::New(uint32_t width, ui } NativeImageSourceQueueTizen::NativeImageSourceQueueTizen(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue) -: mCustomFragmentPrefix(), - mMutex(), +: mMutex(), mWidth(width), mHeight(height), mTbmQueue(NULL), @@ -89,8 +89,6 @@ 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) @@ -282,7 +280,12 @@ void NativeImageSourceQueueTizen::PrepareTexture() const char* NativeImageSourceQueueTizen::GetCustomFragmentPrefix() const { - return mCustomFragmentPrefix; + return FRAGMENT_PREFIX; +} + +bool NativeImageSourceQueueTizen::ApplyNativeFragmentShader(std::string& shader) +{ + return mEglGraphics->ApplyNativeFragmentShader(shader, SAMPLER_TYPE); } 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 5702eaf..ae2bf8d 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 @@ -123,6 +123,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; @@ -171,17 +176,16 @@ private: private: typedef std::pair EglImagePair; - 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 + 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 diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp index bb41acd..45afbed 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp @@ -362,6 +362,11 @@ const char* NativeImageSourceX::GetCustomFragmentPrefix() const return nullptr; } +bool NativeImageSourceX::ApplyNativeFragmentShader(std::string& shader) +{ + return false; +} + const char* NativeImageSourceX::GetCustomSamplerTypename() const { return nullptr; diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h index 3c3dc1e..ba132b9 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h @@ -135,6 +135,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageSource::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageSource::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp index 257e0f6..e7d77fb 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp @@ -36,10 +36,6 @@ namespace Adaptor namespace { #define TBM_SURFACE_QUEUE_SIZE 3 - -const char* FRAGMENT_PREFIX = "\n"; -const char* SAMPLER_TYPE = "sampler2D"; - } // namespace NativeImageSourceQueueX* NativeImageSourceQueueX::New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue) @@ -94,12 +90,17 @@ void NativeImageSourceQueueX::PrepareTexture() const char* NativeImageSourceQueueX::GetCustomFragmentPrefix() const { - return FRAGMENT_PREFIX; + return nullptr; +} + +bool NativeImageSourceQueueX::ApplyNativeFragmentShader(std::string& shader) +{ + return false; } const char* NativeImageSourceQueueX::GetCustomSamplerTypename() const { - return SAMPLER_TYPE; + return nullptr; } int NativeImageSourceQueueX::GetTextureTarget() const diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h index 50a1452..b119cb0 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h @@ -124,6 +124,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.cpp b/dali/internal/imaging/windows/native-image-source-impl-win.cpp index 02c5fdf..ce0189b 100644 --- a/dali/internal/imaging/windows/native-image-source-impl-win.cpp +++ b/dali/internal/imaging/windows/native-image-source-impl-win.cpp @@ -233,6 +233,11 @@ const char* NativeImageSourceWin::GetCustomFragmentPrefix() const return nullptr; } +bool NativeImageSourceWin::ApplyNativeFragmentShader(std::string& shader) +{ + return false; +} + const char* NativeImageSourceWin::GetCustomSamplerTypename() const { return nullptr; diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.h b/dali/internal/imaging/windows/native-image-source-impl-win.h index e17503e..e47f306 100644 --- a/dali/internal/imaging/windows/native-image-source-impl-win.h +++ b/dali/internal/imaging/windows/native-image-source-impl-win.h @@ -125,6 +125,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; diff --git a/dali/public-api/adaptor-framework/native-image-source.cpp b/dali/public-api/adaptor-framework/native-image-source.cpp index d5de092..2f528e0 100644 --- a/dali/public-api/adaptor-framework/native-image-source.cpp +++ b/dali/public-api/adaptor-framework/native-image-source.cpp @@ -110,6 +110,11 @@ const char* NativeImageSource::GetCustomFragmentPrefix() const return mImpl->GetCustomFragmentPrefix(); } +bool NativeImageSource::ApplyNativeFragmentShader(std::string& shader) +{ + return mImpl->ApplyNativeFragmentShader(shader); +} + const char* NativeImageSource::GetCustomSamplerTypename() const { return mImpl->GetCustomSamplerTypename(); diff --git a/dali/public-api/adaptor-framework/native-image-source.h b/dali/public-api/adaptor-framework/native-image-source.h index 9c0f89f..2e0e8d1 100644 --- a/dali/public-api/adaptor-framework/native-image-source.h +++ b/dali/public-api/adaptor-framework/native-image-source.h @@ -162,6 +162,11 @@ public: const char* GetCustomFragmentPrefix() const override; /** + * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader() + */ + bool ApplyNativeFragmentShader(std::string& shader) override; + + /** * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() */ const char* GetCustomSamplerTypename() const override; -- 2.7.4