[Tizen](Scene3D) Do not cache custom created color pixel data 47/316347/3 accepted/tizen/8.0/unified/20241113.152843
authorEunkiki Hong <eunkiki.hong@samsung.com>
Wed, 7 Aug 2024 06:27:57 +0000 (15:27 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Wed, 30 Oct 2024 06:02:40 +0000 (06:02 +0000)
Since if we create pixeldata with upload release, it might be
inside of image-loader cache system.

Since we don't consider that given PixelData is not in cache system,
it might be crash system.

Change-Id: I39ee5c7c2b0b11ac8ddcac31e89a94223d08701b
Signed-off-by: Eunkiki Hong <eunkiki.hong@samsung.com>
dali-scene3d/public-api/loader/material-definition.cpp

index 52028bf026a2a2df149b98a88d79fdb0eb123bf5..45e4233f1810c2e4cdbb64efbf5ef138284151fa 100644 (file)
@@ -201,7 +201,8 @@ MaterialDefinition::LoadRaw(const std::string& imagesPath)
 
   // Load textures
   auto iTexture   = mTextureStages.begin();
-  auto checkStage = [&](uint32_t flags) {
+  auto checkStage = [&](uint32_t flags)
+  {
     return iTexture != mTextureStages.end() && MaskMatch(iTexture->mSemantic, flags);
   };
 
@@ -252,7 +253,7 @@ MaterialDefinition::LoadRaw(const std::string& imagesPath)
       buffer[0] = static_cast<uint8_t>(mColor.r * 255.f);
       buffer[1] = static_cast<uint8_t>(mColor.g * 255.f);
       buffer[2] = static_cast<uint8_t>(mColor.b * 255.f);
-      raw.mTextures.push_back({Dali::Integration::NewPixelDataWithReleaseAfterUpload(buffer, bufferSize, 1, 1, 0, format, PixelData::DELETE_ARRAY), GetSingleValueSampler()});
+      raw.mTextures.push_back({Dali::PixelData::New(buffer, bufferSize, 1, 1, format, PixelData::DELETE_ARRAY), GetSingleValueSampler()});
     }
 
     // If we have transparency, or an image based albedo map, we will have to continue with separate metallicRoughness + normal.
@@ -384,7 +385,8 @@ TextureSet MaterialDefinition::Load(const EnvironmentDefinition::Vector& environ
 
 bool MaterialDefinition::CheckTextures(uint32_t flags) const
 {
-  return std::find_if(mTextureStages.begin(), mTextureStages.end(), [flags](const TextureStage& ts) { return MaskMatch(ts.mSemantic, flags); }) != mTextureStages.end();
+  return std::find_if(mTextureStages.begin(), mTextureStages.end(), [flags](const TextureStage& ts)
+                      { return MaskMatch(ts.mSemantic, flags); }) != mTextureStages.end();
 }
 
 } // namespace Loader