GPU Computing with Delphi + FMX + WebGPU

A couple weeks I added to FMXutils repository a conversion of the “Compute Boids” flocking demo.

This builds upon the WebGPU driver for FireMonkey, but uses a dedicated class where the Compute & rendering shaders are hosted.

Two ping-pong buffers are used to store and updated particle data, which are used to mimic the flocking behavior of birds.

The initially random particles quickly organize into flocks after the simulation begins. This emergent flocking behavior mimics what is observed in nature, where particles self-organize through local interactions without centralized control.

Everything happens on the GPU, so CPU usage is fast, and the simulation can accommodate a large number of particles despite a rather brute-force approach to the flocking behavior implementation.

The implementation in the demo stays rather bare-bones and close to WebGPU spec, using only the interface-based wrapper to simplify memory management.

To run the demo you’ll need not only FMXutil and the Delphi-WebGPU headers & precompiled dawn dll which is in the repo.
Just keep in mind to use the exact DLL version in the repository that matches the headers, as the native WebGPU spec is not stable, it is expected to break binary compatibility on a weekly basis.

Leave a Reply

Your email address will not be published. Required fields are marked *