inline void resize(int newSize)
{
ptr = reinterpret_cast<T*>(realloc(ptr, newSize * sizeof(T)));
- capacity = newSize;
+ capacity = newSize * sizeof(T);
dataSize = newSize;
}
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)
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;
cmd.drawIndexedIndirect.stride = stride;
}
+void CommandBuffer::DrawNative(const DrawNativeInfo* drawNativeInfo)
+{
+ auto command = mCommandPool->AllocateCommand(CommandType::DRAW_NATIVE);
+ auto& cmd = command->drawNative;
+ memcpy(&cmd.drawNativeInfo, drawNativeInfo, sizeof(DrawNativeInfo));
+}
+
void CommandBuffer::Reset()
{
mCommandPool->Rollback(false);
GetController().DiscardResource(this);
}
+std::size_t CommandBuffer::GetCapacity()
+{
+ std::size_t total{0u};
+ if(mCommandPool)
+ {
+ total = mCommandPool->GetTotalCapacity();
+ }
+ return total;
+}
+
} // namespace Dali::Graphics::GLES