Memory Pool Logging
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / gles-graphics-command-buffer.cpp
index 177b6b9..bc463ab 100644 (file)
@@ -65,7 +65,7 @@ class CommandPool
     inline void resize(int newSize)
     {
       ptr      = reinterpret_cast<T*>(realloc(ptr, newSize * sizeof(T)));
-      capacity = newSize;
+      capacity = newSize * sizeof(T);
       dataSize = newSize;
     }
 
@@ -224,6 +224,11 @@ public:
     size = commandPool.size;
     return commandPool.data.ptr;
   }
+
+  std::size_t GetTotalCapacity() const
+  {
+    return commandPool.data.capacity + memoryPool.data.capacity;
+  }
 };
 
 CommandBuffer::CommandBuffer(const Graphics::CommandBufferCreateInfo& createInfo, EglGraphicsController& controller)
@@ -239,7 +244,7 @@ void CommandBuffer::BindVertexBuffers(uint32_t
                                       const std::vector<uint32_t>&                offsets)
 {
   auto command                                         = mCommandPool->AllocateCommand(CommandType::BIND_VERTEX_BUFFERS);
-  command->bindVertexBuffers.vertexBufferBindingsCount = firstBinding + buffers.size();
+  command->bindVertexBuffers.vertexBufferBindingsCount = firstBinding + static_cast<uint32_t>(buffers.size());
   auto pBindings                                       = mCommandPool->Allocate<GLES::VertexBufferBindingDescriptor>(firstBinding + buffers.size());
 
   command->bindVertexBuffers.vertexBufferBindings = pBindings;
@@ -558,4 +563,14 @@ void CommandBuffer::DiscardResource()
   GetController().DiscardResource(this);
 }
 
+std::size_t CommandBuffer::GetCapacity()
+{
+  std::size_t total{0u};
+  if(mCommandPool)
+  {
+    total = mCommandPool->GetTotalCapacity();
+  }
+  return total;
+}
+
 } // namespace Dali::Graphics::GLES