Open glennw opened 6 years ago
It is certainly a trick to keep on the table for future improvements. The performance benefits are clear here.
My main concern would be complexity: supposing we allocated an RGBA8 block to use for a single A8 allocation, now we need to have 4 sub-allocators for this block to fill out each channel. Combining different render tasks into one is also something that requires all the tasks to be very similar.
At the very least, we can allocate whole layers of the RGBA8 texture array instead of regions.
(File this away in the crazy ideas to consider one day).
When we draw A8 items in the texture cache (e.g. clip-masks, box-shadows) we draw them to a separate texture array of A8 format.
Since texture cache items use a slab allocator, the allocation sizes are generally quite uniform.
We could consider instead allocating a RGBA8 block, and storing (up to) four A8 masks in that one block, one per color channel.
We could use color masks to update a single channel at a time, or (ideally) run a shader that draws up to 4 masks / box-shadow segments at a time, writing all channels in one invocation.
Potential benefits are: