Introduce Global Font Memory allocator
This commit is contained in:
@@ -11,24 +11,26 @@ namespace JabyEngine {
|
||||
FontWriter::write(state, str, color, wiggle, list); \
|
||||
va_end(list)
|
||||
|
||||
FontBufferInfo prim_buffer;
|
||||
GPU::TexPage::Linked tex_page;
|
||||
FontPrimitive* cur_primitive;
|
||||
GPU::SizeI16 font_size;
|
||||
GPU::PageClut clut;
|
||||
GPU::Link* last_primitive;
|
||||
|
||||
void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const GPU::SizeI16& font_size);
|
||||
void setup(const SimpleTIM& vram_dst, const GPU::SizeI16& font_size);
|
||||
|
||||
public:
|
||||
static constexpr FontWriter empty() {
|
||||
FontWriter instance;
|
||||
|
||||
instance.prim_buffer = FontBufferInfo::empty();
|
||||
instance.tex_page = {0};
|
||||
instance.cur_primitive = nullptr;
|
||||
instance.tex_page = {0};
|
||||
instance.font_size = Make::SizeI16();
|
||||
instance.clut = Make::PageClut();
|
||||
instance.last_primitive = nullptr;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const FontInfo& font_info) {
|
||||
FontWriter::setup(buffer_info, vram_dst, Make::SizeI16(font_info.font_size.width, font_info.font_size.height));
|
||||
void setup(const SimpleTIM& vram_dst, const FontInfo& font_info) {
|
||||
FontWriter::setup(vram_dst, Make::SizeI16(font_info.font_size.width, font_info.font_size.height));
|
||||
}
|
||||
|
||||
void write(State& state, const char* str, ...) {
|
||||
@@ -45,4 +47,13 @@ namespace JabyEngine {
|
||||
|
||||
#undef __write_impl
|
||||
};
|
||||
|
||||
struct GlobalFontPrimitivePool {
|
||||
static void setup(FontPrimitive* start, size_t length);
|
||||
|
||||
template<size_t Size>
|
||||
static void setup(FontPrimitive (&buffer)[Size]) {
|
||||
GlobalFontPrimitivePool::setup(buffer, Size);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user