remove indirection in vertex builder

This commit is contained in:
veclavtalica
2025-01-17 22:48:35 +03:00
parent 40aef0a1f9
commit 8a5d639f95
8 changed files with 53 additions and 85 deletions

View File

@ -37,9 +37,7 @@ enum {
typedef uint32_t VertexBuffer;
typedef struct VertexBufferBuilder {
size_t bytes_left;
size_t size;
void *mapping;
void *base;
} VertexBufferBuilder;
@ -271,10 +269,7 @@ void specify_vertex_buffer(VertexBuffer buffer, void const *data, size_t bytes);
/* uses present in 1.5 buffer mapping feature */
VertexBufferBuilder build_vertex_buffer(VertexBuffer buffer, size_t bytes);
/* collects bytes for sending to the gpu until all is pushed, which is when false is returned */
bool push_to_vertex_buffer_builder(VertexBufferBuilder *builder,
void const *bytes,
size_t size);
void finish_vertex_builder(VertexBufferBuilder *builder);
/* state */
@ -301,7 +296,8 @@ void finally_render_quads(Primitive2D const primitives[],
size_t get_quad_payload_size(struct QuadBatch batch);
bool push_quad_payload_to_vertex_buffer_builder(struct QuadBatch batch,
void push_quad_payload_to_vertex_buffer_builder(struct QuadBatch batch,
size_t index,
VertexBufferBuilder *builder,
Vec2 v0, Vec2 v1, Vec2 v2, Vec2 v3,
Vec2 uv0, Vec2 uv1, Vec2 uv2, Vec2 uv3,
@ -313,12 +309,6 @@ void finally_draw_uncolored_space_traingle_batch(MeshBatch const *batch,
void finally_draw_billboard_batch(MeshBatch const *batch,
TextureKey texture_key);
size_t get_text_payload_size(void);
bool push_text_payload_to_vertex_buffer_builder(FontData const *font_data,
VertexBufferBuilder *builder,
stbtt_aligned_quad quad);
void finally_draw_text(FontData const *font_data,
size_t len,
Color color,