Julio Jerez wrote:Joe remind me of this again?
why can't we just make two dlls NewtonDx and NewtonGl
Yes. Seems we never get a portable compute API that survives, and with async compute we don't even want this anymore(!) So adressing each API would be the only practical choice.
I would choose DX12 because HLSL has wide support. This grants you peak performance, and you will be up to date with updates. For example, NV talks about 'work generation shaders' (yeah!
), which they have for raytracing but it is not yet exposed to any API. DX12 will be first. DX12 has raytracing - DX11 has not and Vulkan not yet.
DX11 users can run your HLSL shaders with little effort.
Vulkan users would take your DX HLSL shaders, compile them to Spir-V and run them inside Vulkan Engine. This should work without a need to port the shaders to GLSL i guess. (Or at least it will work in the future. VK wants to support HLSL. They work on this since the beginning.)
OpenGL users might be able to use Spir-V too? I don't know, a bit unlikely, but there were at least plans for this.
Any user that cares about performance will have to spend work to run your stuff async with graphics. E.g. running Newton shaders while rendering depth prepass and shadow maps. This means we need some Interface like calling Newton->DX12PlugIn->GenerateSolverCommandList (int queue);
Likely there will be a number of command lists for different tasks like collision detection, various solver stages etc. Users may want to distribute them to multiple queues in parallel or to just one queue serially and they will have to care for synchronization themselves. They have to know about correct order and dependencies. The interface will be more complex than we like it to be, as i expect.
Users with unsupported APIs have to replicate that functionality and will likely contribute their API implementation to your open source.
Which means for the start you can pick whatever API you want and ignore the rest, do some experiments until it starts to make sense. And after that we could start talking about Interfaces etc.
You could also create your own shading language and convert it to GLSL and HLSL. But i assume that never becomes necessary.