hsauro / Mandelbrot

Simple Mandelbrot viewer to compare VCL to Skia drawing speed
7 stars 2 forks source link

Rendering Mandelbrot with Skia4Delphi and GPU #2

Open viniciusfbb opened 2 years ago

viniciusfbb commented 2 years ago

Hello @hsauro! How are you? I'm glad you're using the library.

I came here because I would like to add a note:

This madelbrot test does not reflect the actual speed of Skia4Delphi, in fact, it is only measured reading and writing pixels. The fastest way to draw a madelbrot is to use the GPU as the Skia backend. We haven't done any examples of how to use GPU in Skia backend in VCL version yet, but we did in FMX version.

So, based on Skia4Delphi for FMX (which renders with the GPU), I made a small demo of how fast this drawing can be using Skia4Delphi v3+: mandelbrot.zip

Results:

Description Time
First mandelbrot draw 57 ms
Subsequent mandelbrot draws 1 ~15 ms

The first draw is slower as there is a GLSL compilation and code initialization on the GPU. The next draws are much faster, even after resizes (which would rule out the internal cache hypothesis).

Here's the video:

https://user-images.githubusercontent.com/11139086/154865493-b12459d5-d257-4af5-9d7d-bb1891ef9ee8.mp4

hsauro commented 2 years ago

I only just spotted your message. Thanks for commenting.