I'm working on an outline effect similar to https://github.com/dmlary/godot-stencil-based-outline-compositor-effect, which needs to access the contents of the stencil buffer in its compute shader.
The effect on github does it by rendering a triangle that covers the entire screen, with a stencil test on a specific stencil value in order to create a mask of that stencil value. I could do something similar, but my effect requires checking multiple values in the stencil buffer instead of just one, so I'd have to do multiple passes of rendering full screen triangles just to recreate the stencil buffer that already exists. Surely there's some way to access the stencil buffer directly instead of wasting time remaking it?