[Idea] What if the concept of a close to the metal API was applied to Unity?

Mantle, Metal, Vulkan, DirectX 12 are all new closer to the metal Graphics API’s that aim to reduce the abstraction level and driver overhead for games.

They also aim to be massively multi-threaded for maximum throughput, so a CPU does not bottleneck the system’s GPU.

Which got me thinking what if this approach were applied to Unity?

My understanding is that once you have passed the geometry/textures and shaders over to the GPU you can then just update their parameters, massively reducing the amount of data sent in draw calls (once the scene has loaded).

How does this apply to Unity, well in Unity we are transferring information into and out of the Unity game engine. But could we massively reduce the amount of information being sent or batch that information so that it is sent over in a more memory efficient way?

Unity is built on top of existing APIs and can’t bypass them.

–Eric

Excellent point however it could be moot if Unity has a source code license for those code bases or is they support more performant API calls e.g. bulk, batch based or multi-threaded.

But I was thinking more along the lines of the way Unity works being similar to a CPU and GPU, on one side you have the single threaded* scripting languages on the other a Multi-threaded Task Based Game engine.

So in theory we could gain significant performance improvements if we can reduce and improve how we transfer data between the two.

  • I know we can write multi-threaded game specific code but then we need to go single threaded to talk to Unity.

That’s not something which makes any sense; Unity has to run on existing APIs. Also, Unity already supports Metal.

–Eric

My point is could there be a way to make Unity faster by reducing the API and data transfer overhead between scripts and the engine.

Ideally yes Unity would be able to pass these updates forward to the sound/graphics/physics/engine api’s that it is built upon with minimal changes to the data. Providing a lower level more performant API interface.

For instance I believe that the Nvidia PhysX api has a batched raycast function, if this was available in the Unity API it would minimise the data and number of calls made between scripts and the engine.

If UT analysed on hardware how much of CPU time and bandwidth the engine uses just in transferring data to and from scripts.

Maybe the overhead is miniscule but what if it’s a significant fraction of every frame in most Unity games?