Handmade Network»Forums»Work-in-Progress
LAG
4 posts
XCB/Linux Handmade Adaptation

Over the week i've been working on a adaptation of some of handmade hero's code, for window,to linux, I have organized the code by their respective day, I'm currently on day 6, My plans are to make videos explaining each day's code and "translate" more days, as far as i can anyway

Note: as i post this, there is a video up for day 1, which will probably be remade in the near future

The Code: https://github.com/LeoBlute/xcb-handmade

Mārtiņš Možeiko
2575 posts / 2 projects
XCB/Linux Handmade Adaptation
Edited by Mārtiņš Možeiko on

You can increase performance of drawing image with xcb by using shared memory extension for images. Currently every time you call xcb_put_image it needs to transfer all the pixels from your client to X11 server. Instead you can allocate shared memory with xcb and only inform X11 server when to draw them, no pixel transfer will be involved - it'll just read pixels from shared memory which is same memory you write to. It will be way faster.

Here's a basic description of this extension with X11 functions: https://www.x.org/releases/X11R7.7/doc/xextproto/shm.html

And here is simple example how to use it with XCB: https://stackoverflow.com/a/27755418

LAG
4 posts
XCB/Linux Handmade Adaptation
Replying to mmozeiko (#30059)

Thanks for the tip, i will check this before doing the video on day-3, though i am currently avoiding some libraries that are not part of the default linux installation(colloquially speaking) unless they are absolutely necessary

LAG
4 posts
XCB/Linux Handmade Adaptation
Edited by LAG on

Week update:

-An alternative day-3 with the shm implementation suggested by Mārtiņš Možeiko, is available, not included in the "main" code for the reasons explained in it's file

-Day 7,8,9 were uploaded today, so far ALSA(which is the equivalent to dsound in this project) has been the biggest headache, the implementation is not perfect, but, since audio is revisited later in the series, I'm going with something that works "good enough" for my purpose

LAG
4 posts
XCB/Linux Handmade Adaptation

2nd Week update

-day 10 to 15 are now available in the repository