Repository navigation
Pipeline: move the methods to a static vtable, call them through pl_* helpers - #35
Conversation
|
Independent review of head Verdict: approve. No P1/P2/P3 findings.
Build: clean CMake+Ninja (Release, |
724b798 to
2e8767f
Compare
|
Restacked on the updated PR 34; review only the last commit |
2e8767f to
c40a7c1
Compare
|
Restacked onto master eff69ca after PR 29 |
c40a7c1 to
7e8bd4b
Compare
|
Restacked onto master b76fe0a after PR 30. |
7e8bd4b to
1b0f7bf
Compare
|
Restacked onto master a33ca6c after PR 31. |
1b0f7bf to
34b348a
Compare
|
Restacked onto master 4a501de after PRs 31–32. |
34b348a to
b095ea0
Compare
|
Restacked onto master 02aa325 after PRs 31–33. |
b095ea0 to
5846bb1
Compare
|
Restacked onto master dc5812a after PRs 31–34. |
PRs 31–34 are merged; this PR is now a single commit on master.
Part of the object model change from the tracker task: one
vtblpointer per object to a static const method table, like a C++ vptr.What changed:
render/pipeline.h: newstruct PipelineVtblwith the same 10 methods.struct Pipelinenow holds onlyconst struct PipelineVtbl* vtbl.pl_prefix for all 10 methods. The 7 old wrapper functions (pl_free,pl_start,pl_draw, ...) keep their names and became macros, sorender/pipeline.cis empty and is removed (CMakeLists.txt and Makefile updated). New helpers:pl_storage_swap,pl_start_compute,pl_draw_indexed.opengl/pipeline.candvulkan/pipeline.c: onestatic const struct PipelineVtbl pipeline_vtblbeforebuild(), with exactly the fields of the old literal (storage_assignstill points touniform_assignin both).build()setspl->base.vtbl = &pipeline_vtbl.font/font.c. Two commented-out calls are left as they are. PipelineBuilder is not changed here.Size of the
struct Pipelinepart on 64-bit: 80 bytes before, 8 bytes after (up to 11 pipelines in particles3).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.Totalabout 7.9 ms, 120 FPS with vsync).