sultim-t / prboom-plus-rt

823 stars 49 forks source link

On Linux compilation/running #39

Open valgusk opened 2 years ago

valgusk commented 2 years ago

Some people mentioned that they would like to try native Linux build. I managed to run and play without errors for two episodes now, so I will share some info here.

Code needed some modifications and I created a fork that builds at least on Arch. Many of the things changed are hacks/win32 regressions, also some mystery about DLSS versions required building against 2.3 and loading 2.4, so I am not creating a pull. If anyone experienced with C++/cmake wants to create a proper PR, then this could at least be used as a base.

But for those, that want to at least build it for Linux to check it out, you can try following these instructions. It may or may not build for you, but it is a start

@sultim-t, this is not an issue with the project, feel free to do whatever you wish with this GH issue (add labels/edit/close/etc)

thegreatpissant commented 2 years ago

I can confirm the original poster's instructions and branch work.

popsUlfr commented 2 years ago

I got it running on my Steam Deck thanks to your instructions. :smile:

image

With the mesa RADV vulkan driver setting RADV_PERFTEST=rt is needed to enable raytracing but it's very very slow. I added and used the amdgpu-pro driver instead, forcing the game to use the other driver with VK_ICD_FILENAMES=/home/deck/.local/share/vulkan/icd.d/amd_pro_icd64.json and now it's quite playable.

jp-bennett commented 2 years ago

Failing on Fedora with a

/home/jbennett/src/prboom-plus-rt/prboom2/src/r_things.c: In function ‘R_DrawPSprite’:
/home/jbennett/src/prboom-plus-rt/prboom2/src/r_things.c:1123:12: error: ‘gl_hardware_gamma’ undeclared (first use in this function)
 1123 |       if (!gl_hardware_gamma)
      |            ^~~~~~~~~~~~~~~~~
valgusk commented 2 years ago

@jp-bennett,

‘gl_hardware_gamma’ undeclared

If I am correct, you are missing some dev dependencies. prboom2/src/CMakeLists.txt:416 checks for OPENGL_FOUND AND OPENGL_GLU_FOUND to set GL_DOOM value. And this is used to determine if #include "gl_struct.h" gets added in prboom2/src/v_video.h:313.

RT code shares some things with GL code, so probably not all places are working if independent. My guess that you miss glu package, probably freeglut-devel for Fedora?

Edit: Maybe it is better to remove this check for HW gamma altogether, but this is for original author to decide, I do not have enough knowledge for that

jp-bennett commented 2 years ago

My guess that you miss glu package, probably freeglut-devel for Fedora?

That was it. If it's a hard requirement, cmake should throw an error when it's missing. Thanks!

Edit: Compiles, but still refuses to run. Command line: RADV_PERFTEST=rt ./prboom-plus -iwad /home/jbennett/.local/share/Steam/steamapps/common/DOOM\ 3\ BFG\ Edition/base/wads/DOOM2.WAD

SetRatio: gl_ratio 1.600000
SetRatio: multiplier 1/1
prboom-plus: /home/jbennett/src/prboom-plus-rt/dependencies/RayTracedGL1/Source/Common.h:75: void RTGL1::VK_CHECKERROR(VkResult): Assertion `r == VK_SUCCESS' failed.
I_SignalHandler: Exiting on signal: Aborted

Edit Edit: RayTracedGL1 had to be compiled with "-DRG_WITH_NVIDIA_DLSS=OFF " to get the game to launch at all.

sultim-t commented 2 years ago

I got it running on my Steam Deck thanks to your instructions. 😄

Just mindblowing! Hah

d10sfan commented 2 years ago

I just tried using the latest on this repo's commit to build and running into this error:

/root/packages/engines/prboom-plus-rt/source/prboom2/src/RT/rt_main.c: In function 'RT_Init': /root/packages/engines/prboom-plus-rt/source/prboom2/src/RT/rt_main.c:75:3: error: expected ',' or ';' before 'RgInstanceCreateInfo' RgInstanceCreateInfo info = ^~~~~~~~

I'm guessing this is because it's having issues finding the library for raytracedgl1 in the correct place, although as far as I can tell, it's in the excepted spot.

When I build RayTracedGL1, it creates a libRayTrackedGL1.so file in the Build directory but it does not create RelWithDebInfo and Debug folders, like the CMake file appears to want it to. I manually did it as a test and that did not seem to help.

Any ideas as to fixes for this? This is the script I'm building to attempt to build it: https://gist.github.com/d10sfan/370d48cf6cb78d45f16474e7b44b54f7

Please let me know if there's anything in there I'm not doing as expected.

d10sfan commented 2 years ago

The latest master fixed the compile error. Now I'm getting just "segmentation fault" trying to run it. Is this expected with a non-rt device? I have a gtx 1070, which seems to have the right extensions, but of course doesn't have the ray tracking hardware.

arrowgent commented 2 years ago

RelWithDebInfo: https://github.com/sultim-t/prboom-plus-rt/issues/64

interesting, thanks for the info about the build process -DRG_WITH_SURFACE_XLIB=ON https://github.com/luxtorpeda-dev/packages/blob/prboom-plus-rt/engines/prboom-plus-rt/build.sh https://github.com/sultim-t/prboom-plus-rt/issues/65

arrowgent commented 2 years ago

confirmed recompiling again I_SignalHandler: Exiting on signal: Segmentation fault

tested with nvidia 1070

changing GL to RT in video modes crashes.

gld_Precache: E1M1 done in 375 ms
V_InitMode: using RT video mode
I_InitScreenResolution: Using resolution 1920x1080
SetRatio: width/height parameters 1920x1080
SetRatio: storage aspect ratio 16:9
SetRatio: assuming square pixels
SetRatio: display aspect ratio 16:9
SetRatio: gl_ratio 2.133334
SetRatio: multiplier 3/4
I_SignalHandler: Exiting on signal: Segmentation fault
I_ShutdownSound: 
arrowgent commented 2 years ago

some mystery about DLSS versions

add optional cmake option to disable DLSS build in your build instruction (for those without an RTX card)

build RayTracedGL1

cmake -DRG_WITH_NVIDIA_DLSS=OFF

PoorPocketsMcNewHold commented 2 years ago

Managed to compile it on Fedora, running it with an AMD 6990 XT. Run's fine enough, even if I prefer largely playing it with the CRT low-resolution mode, so it's easier to run on it anyway.

I had quite a lot of issue figurin out the RTGL1::VK_CHECKERROR(VkResult) too, even compilling multiple time without DLSS support explicitly, until I've figured out that I needed the already mentionned, RADV_PERFTEST=rt mesa launch command to allow for it to obviously  process it.

So, to clean things up for users in the same case.

  1. If you don't need DLSS, either by choice or hard requirement, compile the RayTracedGL1 with -DRG_WITH_NVIDIA_DLSS=OFF
  cd dependencies/RayTracedGL1
  mkdir build
  cd build
  cmake .. -DRG_WITH_NVIDIA_DLSS=OFF
  make

  cd ../../..
  1. If you are on AMD, and obviously, running the free driver, instead of the AMD semi-proprietary AMDGPU-PRO driver, run prboom-rt with the RADV_PERFTEST=rt launch argument.

RADV_PERFTEST=rt ./prboom-plus -iwad <userspace doom.wad path here>

ColinSalem commented 2 years ago

I know this thread has been dead for a while, but if anyone is interested I created a script that will clone and build prboom-plus-rt and RayTracedGL1 and then copy libRayTracedGL1.so, prboom-plus, prboom-plus.wad, and the orvd folder to an installation directory.

#!/bin/bash

# Cloning prboom-plus-rt and RayTracedGL1
git clone https://github.com/sultim-t/prboom-plus-rt.git
cd prboom-plus-rt
mkdir dependencies
cd dependencies
git clone -b doom https://github.com/sultim-t/RayTracedGL1.git
cd RayTracedGL1

# Configuring and building libRayTracedGL1
mkdir build
cd build
cmake .. -DRG_WITH_SURFACE_XLIB=ON
make -j$(nproc)

# Workaround to prevent building prboom-plus-rt from yelling at us for RayTracedGL1/Build/RelWithDebInfo/libRayTracedGL1.so not existing
cd ..
mkdir -p Build/RelWithDebInfo
cp build/libRayTracedGL1.so Build/RelWithDebInfo/

# Configuring and building prboom-plus-rt
cd ../../prboom2
mkdir build
cd build/
RTGL1_SDK_PATH=$(pwd)/../../dependencies/RayTracedGL1 cmake ..
make -j$(nproc)

# Installing prboom-plus-rt to a directory
cd ../..
mkdir installdir
cp prboom2/build/prboom-plus installdir
cp prboom2/build/prboom-plus.wad installdir
cp dependencies/RayTracedGL1/build/libRayTracedGL1.so installdir
curl -o winprboom.zip -L --output-dir installdir https://github.com/sultim-t/prboom-plus-rt/releases/download/v2.6.1-rt1.0.7/prboom-rt-1.0.7.zip
unzip installdir/winprboom.zip "ovrd/*" -d installdir
rm installdir/winprboom.zip

# Telling the user additional steps
echo -e "\n\n"
echo "To run the game please place a legally obtained copy of doom.wad in /usr/share/doom/"
echo "To use an enhanced music pack, download OGG Pack (Boosted) from https://sc55.duke4.net/games.php#doom and place the MUSIC folder in the same directory as prboom-plus"
SpidFightFR commented 9 months ago

My guess that you miss glu package, probably freeglut-devel for Fedora?

That was it. If it's a hard requirement, cmake should throw an error when it's missing. Thanks!

Edit: Compiles, but still refuses to run. Command line: RADV_PERFTEST=rt ./prboom-plus -iwad /home/jbennett/.local/share/Steam/steamapps/common/DOOM\ 3\ BFG\ Edition/base/wads/DOOM2.WAD

SetRatio: gl_ratio 1.600000
SetRatio: multiplier 1/1
prboom-plus: /home/jbennett/src/prboom-plus-rt/dependencies/RayTracedGL1/Source/Common.h:75: void RTGL1::VK_CHECKERROR(VkResult): Assertion `r == VK_SUCCESS' failed.
I_SignalHandler: Exiting on signal: Aborted

Edit Edit: RayTracedGL1 had to be compiled with "-DRG_WITH_NVIDIA_DLSS=OFF " to get the game to launch at all.

Even with -DRG_WITH_NVIDIA_DLSS=OFF i get the error... Any idea ?

Edit 1: Also i'm missing the shaders and noise files in RayTracedGL1... Edit 2: Building with -DRG_WITH_SURFACE_WAYLAND=ON doesn't seem to work

Error when compiling RTGL1 ``` -- The CXX compiler identification is GNU 12.2.0 -- The C compiler identification is GNU 12.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Adding Vulkan. VulkanSDK: -- Found Vulkan: /lib/libvulkan.so (found version "1.3.268") missing components: glslc glslangValidator -- RG_WITH_EXPORTS enabled. RTGL1 functions are exported. -- RG_WITH_SURFACE_WAYLAND enabled -- Configuring done (0.4s) -- Generating done (0.0s) -- Build files have been written to: /home/spid/doom/doom-rt-dir/prboom-plus-rt/dependencies/RayTracedGL1/build [ 2%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/VulkanDevice.cpp.o [ 2%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/Buffer.cpp.o [ 5%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/RTGL1.cpp.o [ 5%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/RTGL1A.cpp.o [ 6%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/Scene.cpp.o [ 7%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/PhysicalDevice.cpp.o [ 8%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/Queues.cpp.o [ 10%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/Swapchain.cpp.o [ 11%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/GlobalUniform.cpp.o [ 12%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/CommandBufferManager.cpp.o /home/spid/doom/doom-rt-dir/prboom-plus-rt/dependencies/RayTracedGL1/Source/VulkanDevice.cpp: In static member function 'static VkSurfaceKHR_T* RTGL1::VulkanDevice::GetSurfaceFromUser(VkInstance, const RgInstanceCreateInfo&)': /home/spid/doom/doom-rt-dir/prboom-plus-rt/dependencies/RayTracedGL1/Source/VulkanDevice.cpp:1767:40: error: cannot convert 'VkSurfaceKHR_T**' to 'VkResult' in assignment 1767 | r = (instance, &wlInfo, nullptr, &surface); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ | | | VkSurfaceKHR_T** [ 13%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/ShaderManager.cpp.o [ 15%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/RayTracingPipeline.cpp.o [ 16%] Building CXX object CMakeFiles/RayTracedGL1.dir/Source/VertexCollector.cpp.o make[2]: *** [CMakeFiles/RayTracedGL1.dir/build.make:104: CMakeFiles/RayTracedGL1.dir/Source/VulkanDevice.cpp.o] Error 1 make[2]: *** Attente des tâches non terminées.... make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/RayTracedGL1.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 ```

Edit 3: It might be why i get no shaders files i suppose ???

SpidFightFR commented 6 months ago

image

I solved all the issues with the compiling process. more info coming ASAP (it's 11pm, i just worked on this for 2 days straight, but it somewhat works, i just needed to move the shaders file from a compiled binary into the game files.

I made forks with most of my issues solved, it should be enough for the tinkerers out there.

ColinSalem commented 2 months ago

image

I solved all the issues with the compiling process. more info coming ASAP (it's 11pm, i just worked on this for 2 days straight, but it somewhat works, i just needed to move the shaders file from a compiled binary into the game files.

I made forks with most of my issues solved, it should be enough for the tinkerers out there.

Any chance we could get an update on this?

SpidFightFR commented 2 months ago

image I solved all the issues with the compiling process. more info coming ASAP (it's 11pm, i just worked on this for 2 days straight, but it somewhat works, i just needed to move the shaders file from a compiled binary into the game files. I made forks with most of my issues solved, it should be enough for the tinkerers out there.

Any chance we could get an update on this?

Sorry, i completely forgot about that. I'm not at home atm, when i can, i'll publish the script i've made for that task.

In the meantime, i've pinned the 2 forks of DOOM-RT, you might get something out of it, if you know what you're doing.

SpidFightFR commented 2 months ago

Hey, here is the gist to my script.

I use a custom artix (runit) virtual machine for compilation, you can use another distro. Tho make sure you have the base-devel tools (make, cmake, etc) alongside some headers for xcb and stuff... Cuz yes, it only builds on xcb for me. Xlib is deprecated and wayland doesn't work.

that should be it, if you run this script on a base arch it might work, but it will most certainly need some packages changes.

Hope that helps !

iirc you'll still need the shaders from the binary archive in the release tab, i didn't manage to obtain them from source (yet)