Minor optimization for image visaul and texture manager 99/300799/5
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 2 Nov 2023 08:23:35 +0000 (17:23 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 8 Nov 2023 11:04:02 +0000 (20:04 +0900)
- Set texture index ordered bigger to smaller

Since we reserve the size of textureset internally,
set index bigger to smaller is more faster than else.

- Disconnect ObserverDestroyed what loadqueue connected

To avoid useless duplicated connection, let we disconnect
observer destroyed signal before process load queue.

Change-Id: I516406bcad2005ba628b3890fbc814df9c1a5e29
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/texture-manager/texture-manager-impl.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/npatch/npatch-visual.cpp

index 0c3e3dd824e9714a271b9b55ee064022c59f146b..a18b54b16b8b96a895c9a7f0de0ff19fced3fd6d 100644 (file)
@@ -990,6 +990,9 @@ void TextureManager::ProcessLoadQueue()
       {
         if(element.mObserver)
         {
+          DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Verbose, "  Disconnect DestructionSignal to observer:%p\n", element.mObserver);
+          element.mObserver->DestructionSignal().Disconnect(this, &TextureManager::ObserverDestroyed);
+
           EmitLoadComplete(element.mObserver, textureInfo, true);
         }
       }
index fd0f2b73e3f1febaadc69330bafa1c19180c221f..fe7ebd6d80521ac480dd062d38c6e976fe28e9fe 100644 (file)
@@ -104,31 +104,31 @@ constexpr uint32_t TEXTURE_COUNT_FOR_GPU_ALPHA_MASK = 2u;
 struct NameIndexMatch
 {
   const char* const name;
-  Property::Index  index;
+  Property::Index   index;
 };
 
 const NameIndexMatch NAME_INDEX_MATCH_TABLE[] =
-{
-  {IMAGE_FITTING_MODE, Toolkit::ImageVisual::Property::FITTING_MODE},
-  {IMAGE_SAMPLING_MODE, Toolkit::ImageVisual::Property::SAMPLING_MODE},
-  {IMAGE_DESIRED_WIDTH, Toolkit::ImageVisual::Property::DESIRED_WIDTH},
-  {IMAGE_DESIRED_HEIGHT, Toolkit::ImageVisual::Property::DESIRED_HEIGHT},
-  {PIXEL_AREA_UNIFORM_NAME, Toolkit::ImageVisual::Property::PIXEL_AREA},
-  {IMAGE_WRAP_MODE_U, Toolkit::ImageVisual::Property::WRAP_MODE_U},
-  {IMAGE_WRAP_MODE_V, Toolkit::ImageVisual::Property::WRAP_MODE_V},
-  {SYNCHRONOUS_LOADING, Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING},
-  {IMAGE_ATLASING, Toolkit::ImageVisual::Property::ATLASING},
-  {ALPHA_MASK_URL, Toolkit::ImageVisual::Property::ALPHA_MASK_URL},
-  {MASK_CONTENT_SCALE_NAME, Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE},
-  {CROP_TO_MASK_NAME, Toolkit::ImageVisual::Property::CROP_TO_MASK},
-  {MASKING_TYPE_NAME, Toolkit::DevelImageVisual::Property::MASKING_TYPE},
-  {ENABLE_BROKEN_IMAGE, Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE},
-  {LOAD_POLICY_NAME, Toolkit::ImageVisual::Property::LOAD_POLICY},
-  {RELEASE_POLICY_NAME, Toolkit::ImageVisual::Property::RELEASE_POLICY},
-  {ORIENTATION_CORRECTION_NAME, Toolkit::ImageVisual::Property::ORIENTATION_CORRECTION},
-  {FAST_TRACK_UPLOADING_NAME, Toolkit::DevelImageVisual::Property::FAST_TRACK_UPLOADING},
+  {
+    {IMAGE_FITTING_MODE, Toolkit::ImageVisual::Property::FITTING_MODE},
+    {IMAGE_SAMPLING_MODE, Toolkit::ImageVisual::Property::SAMPLING_MODE},
+    {IMAGE_DESIRED_WIDTH, Toolkit::ImageVisual::Property::DESIRED_WIDTH},
+    {IMAGE_DESIRED_HEIGHT, Toolkit::ImageVisual::Property::DESIRED_HEIGHT},
+    {PIXEL_AREA_UNIFORM_NAME, Toolkit::ImageVisual::Property::PIXEL_AREA},
+    {IMAGE_WRAP_MODE_U, Toolkit::ImageVisual::Property::WRAP_MODE_U},
+    {IMAGE_WRAP_MODE_V, Toolkit::ImageVisual::Property::WRAP_MODE_V},
+    {SYNCHRONOUS_LOADING, Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING},
+    {IMAGE_ATLASING, Toolkit::ImageVisual::Property::ATLASING},
+    {ALPHA_MASK_URL, Toolkit::ImageVisual::Property::ALPHA_MASK_URL},
+    {MASK_CONTENT_SCALE_NAME, Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE},
+    {CROP_TO_MASK_NAME, Toolkit::ImageVisual::Property::CROP_TO_MASK},
+    {MASKING_TYPE_NAME, Toolkit::DevelImageVisual::Property::MASKING_TYPE},
+    {ENABLE_BROKEN_IMAGE, Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE},
+    {LOAD_POLICY_NAME, Toolkit::ImageVisual::Property::LOAD_POLICY},
+    {RELEASE_POLICY_NAME, Toolkit::ImageVisual::Property::RELEASE_POLICY},
+    {ORIENTATION_CORRECTION_NAME, Toolkit::ImageVisual::Property::ORIENTATION_CORRECTION},
+    {FAST_TRACK_UPLOADING_NAME, Toolkit::DevelImageVisual::Property::FAST_TRACK_UPLOADING},
 };
-const int NAME_INDEX_MATCH_TABLE_SIZE = sizeof(NAME_INDEX_MATCH_TABLE)/sizeof(NAME_INDEX_MATCH_TABLE[0]);
+const int NAME_INDEX_MATCH_TABLE_SIZE = sizeof(NAME_INDEX_MATCH_TABLE) / sizeof(NAME_INDEX_MATCH_TABLE[0]);
 
 Geometry CreateGeometry(VisualFactoryCache& factoryCache, ImageDimensions gridSize)
 {
@@ -137,7 +137,8 @@ Geometry CreateGeometry(VisualFactoryCache& factoryCache, ImageDimensions gridSi
   if(gridSize == ImageDimensions(1, 1))
   {
     geometry = factoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
-  } else
+  }
+  else
   {
     geometry = VisualFactoryCache::CreateGridGeometry(gridSize);
   }
@@ -679,9 +680,9 @@ void ImageVisual::LoadTexture(bool& atlasing, Vector4& atlasRect, TextureSet& te
     else
     {
       DALI_ASSERT_ALWAYS(mFastTrackLoadingTask->mTextures.size() >= 3u);
-      textureSet.SetTexture(0u, mFastTrackLoadingTask->mTextures[0]);
-      textureSet.SetTexture(1u, mFastTrackLoadingTask->mTextures[1]);
       textureSet.SetTexture(2u, mFastTrackLoadingTask->mTextures[2]);
+      textureSet.SetTexture(1u, mFastTrackLoadingTask->mTextures[1]);
+      textureSet.SetTexture(0u, mFastTrackLoadingTask->mTextures[0]);
 
       // We cannot determine what kind of shader will be used.
       // Just use unified shader, and then change shader after load completed.
index e469297a904c6d07f4a1f4e95db840bd2e284784..b42bd3b05449b6fbd94d4ed526ddb3115bb65ef6 100644 (file)
@@ -505,8 +505,8 @@ void NPatchVisual::ApplyTextureAndUniforms()
       // If we call textureSet.SetTexture(1, texture) directly, the cached TextureSet also be changed.
       // We should make pass utc-Dali-VisualFactory.cpp UtcDaliNPatchVisualAuxiliaryImage02().
       TextureSet tempTextureSet = TextureSet::New();
-      tempTextureSet.SetTexture(0, textureSet.GetTexture(0));
       tempTextureSet.SetTexture(1, mAuxiliaryTextureSet.GetTexture(0));
+      tempTextureSet.SetTexture(0, textureSet.GetTexture(0));
       textureSet = tempTextureSet;
 
       mImpl->mRenderer.RegisterProperty(DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA,