fix(render): bind identity into the epoch, titles into reserved strips, one layout per frame

Four review findings on the Task 7 renderer:

- InstanceStore::epoch() is derived from gl::Buffer::generation() -- advanced by
  every allocation, deletion and move -- plus the slot the instances were written
  to, so the orphan fallback of grow_persistent() can no longer leave the vertex
  array's attribute pointers bound to a deleted buffer: the epoch reports the new
  identity and upload() re-points them before the draw.
- PlotLayout reserves y_title_area/x_title_area outside axes (sized from the text
  metrics) and draw_titles() draws in them, so a title can no longer land on the
  data, whatever the envelope does.
- draw() computes plot.layout() once and hands it to the helpers, instead of six
  times per frame, each of which rebuilt the ticks and the grid.
- A refused fence is no longer dropped: mark_drawn() falls back to the orphan path
  and reports the failure rather than rotating through an unsynchronised slot.

New smoke cases force both refusals through the GL entry points (glMapBufferRange,
glFenceSync) and assert the pixels plus the live transfer mode; the title case
asserts the title colour is absent from the bands inside axes and present in both
strips. All three fail against the pre-fix sources.
This commit is contained in:
Martino Ferrari committed 2026-09-27 23:19:31 +02:00
1 parent 3555ab63d7
commit 8f45108559
11 files changed
+492 -70

No files matched your search

+6
View File
@@ -93,6 +93,7 @@ bool Buffer::create(Status* st) noexcept {
return fail(st, ErrorCode::GLFailure, "glGenBuffers returned 0");
}
id_ = name;
note_allocated();
return true;
}
@@ -146,6 +147,7 @@ bool VertexArray::create(Status* st) noexcept {
return fail(st, ErrorCode::GLFailure, "glGenVertexArrays returned 0");
}
id_ = name;
note_allocated();
return true;
}
@@ -220,6 +222,7 @@ Program Program::from_source(const char* vertex_src, const char* fragment_src,
}
program.id_ = name;
program.note_allocated();
return program;
}
@@ -285,6 +288,7 @@ bool Texture::create_rgba(u32 width, u32 height, Status* st) noexcept {
return fail(st, ErrorCode::GLFailure, "glGenTextures returned 0");
}
id_ = name;
note_allocated();
return true;
}
@@ -304,6 +308,7 @@ bool Texture::create_r8(u32 width, u32 height, Status* st) noexcept {
return fail(st, ErrorCode::GLFailure, "glGenTextures returned 0");
}
id_ = name;
note_allocated();
return true;
}
@@ -350,6 +355,7 @@ bool Framebuffer::create(Status* st) noexcept {
return fail(st, ErrorCode::GLFailure, "glGenFramebuffers returned 0");
}
id_ = name;
note_allocated();
return true;
}