clay icon indicating copy to clipboard operation
clay copied to clipboard

[Core] Allow RenderCommands to be returned as "batched" or "sorted"

Open bungoboingo opened this issue 11 months ago • 1 comments

Based on some discussions from the Clay discord, it would be helpful if Clay returned RenderCommands in batches based on their major z-index. This will allow GPU renderers to be more efficient and instance draw primitives from each batch.

Clay can either expose the z-index from FloatingElementConfig and let the renderer implementation do its own intermediate batching, or, as discussed in the Discord, add a configuration option to allow RenderCommands to be returned as "batched" (by major z-index) or "sorted" (current behavior).

Within these batched render commands, it would also be helpful if each primitive was sorted by type, not layout order. E.g. the batch would first return all rectangles, then all text, then all images, etc., though the render implementation can also just do intermediate groupings as well, so its not completely necessary, just would be helpful!

bungoboingo avatar Jan 11 '25 02:01 bungoboingo

Thanks for reporting this! Should be looked at in the next week or so.

nicbarker avatar Jan 11 '25 07:01 nicbarker