Batch #11872 by StrawberrysherbetIX: 1 byte-identical, 1 confirmed by peer review. - fn_02079 CRenderer::ClearFrame: byte-identical (already on main) - fn_17537 RenderVertexPool::Acquire: logic confirmed by peer review (already on main) Peer-reviewed-by: Yommy, KWDev Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#ifndef RAGNAROK_SOURCE_RENDER_PRIMITIVES_RENDERVERTEXPOOL_H
|
|
#define RAGNAROK_SOURCE_RENDER_PRIMITIVES_RENDERVERTEXPOOL_H
|
|
|
|
#include "Render/Primitives/RenderPrimitive.h"
|
|
|
|
#include <forward_list>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
class RenderVertexPool {
|
|
public:
|
|
// INLINED
|
|
RenderVertexPool() : m_minimum(10240), m_used(0) {
|
|
this->Activate(this->m_minimum);
|
|
}
|
|
|
|
~RenderVertexPool();
|
|
RenderVertex* Acquire(unsigned count);
|
|
void Rewind();
|
|
|
|
private:
|
|
struct Block : std::vector<RenderVertex> {
|
|
RenderVertex* Append(unsigned count);
|
|
};
|
|
|
|
/* 0000 */ unsigned m_minimum;
|
|
/* 0004 */ unsigned m_used;
|
|
/* 0008 */ std::forward_list<Block*> m_active;
|
|
/* 000C */ std::forward_list<Block*> m_unused;
|
|
Block& Activate(unsigned capacity);
|
|
void Release();
|
|
};
|
|
|
|
// INLINED
|
|
inline void RenderVertexPool::Rewind() {
|
|
for (auto& block : this->m_active) {
|
|
block->clear();
|
|
}
|
|
|
|
this->m_unused.splice_after(this->m_unused.before_begin(), this->m_active);
|
|
this->m_used = 0;
|
|
this->Activate(this->m_minimum);
|
|
}
|
|
|
|
#if defined(_WIN32) && !defined(_WIN64)
|
|
static_assert(sizeof(RenderVertexPool) == 16);
|
|
#endif
|
|
|
|
#endif
|