When I first started refactoring DynTopo I naively thought I was supposed to get PBVH drawing working in EEVEE. This involved quite a lot of work, but resulted in a major speedup. Here's a test video showing the difference in performance:
https://www.youtube.com/watch?v=qinjgVZ6Evo
The purpose of this task is to lay out the next steps.
== Draw cache should provide API to convert and upload customdata layers ==
Once the dyntopo improvements are merged sculpt mode will support customdata properly for all three PBVH types. Combine this with the geometry nodes project and I think it's safe to say Blender users are going to be creating a //lot// of attribute layers in the future.
It would be nice if the draw cache system provided an API that took customdata data and converted it to (an arbitrary) GPU vertex data type. I prototyped a very basic system in my branch (it's the code inside the #ifdef NEW_ATTR_SYSTEM blocks):
https://developer.blender.org/diffusion/B/browse/temp_bmesh_multires/source/blender/gpu/intern/gpu_buffers.c
Unlike DRW_make_cdlayer_attr_aliases this is not a candidate for the draw cache API. It's a placeholder so I can clean up the PBVH draw builder code and get PBVH_FACES/PBVH_GRIDS to work in EEVEE mode too. This sort of thing should really be written C++ and use the attribute classes for conversion.
== Add proper uv/color support to PBVH_FACES and PBVH_GRIDS ==
See above
== Generate index buffers split by UV islands ==
Indexed drawing can be quite a bit faster (in my tests it's about 40-50% faster). For DynTopo
indexed drawing currently happens when "Draw Smooth" is enabled *and* there are no UV layers.
We could split the index buffers by UV islands. I'm thinking of using [[ https://github.com/zeux/meshoptimizer | meshoptimizer ]] for this.
== Add support for fragment-based flat shading to viewport drawing ==
The downside of indexed drawing is that the only way to support flat shading for faces (without
losing all the benefits of indexing) is derive plane normals in the fragment shader. It would be
nice if the viewport devs could implement this though it's not a high priority.
= Add support for partial or full deinterleaving to draw cache code =
I talked to the meshoptimizer devs and they recommended we look at either partial or full vertex attribute deinterleaving. The idea is to put position (and I guess normals) in one gpu buffer, and everything else in another. This isn't a high priority but it would be nice to have, and could provide a hefty speedup for some meshes.