Fix CreateShader() for use EffectMap 92/235292/3
authorSunghyun Kim <scholb.kim@samsung.com>
Wed, 3 Jun 2020 10:07:54 +0000 (19:07 +0900)
committerSunghyun Kim <scholb.kim@samsung.com>
Thu, 4 Jun 2020 05:54:01 +0000 (14:54 +0900)
SetEffectPropertyMap is not working when application use
samplerExternalOES in custom shader.
so i modified to replace the shader only if appropriate

Change-Id: Id610dc03ebe0b043f013e11899090378298169a6

widget_viewer_dali/internal/widget_view/widget_view_impl.cpp

index cc3511c934630c1135ca866abf437713d44d4610..8419d1fb21ce314354602c6f7d5c8992b2b1e620 100644 (file)
@@ -1596,7 +1596,11 @@ Dali::Shader WidgetView::CreateShader()
         DALI_LOG_ERROR( "'%s' parameter does not correctly specify a string\n", CUSTOM_FRAGMENT_SHADER );
       }
       fragmentShader += customFragmentShader;
-      fragmentShader.replace( fragmentShader.find( DEFAULT_SAMPLER_TYPE_NAME ), strlen( DEFAULT_SAMPLER_TYPE_NAME ), CUSTOM_SAMPLER_TYPE_NAME );
+      std::size_t found = fragmentShader.find( DEFAULT_SAMPLER_TYPE_NAME );
+      if( found != std::string::npos )
+      {
+        fragmentShader.replace( found , strlen( DEFAULT_SAMPLER_TYPE_NAME ), CUSTOM_SAMPLER_TYPE_NAME );
+      }
     }
     else
     {