Make Canvas immediate-mode (per-frame vertex buffer) #13
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Canvas is meant to be an immediate-mode drawing API (debug draw, gizmos, prototypes, examples), but it currently behaves as a retained one.
Problem
Each
Canvas::triangle/Canvas::quadcall goes throughApplication::pushMesh, which creates a new GPUMeshthat lives untilCanvas::clear().clear()callsdevice.waitIdle()before freeing them.onUpdateevery frame creates GPU buffers without limit.onCreateonly works by accident.Proposal
Canvas::clear(), thewaitIdleinclearMeshes, and themesheslist inApplication::Impl.Application::camera(Camera2D) only exists for Canvas. Move it onto Canvas, or make Canvas draw in screen space, so it isn't confused with scene cameras.Done when
examples/triangleworks with drawing done inonUpdateeach framewaitIdleon the Canvas path