Page 1 of 1

Designing a flexible GPU abstraction (C++/OpenGL)

Posted: Sat May 18, 2013 11:16 am
by fips
The image below shows a GPU abstraction that I use in my pet project. It gives a great flexibility as it's BLOB driven (to reduce API complexity together with the internal bookkeeping cost) and completely decouples the client from the GPU as the whole system interacts with the GPU at just a single well defined point (through the flush() function, which runs in a background thread, using a double-buffered Command_queue).

It's also very convenient that the client decides whether to push resource data into Graphics or keep it on its side. This allows, among other great things, to ask Graphics for a temporary resource index, which is valid for just a single frame and make a draw call using that index, so the client side doesn't need to care about resource lifetime management at all, which is very useful especially for immediate rendering.

Image