Rework and optimise the (S)VGA pixel renderer #3859
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This reworks the renderer to be internally chunky rather than planar. In doing so, the only lookup tables I needed boiled down to something that only needs to be in a single 32-bit integer and shifted around.
I focused entirely on the "turn 32 bits of VRAM data into 4 or 8 pixels" part. There shouldn't be any regression in functionality.
I isolated this implementation and the implementation it replaces so I could run multiple iterations of a 320x200 output as fast as possible. My results from running this under the prestigious compatibility standard known as My Machine™ indicates that this implementation is almost twice as fast as what it replaces, except in the case of high-resolution 8bpp where for some reason it renders at about 7x the speed...?! [EDIT: This was using
-Osoptimisation (optimised for size). On-Ofastthe gap was about 5x.]I'm not sure why there's such a horrible slowdown for hires 8bpp in the current renderer but at least the new one seems to take almost twice as long as doing lores 8bpp, so at least that's somewhat sane...
Checklist
References
I referred to the shifter definitions in the 82C451 VGA clone datasheet.