rwe icon indicating copy to clipboard operation
rwe copied to clipboard

Consider batching to improve render performance

Open MHeasell opened this issue 7 years ago • 2 comments

Right now rendering is embarrassingly inefficient. A quick win here would be to start batching renders by shader program, texture, etc. This would reduce GPU context switches. This probably isn't important right now but might become relevant when people start having large battles in the engine.

MHeasell avatar Dec 02 '17 02:12 MHeasell

We batch features by shader program now. Still need to batch unit meshes. Once this is done, consider also batching features and unit meshes by texture.

MHeasell avatar Dec 03 '17 02:12 MHeasell

Started doing this in a slightly more serious way recently. The old idea of trying to repeatedly iterate units/features/projectiles for each different type of object/material was pretty clunky and lots of game world concepts were leaking into renderer code.

The new way is to buffer up render tasks into "batches" which are big buckets for each kind of thing and then submit the entire batch to the renderer at the end. Render code that knows about game world concepts is migrating from RenderService to GameScene_util which seems like a better overall idea even if the shape of the function signatures and the locations of fields is pretty rough right now. Once we are completely transitioned to sticking everything into batches there should be opportunity for cleanup here.

MHeasell avatar May 09 '21 23:05 MHeasell