Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling on raspberry pi 4 (with vulkan driver installed) #121

Closed
nex86 opened this issue Feb 5, 2021 · 22 comments
Closed

compiling on raspberry pi 4 (with vulkan driver installed) #121

nex86 opened this issue Feb 5, 2021 · 22 comments
Labels
porting porting to another OS/Platform

Comments

@nex86
Copy link

nex86 commented Feb 5, 2021

I tried to compile Open Gothic on a raspberry pi 4 but fails at "-MSSE2: unknown parameter"
is it even possible to compile this on an ARM chip or do you really need SSE2?

@Try
Copy link
Owner

Try commented Feb 6, 2021

Hi, @nex86 !
The game itself is not using SSE2 or Neon, but this flag may come from libsquish.
Can you try to set BUILD_SQUISH_WITH_SSE2=OFF in cmake build line?
Can you show a full build log?

@ip0p
Copy link

ip0p commented Feb 7, 2021

I tried to compile Open Gothic on a raspberry pi 4 but fails at "-MSSE2: unknown parameter"
is it even possible to compile this on an ARM chip or do you really need SSE2?

Hey @nex86 ! Cool to see someone else testing this. :D
Yes it compiles! @Try is right you just have to disable SSE2. I also had to change some Texture Format in the Renderer (more infos in the issue on Tempest repo). I'm trying to get this running for a while now. Currently I can hit start and see the loading screen but after that I come back to the menu.

Try added a commit that referenced this issue Feb 7, 2021
We don't use squish actively anyways
#121
@ip0p
Copy link

ip0p commented Feb 8, 2021

This is how far it gets. Also an error message. Maybe because of the texture format change?
image

@Try
Copy link
Owner

Try commented Feb 8, 2021

  1. Turns out that RG16 is not mandatory in Vulkan.
R16G16_UNORM 98.81% 1.19%

And 1.19 % of GPU's doesn't support it!
2. RGBA8 is fine - can be changed to anything for now.
3. Sounds like a ZenLib issue:

// zenParser.cpp:110
void ZenParser::readHeader(ZenHeader& header, ParserImpl*& impl)
{
    if (!skipString("ZenGin Archive"))
        THROW("Not a valid format");

@ip0p
Copy link

ip0p commented Feb 8, 2021

OK. I can maybe check this evening if I can get more infos.

@ip0p
Copy link

ip0p commented Feb 8, 2021

I added some debug logs... (My breakpoint debugging is not working. need to figure out how to configure VS Code correctly)
But it outputs nothing. :( How can I enable the default logging of Zenlib? I'm still not so familar with C++. ^^
image

@Try
Copy link
Owner

Try commented Feb 8, 2021

How can I enable the default logging of Zenlib?

What exactly do you mean by default logging? std::cout should just work.

@ip0p
Copy link

ip0p commented Feb 9, 2021

Nvm I thought the LogInfo() wasn't working... I recopied a fresh G2 install to the pi and now it kind of works! The intro plays after that I see a black screen with mana and health bar. Then the whole system freezes. I will try again with reduced resolution after work in the evening. But I have the feeling that its too heavy to handle for the pi.

@nex86
Copy link
Author

nex86 commented Feb 9, 2021

But I have the feeling that its too heavy to handle for the pi.

I was thinking about that as well,
My original thought was to get it working on the Nintendo Switch with L4T Ubuntu since it has a well working Vulkan driver and better performance.
But the issue was it being based on 18.04 and the depencies are too old to get it compiled.
The issue I had was with cmake I think, and installing cmake manually gave me an error about a missing OpenSSL development package that is not in the repo.
And the 20.04 update is very unstable.

This is why I continued the work on the raspberry pi.

@Try
Copy link
Owner

Try commented Feb 9, 2021

I will try again with reduced resolution after work in the evening.

./Gothic2Notr -w dragonisland.zen :)

@ip0p
Copy link

ip0p commented Feb 10, 2021

I will try again with reduced resolution after work in the evening.

./Gothic2Notr -w dragonisland.zen :)

this is how far it gets with dragonisland. just UI + black screen. after that the system freezes. didn't had time to figure out resolution change. (feature request: please add command line parameters for resolution! ;))

@Schlumpf7
Copy link

Hi there,
any progress on running openGothic on the Pi 4. I'm very interested in this, too.

@ip0p
Copy link

ip0p commented May 17, 2021

hey @Schlumpf7!
I never tried again since then. Maybe its a good time to try again. ^^

@nex86
Copy link
Author

nex86 commented May 17, 2021

I'm not even sure if the PI4s vulkan driver is even usable for this since its still WIP.
My original goal was to get this to work on the Nintendo Switch over L4T Linux.
Its got amazing Vulkan support on the Switch, since its using the official nvidia driver.
But the issue were outdated depencies and I couldn't get newer ones via repo.
However, I could try it again or even with arch linux now since its available.

@Schlumpf7
Copy link

Here are my errors for making it:
make[2]: *** [lib/Tempest/Engine/CMakeFiles/Tempest.dir/build.make:584: lib/Tempest/Engine/CMakeFiles/Tempest.dir/gapi/vulkan/vcommandbuffer.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1013: lib/Tempest/Engine/CMakeFiles/Tempest.dir/all] Error 2
It would be nice if you could provide support for it :)

@Try
Copy link
Owner

Try commented May 19, 2021

Hi, @Schlumpf7 !

Error 1

This doesn't look like full error message, was there any other output be compiler?

@Try Try added the porting porting to another OS/Platform label Jul 29, 2021
@clort81
Copy link

clort81 commented Oct 12, 2021

I have a jetson nano and pixel-c here which both can run nvidia's vulkan drivers.

The nano comes with Ubuntu but can be transformed to devuan ceres without too much effort, then you have a modern system for building.

@TlalkaM
Copy link

TlalkaM commented Dec 1, 2021

Hi!
First of all thanks for bringing gothic engine to the open source!
Today i successfully compiled and run OpenGothic on rpi4 4gb model. I'm on manjaro (aarch64) with mesa-git package and vc4-kms-v3d-pi4 driver. But the performance is quite lacking, around 1fps at 1024x768 but here is the screenshot, everything is looking quite ok, only the shadows looks kinda querky. Sounds play fine, and the cpu load is hanging around 2 so i think the gpu is the major bottleneck.
www

Are there any environment variables or directives in ini file to lower the render distance and turn off shadows?

To compile successfully i only had to download contrib folder from the libpng repo and insert it in the libpng lib source code folder.

Also i think the gpu has some kind of problem, because when i try to launch game 9/10 times i got error shown below, i don't know what changes when game runs, but i just rerun the run script and somtimes it works.

OpenGothic v1.0 dev

---crashlog(std::terminate)---
GPU: ?
#1: std::terminate - /usr/lib/libstdc++.so.6(+0x9cbf0) [0xffffb4b5abf0]
#2: __cxa_rethrow - /usr/lib/libstdc++.so.6(__cxa_rethrow+0x80) [0xffffb4b5b030]
#3: Tempest::Detail::VSwapchain::VSwapchain(Tempest::Detail::VDevice&, Tempest::SystemApi::Window*) - /home/mtlalka/git/OpenGothic/build/opengothic/libTempest.so(_ZN7Tempest6Detail10VSwapchainC2ERNS0_7VDeviceEPNS_9SystemApi6WindowE+0x17c) [0xffffb4de996c]
#4: Tempest::VulkanApi::createSwapchain(Tempest::SystemApi::Window*, Tempest::AbstractGraphicsApi::Device*) - /home/mtlalka/git/OpenGothic/build/opengothic/libTempest.so(_ZN7Tempest9VulkanApi15createSwapchainEPNS_9SystemApi6WindowEPNS_19AbstractGraphicsApi6DeviceE+0x2c) [0xffffb4debbcc]
#5: Tempest::Device::swapchain(Tempest::SystemApi::Window*) const - /home/mtlalka/git/OpenGothic/build/opengothic/libTempest.so(_ZNK7Tempest6Device9swapchainEPNS_9SystemApi6WindowE+0x28) [0xffffb4def288]
#6: Tempest::Swapchain::Swapchain(Tempest::Device&, Tempest::SystemApi::Window*) - /home/mtlalka/git/OpenGothic/build/opengothic/libTempest.so(_ZN7Tempest9SwapchainC1ERNS_6DeviceEPNS_9SystemApi6WindowE+0x40) [0xffffb4df2100]
#7: MainWindow::MainWindow(Tempest::Device&) - /home/mtlalka/git/OpenGothic/build/opengothic/Gothic2Notr(_ZN10MainWindowC2ERN7Tempest6DeviceE+0x64) [0xaaaadc4be6f8]
#8: main - /home/mtlalka/git/OpenGothic/build/opengothic/Gothic2Notr(main+0x110) [0xaaaadc3edaf0]

Aborted (core dumped)

But sometimes i'm able to lauch, and the game works normally with this output

OpenGothic v1.0 dev
AL lib: (EE) ALSANoMMapProc: available update failed: Broken pipe
GPU = V3D 4.2
Depth format = 14 Shadow format = 4
Info: ZEN: Reading presets...
swapchain is outdated - reset renderer
Info: ZEN: Reading world...
Info: oCWorld reading chunk: MeshAndBsp
Info: ZEN: Reading mesh...
Info: Reading mesh '' (Version: 265)
Info: Found 260696 vertices
Info: ZEN: Done reading mesh!
Info: oCWorld reading chunk: VobTree
Info: oCWorld reading chunk: WayNet
Info: Loading 1 freepoints
Info: Loading 3402 edges
Info: Done loading edges!
Info: ZEN: Reading presets...
...

@Try
Copy link
Owner

Try commented Dec 1, 2021

Hi, @TlalkaM !

Are there any environment variables or directives in ini file to lower the render distance and turn off shadows?

No, the only way for now is to hack into source code: renderer.cpp, here is the diff:

diff --git a/game/graphics/renderer.cpp b/game/graphics/renderer.cpp
index 8f1a48a..05d4641 100644
--- a/game/graphics/renderer.cpp
+++ b/game/graphics/renderer.cpp
@@ -139,10 +139,10 @@ void Renderer::draw(Tempest::Attachment& result, Tempest::Encoder<CommandBuffer>

   wview->setViewProject(view,proj);
   wview->setModelView(viewProj,shadow,Resources::ShadowLayers);
-  const Texture2d* sh[Resources::ShadowLayers];
-  for(size_t i=0; i<Resources::ShadowLayers; ++i)
-    sh[i] = &textureCast(shadowMap[i]);
-  wview->setFrameGlobals(sh,Gothic::inst().world()->tickCount(),cmdId);
+  // const Texture2d* sh[Resources::ShadowLayers];
+  // for(size_t i=0; i<Resources::ShadowLayers; ++i)
+  //   sh[i] = &textureCast(shadowMap[i]);
+  wview->setFrameGlobals(nullptr,Gothic::inst().world()->tickCount(),cmdId);
   wview->setGbuffer(textureCast(lightingBuf),textureCast(gbufDiffuse),textureCast(gbufNormal),textureCast(gbufDepth));

   {
@@ -154,8 +154,8 @@ void Renderer::draw(Tempest::Attachment& result, Tempest::Encoder<CommandBuffer>
   }

   for(uint8_t i=0; i<Resources::ShadowLayers; ++i) {
-    cmd.setFramebuffer({{shadowMap[i], Vec4(), Tempest::Preserve}}, {shadowZ[i], 0.f, Tempest::Preserve});
-    wview->drawShadow(cmd,cmdId,i);
+    //cmd.setFramebuffer({{shadowMap[i], Vec4(), Tempest::Preserve}}, {shadowZ[i], 0.f, Tempest::Preserve});
+    //wview->drawShadow(cmd,cmdId,i);
     }

   cmd.setFramebuffer({{lightingBuf, Vec4(),           Tempest::Preserve},

@TlalkaM
Copy link

TlalkaM commented Dec 1, 2021

Thanks for patch! After patching and recompiling it's 100% better! Now it's 2 fps and the game looks similar to original :) Only some light sources pass thru solid objects, like this tower on screenshot :)
asd

I'll try maybe to overclock and do some tweaks on the os side to maybe improve that, but my hopes aren't high.

@Try Probably off-topic but do You have any plans to also implement OpenGL as graphics api?

@Try
Copy link
Owner

Try commented Dec 1, 2021

For performance side of things, you may want to look here: #188

Do you know, HW specs of underlying hardware? I mean, pixels per second and triangles per second - that will help identify bottlenecks.

OpenGL as graphics api?

No, too much work and pointless - by the time job is done opengl will be completely dead :)

@Nindaleth
Copy link
Contributor

There's not much fillrate info to find on RPi4 GPU - it uses VideoCore VI (VC6) which is said (source1, source2) to provide around 32 GFLOPS and 2.5 Gpixel/s.

For the record, the original RPi GPU (VC4) is listed to provide 24 GFLOPS, 1 Gpixel/s and 1.5 Gtexel/s.

@Try Try closed this as completed Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
porting porting to another OS/Platform
Projects
None yet
Development

No branches or pull requests

7 participants