Skip to content

Optimised software rasterizer / ImGui on Arduino  #1613

@LAK132

Description

@LAK132

Creating a new thread for this so I don't clutter the other sharing threads

Current performance figures:

so far so good

Slider 1: Loop time excluding raster and TFT draw time (4ms)

Slider 2: TFT draw time (248ms)

Slider 3: Raster time (187ms)

The main loop without rasterizing and drawing to the screen is running at ~240Hz which is crazy fast for such a small device (160MHz ESP32), no need for any more performance gains here.

The TFT library is pushed right to its limit, only way to get it any faster will be to crank up the SPI speed or somehow work out how to only draw to the parts of the screen that have actually changed between refreshes (this would be handy for other devices with less RAM).

The rasterizer is still running a little slow, but as mentioned before it can be optimised with a heap of special cases, some of which have been tested but are currently disabled for debugging purposes.

  1. Test if 2 triangles are actually a square

  2. Test if triangle is a flat colour with basically no UV map, if it is don't bother interpolating values

  3. Test if triangle is actually a line/single pixel

  4. Faster lerp factor calculation for grid aligned triangles/rectangles

  5. Remove rounding

  6. Special cases for alpha blending

  7. Less specific to the rasterizer but not rendering the window or background makes sense on a platform like this and should also give a performance boost

I'm going to continue to try and get as much performance as I can out of the software rasterizer for use both on Arduino and for general PC use, perhaps it will be a good base for an sr example or the regression testing system mentioned in an earlier thread.

If anyone has any working examples for optimisations that would certainly help speed me up

Code: https://github.com/LAK132/ImDuino
Only necessary modification to the base ImGui library was the removal of #include <memory.h> from stb_truetype.h

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions