Skip to content

refactor(renderer): route Buffer/VAO + CustomGeometry through GfxDevice (RC5 Batch 4)#44

Merged
esengine merged 1 commit into
masterfrom
rearch/rc5-buffers
Jun 18, 2026
Merged

refactor(renderer): route Buffer/VAO + CustomGeometry through GfxDevice (RC5 Batch 4)#44
esengine merged 1 commit into
masterfrom
rearch/rc5-buffers

Conversation

@esengine

Copy link
Copy Markdown
Owner

Stacked on #42 (RC5 phase 1). Review/merge #42 first; this re-targets to master once #42 lands.

What

The last resource classes come off raw GL. VertexBuffer / IndexBuffer / VertexArray and CustomGeometry now hold a GfxDevice* and delegate create / upload / bind / destroy + vertex-attribute setup to the device — zero gl, zero GL includes.

  • Buffer factories take GfxDevice& (createRaw/create, IndexBuffer::create, VertexArray::create). The VAO no longer calls glGenVertexArrays in its ctor — create() allocates via the device. bind / setData / attribute-setup route through the device.
  • CustomGeometry::init takes GfxDevice& and stores it for setIndices.
  • Callers updated: RenderContext quad, ResourceManager vertex/index buffers, GeometryBindings::geometry_init, and (transitionally) the legacy BatchRenderer2D.

Verification

MockGfxDevice + new test_buffer_device CTest harness compiles the converted Buffer.cpp + CustomGeometry.cpp against the mock — linking proves GL-decoupling; 21 asserts pass. All four renderer harnesses (state_tracker, shader_device, texture_fb, buffer_device) green locally.

Raw gl* outside GLDevice: 41 → 10 (only RendererBindings diagnostics/glClearStencil and one Engine.cpp call remain — Batch 5/6).

Next (Batch 5/6)

Retire Renderer/BatchRenderer2D and rebase ImmediateDraw on TransientBufferPool; flip the transitional device-routed binds to StateTracker; route the last RendererBindings gl* through the device; then a CI guard failing the build on any gl* outside GLDevice.

…ough GfxDevice (RC5)

The last resource classes come off raw GL. VertexBuffer/IndexBuffer/VertexArray
and CustomGeometry now hold a GfxDevice* and delegate create/upload/bind/destroy
and vertex-attribute setup to the device — zero gl, zero GL includes.

- Buffer factories take GfxDevice& (createRaw/create, IndexBuffer::create,
  VertexArray::create). The VAO no longer calls glGenVertexArrays in its ctor —
  create() allocates via the device. bind/setData/attribute-setup route through
  the device too.
- CustomGeometry::init takes GfxDevice& and stores it for setIndices.
- Callers updated: RenderContext quad, ResourceManager vertex/index buffers,
  GeometryBindings::geometry_init, and (transitionally) the legacy BatchRenderer2D.
- Test: extend MockGfxDevice + new test_buffer_device CTest harness (Buffer +
  CustomGeometry vs the mock) — linking proves GL-decoupling; 21 asserts pass.

Raw gl* outside GLDevice: 41 -> 10 (only RendererBindings diagnostics/
glClearStencil and one Engine.cpp call remain — Batch 5/6).
@esengine esengine changed the base branch from rearch/rc5-gfxdevice to master June 18, 2026 10:35
@esengine esengine merged commit 00fc72c into master Jun 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant