Part of the work is indeed refactoring, replacing GLuint
with uint32_t
or an abstract pointer, always allocating textures through GPUTexture
, and similar changes to hide OpenGL data types and functions. Further I think more Blender specific code in bf_gpu
should be moved into bf_draw
, and intern_gawain
merged into bf_gpu
to form the more generic abstraction library.
We could agree on these refactoring steps without worrying too much about how it all maps to Vulkan, thereās already plenty of work there that can be done incrementally, to isolate the OpenGL stuff to one module that is as small as possible.
But there is also a big design change, which is that Vulkan / Metal / DX12 replace global state by objects and support multithreading. If we emulate the gl* calls or adopt ANGLE we will not get the performance benefits.
For example to remove glEnable(GL_BLEND)
, GPUShader
could store the blend mode and then GPU_shader_bind()
could set it. This way GPUShader
could map to a Vulkan pipeline. I donāt know if thatās exactly the right solution, we need a design for how the existing GPU/GWN/DRW abstractions map to Vulkan.
ClƩment probably has ideas about this.