Run Steam Games with Optirun

I like to set primusrun %command% as launch option for steam games. However, starting from last month, primus did not work any more. Luckily, optirun still works fine. So, I will have to play steam games with optirun.

It is easy to get optirun work. Right click any game in your steam library, and choose “Properties”. Then select “Set Launch Options…” in pop-up dialog box, and specify below command line (here I take my Gentoo as an example, you need to modify the path according to your actual needs):

LD_PRELOAD=/usr/lib64/opengl/nvidia/lib/ optirun %command%

Please note, the environment variable LD_PRELOAD depends on the ELF attribute of the game. If it is a 32-bit game, then you need to specify 32-bit library path.

OK, now I can play the games with my discrete card again.

PS: I submitted the primus issue to its author days ago. The latest primus commit has fixed it.