I'm wondering if there it is possible to (and if so, if there has been any attempts at) implement Vulkan on top of OpenGL. The reason being that it would allow the rendering engine to optimize for Vulkan while supporting older platforms that do not implement the API. All of the discussions and projects I've found are about implementing OpenGL on top of Vulkan (which seems like a silly thing to do) and not the other way around.
Is it possible to implement Vulkan on top of OpenGL?
I can only comment on compute shaders - it would be possible. Guess the same applies to graphics as well, if you ignore a lot of details.But you would not have a chance to optimize for VK as you intend.
You would need to emulate mutithreaded command buffer generation and submission, buddereing all API calls just to let the driver buffering them a second time later.
You would not see the benefit of precomputed command buffers.
You would end up with a much slower engine.
you would spend more time on the emulation then you would need to implement two renderers for both APIs.
It's much more rewarding but still a challenge to create an abstraction that targets OpenGL and still benefits from VK, like anyone else does.
Edit:
I got you totally wrong, i thought you don't wanna use VK at all just emulate the API.
Implementing OpenGL on top of Vulkan would be perfectly possible. It's silly because the AMD/NVidia/Intel/etc already have implemented GL themselves, so there's no point... but it would also be really valuable because AMD's OpenGL is different to NVidia's OpenGL, which is different to Intel's OpenGL. This is one of GL's biggest flaws - there is no standard/reference GL implementation.
If someone did go and implement GL on top of Vulkan, then it would behave the same way on NVidia/AMD/Intel/etc, solving GL's Achilles heel.
You might be able to implement a specific sub-set of Vulkan on top of GL... But to implement the full Vulkan API on top of GL, you would end up emulating a lot of features, causing unecessary slow-downs and defeating the purpose of the Vulkan API :(
As above, the normal thing that everyone does is to create their own rendering API, which is implemented on top of several back-end APIs, such as GL/Vulkan/D3D/etc...
. 22 Racing Series .
It's silly because the AMD/NVidia/Intel/etc already have implemented GL themselves, so there's no point...
Not that much at all. Just like you depicted after. Plus this will save time/efforts/money for these companies, since they will mainly maintain a single driver: vulkan.
Most important thing would be to emulate all the command buffer/ memory management stuff and synch mechanics. Shaders as well as I know are compiled GLSL to SPir-V assembly or anything else with a matching set of op-codes.
Depends on the layer of abstraction you will have. Entering low level is more complicated than going high level where here are DX/ GL combos also possible as VK/ GL would