logoalt Hacker News

delta_p_delta_xyesterday at 8:47 PM3 repliesview on HN

Not necessarily.

Most desktop OS compositors provide a void** buffer that can be blitted to. Sure, this buffer will probably end up going through the compositor which does GPU hardware acceleration anyway, but it is definitely possible to shrink the application-side stack without relying on D2D/GLUT/GLEW/GLFW/SDL/WGPU in this case.

On Windows: CreateDIBSection and BitBlt

On macOS: CALayer and CATransaction commit

Not sure about Linux, too many stacks involved.


Replies

Lercyesterday at 10:36 PM

I have done this on a number of platforms over the years. Going back to before createDIBSection existed (In fact I had something break when Windows provided an easy path and took away the method I had been using).

Linux has always been a weird kettle of fish, the thing that worked best for me was imlib2 which was originally part of enlightenment. It did what it was supposed to do, hid pixel format conversion without killing performance.

I'm not sure what would serve a similar function today,

If anyone knows of a library that takes a rectangle of memory, a pixel format and places it onscreen regardless of the display environment I'd like to hear about it.

The faster and more efficient, the better. More features than needed, worse.

mananaysiempreyesterday at 9:09 PM

> Not sure about Linux, too many stacks involved.

Wayland: wl_shm and that’s it for the “stack”.

LoganDarkyesterday at 8:54 PM

Cross-platform support can be more difficult in that case, but yes it is possible.