Make to use DevelTexture::ApplyNativeFragmentShader in video-view 24/257624/2
authorseungho <sbsh.baek@samsung.com>
Wed, 28 Apr 2021 09:10:53 +0000 (18:10 +0900)
committerseungho <sbsh.baek@samsung.com>
Thu, 29 Apr 2021 04:09:27 +0000 (13:09 +0900)
 - The extension name could be different for each device.
 - This patch force to use DevelTexture::ApplyNativeFragmentShader to change shader code for the egl image

Change-Id: Ic87f141c62c844af19da93ce652d7b3ee197f0b5
Signed-off-by: seungho <sbsh.baek@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp
dali-toolkit/internal/controls/video-view/video-view-impl.cpp

index 9a77bba..de842bf 100644 (file)
@@ -458,6 +458,36 @@ int UtcDaliVideoViewMethodsForCoverage2(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
+int UtcDaliVideoViewCustomShaderForCoverage3(void)
+{
+  ToolkitTestApplication application;
+  VideoView videoView = VideoView::New();
+  DALI_TEST_CHECK( videoView );
+
+  ToolkitApplication::DECODED_IMAGES_SUPPORTED = true;
+
+  videoView.SetProperty( Toolkit::VideoView::Property::UNDERLAY, false );
+  bool isUnderlay = videoView.GetProperty( Toolkit::VideoView::Property::UNDERLAY ).Get< bool >();
+  DALI_TEST_CHECK( !isUnderlay );
+
+  application.GetScene().Add( videoView );
+  videoView.SetProperty( VideoView::Property::VIDEO, "testvideo" );
+
+  Property::Map customShader;
+  customShader.Insert( "vertexShader", VERTEX_SHADER );
+
+  Property::Map map;
+  map.Insert( "shader", customShader );
+
+  videoView.SetProperty( VideoView::Property::VIDEO, map );
+
+  Property::Map map2;
+  Property::Value value = videoView.GetProperty( VideoView::Property::VIDEO );
+
+  DALI_TEST_CHECK( !value.Get( map2 ) );
+  END_TEST;
+}
+
 int UtcDaliVideoViewPropertyUnderlay(void)
 {
   ToolkitTestApplication application;
 int UtcDaliVideoViewPropertyUnderlay(void)
 {
   ToolkitTestApplication application;
index 85b219e..509426e 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/object/type-registry.h>
+#include <dali/devel-api/rendering/texture-devel.h>
 #include <cstring>
 
 // INTERNAL INCLUDES
 #include <cstring>
 
 // INTERNAL INCLUDES
@@ -869,7 +870,7 @@ void VideoView::PlayAnimation(Dali::Animation animation)
 
 Dali::Shader VideoView::CreateShader()
 {
 
 Dali::Shader VideoView::CreateShader()
 {
-  std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n";
+  std::string fragmentShader;
   std::string vertexShader;
   std::string customFragmentShader;
   bool        checkShader = false;
   std::string vertexShader;
   std::string customFragmentShader;
   bool        checkShader = false;
@@ -900,13 +901,15 @@ Dali::Shader VideoView::CreateShader()
 
     if(!fragmentShaderValue || !checkShader)
     {
 
     if(!fragmentShaderValue || !checkShader)
     {
-      fragmentShader += SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+      fragmentShader = SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+      DevelTexture::ApplyNativeFragmentShader(mNativeTexture, fragmentShader);
     }
   }
   else
   {
     }
   }
   else
   {
-    vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
-    fragmentShader += SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+    vertexShader   = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
+    fragmentShader = SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+    DevelTexture::ApplyNativeFragmentShader(mNativeTexture, fragmentShader);
   }
 
   return Dali::Shader::New(vertexShader, fragmentShader);
   }
 
   return Dali::Shader::New(vertexShader, fragmentShader);