AustinJ235 / basalt

A rust library that provides window creation, input handling, and most importantly a UI.
MIT License
149 stars 5 forks source link

Rendering API & Backend Rework #24

Closed AustinJ235 closed 3 years ago

AustinJ235 commented 3 years ago

This is a complete rewrite of the bin update system and how they are rendered.

Old system had the ODB (Ordered Dual Buffer) which was in charge of updating Bin's and keeping up to date two sets of vertex buffers. This dual set of buffers allowed rendering to continue while the vertex buffer was updated. The used two large buffers which reduced the amount of draw calls needed and uploading needed for Bin updates. This isn't a terrible design and maybe something similar may be implemented again in the future, but how rendering is done now it would be rather complicated to compose the draw calls needed and may actually result in more draw calls as the data could be more fragment. The ItfRenderer of the old system used a single renderpass to do everything. Everything being drawn in order from the ODB. However with things such as fonts and future effects requiring access to previous fragment data to produce one this wasn't enough.

The new system implements the Composer which is essentially the replacement for the ODB. Its job is to keep bins up to date and the "layers" of the interface. Each layer is for each layer of the interface (z index). It sorts the vertexes and groups them into groups of the same images to reduce draw calls. It will compose the list of draw commands and fetch the associated images from the Atlas and updating the atlas views if they go stale. The ItfRenderer is now essentially replaced by the ItfPipeline which is response for creating and maintaining the entire rendering pipeline and does the draw. The new ItfRenderer is mostly a shell which checks for ComposerView changes and draw target changes. Rendering done in many passes instead of a single. (A pass per layer. This shouldn't grow too large in even very large applications). Each render pass has access to the previous one which allows proper text blending and more advance renderering features to come. (Such as a blurred background for a Bin). There is some regression in performance currently.

Blocking