How to draw a lot of overlapping decals in the correct order?

Godot Version

4.5dev2

Question

I’m making a map editing tool for game modding. The map format I’m reading makes heavy use of decals and I’m having trouble with Godot Decals flickering when the camera moves.

It looks like this is an expected and documented behavior.
As far as I can see the commonly suggested solutions are either fiddling with sorting_offset or creating decal meshes and somehow offsetting them a bit to avoid z-fighting. Neither of these looks like something that can be done reliably without manually tuning each decal.

It would be nice to have a fixed order of applying decals. I’ve tried decal.sorting_offset = decal_idx * 10000 but it didn’t help.
Can you help me find a way to display the decals on the map correctly?