Refactor Buffer internals.

Allows buffers created with love.graphics.newBuffer to only allocate VRAM data. Previously they had a copy of their contents in RAM.
Also makes it easier to implement Buffers in other graphics APIs and to implement more types of Buffers in the future.
This commit is contained in:
Alex Szpakowski
2020-12-22 19:23:02 -04:00
parent a1861a8ff4
commit 1f9d98263d
23 changed files with 504 additions and 523 deletions
+11 -8
View File
@@ -22,6 +22,7 @@
// LOVE
#include "common/config.h"
#include "common/Range.h"
#include "Drawable.h"
#include "Font.h"
#include "Buffer.h"
@@ -73,9 +74,9 @@ private:
Font::ColoredCodepoints codepoints;
float wrap;
Font::AlignMode align;
Font::TextInfo text_info;
bool use_matrix;
bool append_vertices;
Font::TextInfo textInfo;
bool useMatrix;
bool appendVertices;
Matrix4 matrix;
};
@@ -88,16 +89,18 @@ private:
VertexAttributes vertexAttributes;
BufferBindings vertexBuffers;
StrongRef<Buffer> vertex_buffer;
StrongRef<Buffer> vertexBuffer;
uint8 *vertexData;
Range modifiedVertices;
std::vector<Font::DrawCommand> draw_commands;
std::vector<Font::DrawCommand> drawCommands;
std::vector<TextData> text_data;
std::vector<TextData> textData;
size_t vert_offset;
size_t vertOffset;
// Used so we know when the font's texture cache is invalidated.
uint32 texture_cache_id;
uint32 textureCacheID;
}; // Text