/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Internal
{
-
namespace SceneGraph
{
-
RenderInstructionContainer::RenderInstructionContainer()
: mInstructions{}
{
}
-RenderInstructionContainer::~RenderInstructionContainer()
-{
-}
+RenderInstructionContainer::~RenderInstructionContainer() = default;
-void RenderInstructionContainer::ResetAndReserve( BufferIndex bufferIndex, uint32_t capacityRequired )
+void RenderInstructionContainer::ResetAndReserve(BufferIndex bufferIndex, uint32_t capacityRequired)
{
// Only re-allocate if necessary.
- if( mInstructions.size() < capacityRequired )
+ if(mInstructions.size() < capacityRequired)
{
- mInstructions.reserve( capacityRequired );
+ mInstructions.reserve(capacityRequired);
}
mInstructions.clear();
}
-uint32_t RenderInstructionContainer::Count( BufferIndex bufferIndex )
+uint32_t RenderInstructionContainer::Count(BufferIndex bufferIndex)
{
- return static_cast<uint32_t>( mInstructions.size() );
+ return static_cast<uint32_t>(mInstructions.size());
}
-RenderInstruction& RenderInstructionContainer::At( BufferIndex bufferIndex, uint32_t index )
+RenderInstruction& RenderInstructionContainer::At(BufferIndex bufferIndex, uint32_t index)
{
- DALI_ASSERT_DEBUG( index < mInstructions.size() );
+ DALI_ASSERT_DEBUG(index < mInstructions.size());
- return *mInstructions[ index ];
+ return *mInstructions[index];
}
-void RenderInstructionContainer::PushBack( BufferIndex bufferIndex, RenderInstruction* renderInstruction )
+void RenderInstructionContainer::PushBack(BufferIndex bufferIndex, RenderInstruction* renderInstruction)
{
- mInstructions.push_back( renderInstruction );
+ mInstructions.push_back(renderInstruction);
}
-void RenderInstructionContainer::DiscardCurrentInstruction( BufferIndex updateBufferIndex )
+std::size_t RenderInstructionContainer::GetCapacity() const
{
- mInstructions.pop_back();
+ std::size_t capacity{0};
+ for(auto& el : mInstructions)
+ {
+ capacity += el->GetCapacity();
+ }
+ capacity += mInstructions.size() * sizeof(RenderInstruction*);
+ return capacity;
}
} // namespace SceneGraph