3 ms·
Once upon a time, I had to write a system where the rendering architecture was broken up into an engine that ran in a separate service, and the pixels were then
by shadowgovt 6y ago
Once upon a time, I had to write a system where the rendering architecture was broken up into an engine that ran in a separate service, and the pixels were then dumped to windows owned by client programs. Long story, it seemed like a good idea at the time.
Mac OS X had a very secure graphics architecture where no program could emit pixels into the window content of another program. As a result? We could barely support OSX. We ended up having to do rendering to pixel buffers and then using mmap through an invisible file shared between the service and client, then dumping the contents of the pixel buffer straight to screen using some code every client ran. Rendering from graphics card to RAM back to video buffer cost us half our frame rate.
On Windows? Client program passed its HWND to the service. Service bound an OpenGL target as a child of the client program's window.
Security is important, but in a graphics service, it creates a solid trade-off between what is possible and what is safe. That HWND trick can definitely be used to fake a login window and steal user passwords. But it also allows some programs to run on Windows that were technically impossible on Mac OSX without a complete rearchitecting.
(Clarification: I've gotten out of the game of writing Mac OSX software, but if I understand correctly that trick is possible under the modern architecture. It turns out Apple needed the ability for one program to write into another program's windows directly because they architected QuickTime as a service and performant video display required a similar trick to the one we were doing. So they added a mechanism for two processes to describe a shared rendering target to Quartz).