[Tizen] Allow to set empty data for vertex buffer 56/317356/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 31 Dec 2024 05:50:11 +0000 (14:50 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 31 Dec 2024 05:52:56 +0000 (14:52 +0900)
Change-Id: Ife70c7b0a033c883f16a7d36decf1b81c05267d5
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/event/rendering/vertex-buffer-impl.cpp
dali/internal/render/renderers/render-vertex-buffer.cpp

index 90f378bcc488d23397124e9d9d66cac52f5d91b9..7666908a54b99cab87acfdb7f209236b1b674f4a 100644 (file)
@@ -157,10 +157,13 @@ void VertexBuffer::SetData(const void* data, uint32_t size)
   OwnerPointer<Vector<uint8_t> > bufferCopy = new Dali::Vector<uint8_t>();
   bufferCopy->ResizeUninitialized(bufferSize);
 
-  // copy the data
-  const uint8_t* source      = static_cast<const uint8_t*>(data);
-  uint8_t*       destination = &((*bufferCopy)[0]);
-  std::copy(source, source + bufferSize, destination);
+  if(DALI_LIKELY(bufferSize > 0u))
+  {
+    // copy the data
+    const uint8_t* source      = static_cast<const uint8_t*>(data);
+    uint8_t*       destination = &((*bufferCopy)[0]);
+    std::copy(source, source + bufferSize, destination);
+  }
 
   // Ownership of the bufferCopy is passed to the message ( uses an owner pointer )
   SceneGraph::SetVertexBufferData(GetEventThreadServices().GetUpdateManager(), *mRenderObject, bufferCopy, mSize);
index d899f7be43b2a41b85bc34fc739d0286d061da66..89dc0dbcfeccd138c6945e204647fc36ada5aa75 100644 (file)
@@ -66,7 +66,7 @@ bool VertexBuffer::Update(Graphics::Controller& graphicsController)
     return false;
   }
 
-  if(!mVertexBufferUpdateCallback && !mData)
+  if(!mVertexBufferUpdateCallback && (!mData || mData->Empty()))
   {
     return false;
   }
@@ -79,7 +79,7 @@ bool VertexBuffer::Update(Graphics::Controller& graphicsController)
     }
 
     // Update the GpuBuffer
-    if(mGpuBuffer && mData)
+    if(mGpuBuffer && mData && !mData->Empty())
     {
       DALI_ASSERT_DEBUG(mSize && "No data in the property buffer!");
       mGpuBuffer->UpdateDataBuffer(graphicsController, GetDataSize(), &((*mData)[0]));