Re:Zink (OpenGL on Vulkan) performance better than expected
by moonchild on Wednesday September 09, 2020 @07:25PM
(#24427160)
> implicit global state
In 4.x they added DSA[1], which lets you avoid the global state a lot of the time. There's still some, but much less.
I do agree, though, that opengl is somewhat a mess, and vulkan really overwhelming.
Re:Zink (OpenGL on Vulkan) performance better than expected
by pcwalton on Wednesday September 09, 2020 @07:20PM
(#24427108)
> in particular, the fact that it's very difficult and error-prone to make applications that interact with OpenGL from multiple threads.
These days I rarely ever bother with threaded OpenGL, and I stick to one context per thread, using OS surface sharing primitives (DXGI, IOSurface, etc.) to communicate.
Re:Zink (OpenGL on Vulkan) performance better than expected
by pmarreck on Wednesday September 09, 2020 @06:45PM
(#24426770)
> the implicit global state and, in particular, the fact that it's very difficult and error-prone to make applications that interact with OpenGL from multiple threads
These things are obviously related.
From my work in OO langs, I believe it is possible to wrap OO code in functional code to some degree without rewriting, assuming that global references can be intercepted and resolved to local ones somehow, and that the state reference that encompasses all the globals is an immutable data struct
In a way I find OpenGL too complicated sometimes, some of its abstractions don't really make a whole lot of sense on modern hardware. Having a lower level API can make some code simpler to write, at least in theory. When I use OpenGL I often find myself thinking "I sure hope the driver will manage to understand what I'm trying to do and not end up doing something silly".
Note that my exposure to OpenGL comes mainly from console emulators though, and that's obviously very biased since emulators need to mimic very quirky behaviors of the original hardware, and that often results and very un-idiomatic GL code.