Hi!
There are various "built-in" shaders in ANGLE, with different degrees of efficiency / simplicity.
- For GLES1 emulation, the front-end builds the shader as GLSL source code, and goes through compiling it and using it through the front-end itself, i.e. as if all that was done by the application (minus GL validation)
- The Vulkan, metal and d3d backends have pre-compiled shaders (for Vulkan for example, that's under src/libANGLE/renderer/vulkan/shaders/src)
* The GL backend doesn't have this option, so it also creates GLSL source code on the fly as necessary
The first method is the easiest for PLS, as it's also implemented entirely in the front-end. Take a look at GLES1Renderer.cpp (and associated files) to get an idea of how it's done (but it's not hard to imagine either). The second is more complex as support for each backend would have to be hooked in separately (and support in the GL backend is essentially as much work as doing it entirely in the frontend), but comes with the benefit of not needing a compilation. I don't imagine PLS needs that many shaders, so this benefit is probably negligible.
My suggestion would be to start with front-end shader generation (and caching the resulting programs), and if ever necessary, specialize with select backend implementations.
And to answer this question that I left out:
> Does ANGLE have a frontend shader cache I can use to store these shaders?
No, the emulation that lives in the front-end (i.e. GLES1) owns its own shaders and programs, and PLS could easily do the same.
---
For completeness:
- GLES1: Shaders generated by front-end
- Overlay: Managed by the front-end, but calls into backend to use prebuilt shaders (currently only Vulkan, I should one day move it all to front-end though)
- Blit implementations, vertex attribute emulation, etc: Entirely done in the backend using prebuilt shaders