AgonConsole8 / agon-vdp

Official Firmware for the Agon Console8: ESP32 VDP
MIT License
38 stars 17 forks source link

Optimised text printing #156

Closed stevesims closed 2 months ago

stevesims commented 7 months ago

Currently all test output on the VDP is done by plotting one character at a time. This involves several canvas calls to ensure that the current state of the canvas is correct for text plotting, together with a canvas->drawChar call

This results in quite a lot of command primitives added to the internal vdp-gl drawing command queue, many of which could likely be skipped.

An obvious optimisation would be to detect sequential plotCharacter calls, thus allowing the calls that set up the canvas for text plotting to be skipped when they are unnecessary.

A more sophisticated optimisation could be to collect characters to be plotted into strings, and to use canvas->drawText to render out those strings in one go. This would be more complex to achieve, especially considering text can be sent non-terminated to the VDP for printing without subsequent VDU commands being sent. This likely means that such a printing method may involve a (rapid) timeout detecting "no more input".

stevesims commented 7 months ago

similar optimisations may be possible for graphics calls

stevesims commented 4 months ago

phase 1 of this was implemented in 2.8.0, which gathers characters up to be drawn

stevesims commented 2 months ago

text printing in the underlying vdp-gl essentially is all one character at a time. this applies when using canvas->drawText - that just gets turned into multiple "draw glyph" primitives in the drawing queue, which is essentially identical to our current text drawing

there is therefore essentially no benefit to any further text printing optimisations at the agon-vdp layer.

closing this issue, as what practical optimisations can be done now have been