AgonConsole8 / agon-vdp

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

Blit from back-buffer operation #151

Open stevesims opened 7 months ago

stevesims commented 7 months ago

we have double-buffered screen modes, but the only way in which they can be used is to draw to the back buffer, and then just swap buffers.

there is currently no mechanism to "blit" parts of the contents of one buffer into the other. this means that complex drawing operations may have to be done twice, as they cannot be copied from one buffer to the other

it would be good to add operations to do that, allow for more sophisticated double-buffer screen mode usage

stevesims commented 5 months ago

this can potentially be done using a new PLOT code. move to one rectangle corner, and then PLOT with the other corner

we may wish to use 3 coordinates - move to two corners to define the source rectangle, and then PLOT at the destination coordinate (corresponding to first corner)

stevesims commented 2 months ago

part of the nature of double-buffered screen modes is that essentially there is no drawing queue - operations are performed immediately to the back buffer

single-buffered screen modes use a drawing queue, which is processed on vsync in order to try to ensure minimal flickering. this is essentially the point of the queue

bearing this in mind, performing a blit to immediately copy pixels into the foreground buffer may not be desirable. it may be that we should queue up "blit to front buffer" operations and process them on vsync, in a similar manner to how the buffer swap gets queued to occur on vsync. this would however mean that the blit would potentially be performed after other operations.

alternatively we can consider this "ok" and just document the effect of using such an operation that affects the front buffer

stevesims commented 2 months ago

something to consider here is that blitting support might be easier if/when https://github.com/AgonConsole8/vdp-gl/issues/12 is complete