Comment #63 on issue 7279 by
ch...@rive.app: Implement a pixel local storage extension in ANGLE
https://bugs.chromium.org/p/angleproject/issues/detail?id=7279#c63A large unmet need in WebGL is the ability to do custom blending. An extension for framebuffer fetch has been proposed, but is prohibitively complex to polyfill when hardware support isn't present.
A more practical (and more versatile) way to enable custom blending would be to provide a "pixel local storage" extension. Apps can easily use local storage to do blending, and the implementation is straightforward and broadly supported on every backend:
OpenGL:
* As shader images (GL 4.2+, ES 3.1+, or ARB_shader_image_load_store) (noncoherent)
** Can be coherent with GL_ARB_fragment_shader_interlock (NVIDIA & Intel)
** Can be coherent with GL_INTEL_fragment_shader_ordering (Intel & AMD)
* As color attachments (GL_EXT_shader_framebuffer_fetch) (always coherent)
** GL_QCOM_tiled_rendering to explicitly discard local storage attachments
* Using GL_EXT_shader_pixel_local_storage (always coherent)
* Using texelFetch and barriers (NV_texture_barrier or GL 4.5) (always noncoherent)
Direct3D:
* As RasterizerOrderedTexture2D<> (D3D11.3, always coherent)
* As RWTexture2D<> (D3D11, noncoherent)
Vulkan:
* As transient attachments with subpass loads (noncoherent)
** Can be coherent with VK_ARM_rasterization_order_attachment_access
** Can be coherent with existing framebuffer fetch mechanisms (they ARM and Swiftshader are automatically raster ordered)
* As shader images (noncoherent)
** Can be coherent with VK_EXT_fragment_shader_interlock
Metal:
* Using "programmable blending", available on all Apple GPU families since v2 (always coherent)
** Putting PLS in its own raster order group could be a perf optimization
* As readWrite textures, an optional featutre (noncoherent)
** Can be coherent with raster order groups
* Using texture barriers (Mac2 GPU family) (always noncoherent)
We can quickly bootstrap this feature as a thin layer that calls into ANGLE's existing ES 3.1 code. Shader images are already implemented on every backend except Metal. Once bootstrapped, we can establish a strong base of tests that guide the development of the fast, backend-specific implementations.
I've drafted an initial spec for this extension, intended for implementation on top of ES 3.1, here:
https://docs.google.com/document/d/17HTZQyxM3sd--c3cJbNXZv5cZTO_J1ENzkzrXwvTvQ0/edit?usp=sharing