Repository navigation
BufferManager: static vtable for the backends, plain functions for the shared base - #34
Merged
Merged
Conversation
Owner
Author
|
Independent review of head Verdict: approve. One P3.
Build: clean CMake+Ninja (Release, |
resetius
force-pushed
the
objmodel-buffer
branch
from
November 7, 2026 15:58
060f8cc to
b5cd05b
Compare
Owner
Author
|
Restacked on the updated PR 33; review only the last commit |
resetius
force-pushed
the
objmodel-buffer
branch
from
November 7, 2026 16:01
b5cd05b to
a782634
Compare
Owner
Author
|
Restacked onto master eff69ca after PR 29 |
resetius
force-pushed
the
objmodel-buffer
branch
from
November 7, 2026 16:06
a782634 to
05d4ada
Compare
Owner
Author
|
Restacked onto master b76fe0a after PR 30. |
resetius
force-pushed
the
objmodel-buffer
branch
from
November 7, 2026 16:26
05d4ada to
8a4e81e
Compare
Owner
Author
|
Restacked onto master a33ca6c after PR 31. |
resetius
force-pushed
the
objmodel-buffer
branch
from
November 7, 2026 16:29
8a4e81e to
2d7fefe
Compare
Owner
Author
|
Restacked onto master 4a501de after PRs 31–32. |
resetius
force-pushed
the
objmodel-buffer
branch
from
November 7, 2026 16:33
2d7fefe to
e56e8ee
Compare
Owner
Author
|
Restacked onto master 02aa325 after PRs 31–33. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PRs 31–33 are merged; review only the last commit.
Part of the object model change from the tracker task: one
vtblpointer per object to a static const method table, like a C++ vptr.BufferManager had three levels: the interface with 9 function pointers,
BufferManagerBase(shared buffer array) that filledget,destroy,acquire,free, and the OpenGL/Vulkan managers that filled the rest. The base methods were never overridden, so they are plain functions now.What changed:
render/buffer.h: newstruct BufferManagerVtblwith the backend methods only:create,update,update_sync,read,release.struct BufferManagernow holds onlyconst struct BufferManagerVtbl* vtbl.buffer_createandbuffer_update(same names as the old wrapper functions, so their 33 callers do not change), plusbuffer_update_syncandbuffer_read.render/buffer.c: the base methods are plain functionsbuffer_get,buffer_destroy,buffer_acquire,buffer_mgr_free(the old static functions without the trailing underscore).buffermanager_base_ctoronly sets the element size.releaseis still called through the table.opengl/buffer.candvulkan/buffer.c: onestatic const struct BufferManagerVtbl buffer_vtbleach. Vulkan still has noread(NULL, as before; not implemented there).font/font.c, andbuffer_getin both pipeline backends.No behavior change.
Verification (macOS, AppleClang, CMake + Ninja):
ctest: 3/3 passed.VK_LAYER_KHRONOS_validation(layer load confirmed withVK_LOADER_DEBUG=layer), 10 s each: particles3, mandelbrot, stl, 0 validation messages.main.c(not in this PR): at frame 30 it sends key presses and releases for LEFT, RIGHT, UP, DOWN, A, Z, TAB and two mouse moves through the normal GLFW callbacks, then leaves the main loop after 8 s, so all free functions run. Vulkan particles3, mandelbrot, stl, gltf, triangle, torus, mandelbulb, particles, particles2 and OpenGL mandelbrot, stl, torus, triangle, mandelbulb, particles2: all exit with code 0. The logs are the same as on master after removing timings, FPS and pointer values (same buffer allocations, same validation output). On master, stl, gltf and triangle already report leaked objects atvkDestroyDevice(one message each); nothing else is reported.