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

Getting stuck on Initializing OpenGL subsystem #386

Closed
hazelnot opened this issue Jun 14, 2021 · 18 comments
Closed

Getting stuck on Initializing OpenGL subsystem #386

hazelnot opened this issue Jun 14, 2021 · 18 comments

Comments

@hazelnot
Copy link

I'm trying to launch dhewm3 but it keeps getting stuck on Initializing OpenGL subsystem, no idea why.

I'm running it on Arch Linux. I pasted the terminal output into a text file:

dhewm_log.txt

@DanielGibson
Copy link
Member

Weird - can you run it again with +set developer 1 (in addition to your other arguments to dhewm3) and post the output you get then?

Also, what GPU and driver are you using? Do other games work?

@hazelnot
Copy link
Author

I can't even copy the full output because it becomes an infinite string of Couldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find matching GLX visualCouldn't set GL mode 8/16/8: Couldn't find match

Also I'm using a Radeon RX 5700 XT, with the default Mesa drivers, from what I can tell. Other games work just fine, yes.

DanielGibson added a commit that referenced this issue Jun 15, 2021
shouldn't have reused i in the inner loop..
@DanielGibson
Copy link
Member

DanielGibson commented Jun 15, 2021

Ahh, good to know - I think I just found a very stupid bug in that code that would explain your problem.

Can you test if this change fixes it: 06390e8 ?

(Or test the whole branch: https://github.com/dhewm/dhewm3/tree/gamma-in-shader)

Thanks in advance! :)

@hazelnot
Copy link
Author

The game launches on that branch, but now every texture is extremely messed up:

Screenshot from 2021-06-17 14-32-25
Screenshot from 2021-06-17 14-31-58

@DanielGibson
Copy link
Member

groovy!

can you post the new terminal output (with r_developer 1)?

@hazelnot
Copy link
Author

Is r_developer 1 the same thing as +set developer 1?

@DanielGibson
Copy link
Member

yes, that's what I meant, sorry

@hazelnot
Copy link
Author

Here it is, menu + loading a save:

dhewmlog2.txt

@DanielGibson
Copy link
Member

Thanks!

This is weird - it looks absolutely ok: Got 8 stencil bits, 24 depth bits, color bits: r8 g8 b8 a8 means that you got the 32bit color profile that was requested (I was thinking that maybe for some reason you only got 16 colors or something and that this might cause the flatshaded look), compiling/loading the shaders also succeeded (otherwise errors would've been logged) and there are no other errors or warnings either.

My best guess is that something is wrong with your driver - maybe a regression in support for OpenGL ARB shaders (almost noone uses them, which could explain that other games work)?
To narrow down the problem you could try if https://github.com/gabrielcuvillier/d3wasm works better - it can be compiled natively on Linux (not just for browsers) and uses a OpenGL ES 2.0 rendering backend with GLSL shaders

@hazelnot
Copy link
Author

hazelnot commented Jun 17, 2021

Yup that works fine other than not being able to set the resolution to my actual native one (1440p)

DanielGibson added a commit that referenced this issue Jun 20, 2021
shouldn't have reused i in the inner loop..
@DanielGibson
Copy link
Member

@Yamagi ran into the same messed up texture problem (but not the getting stuck problem) and it turned out that it was introduced with this commit: dc42bdc
And more specifically, is triggered by reloadARBprograms, even when manually running that console command in older versions of dhewm3.

Furthermore, I still can't reproduce that issue on my XUbuntu 20.04 box with an Radeon RX580; he's using an RX 5700XT on Arch Linux.
My relevant version lines from glxinfo:
OpenGL renderer string: Radeon RX 580 Series (POLARIS10, DRM 3.35.0, 5.4.0-74-generic, LLVM 11.0.0)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.2.6
His corresponding lines:
OpenGL renderer: AMD Radeon RX 5700 XT (NAVI10, DRM 3.40.0, 5.12.8-1-custom, LLVM 11.1.0)
OpenGL version: 4.6 (Compatibility Profile) Mesa 21.1.1

So it seems possible that either this is a Polaris vs Navi problem or, more likely, an issue introduced in Mesa 21 (or at least in some version between 20.2.6 and 21.1.1).

As it works everywhere else (and on older mesa versions; also on the same XUbuntu 20.04 version with an intel iGPU on my laptop) this looks like a regression in Mesa, though I have no idea why it would be broken only after reloading the shaders.
I might be able to work around it by making sure the shaders are only loaded once at startup.

@hazelnot
Copy link
Author

hazelnot commented Jun 23, 2021

Here's my glxinfo stuff, in case it helps:

OpenGL renderer string: AMD Radeon RX 5700 XT 50th Anniversary (NAVI10, DRM 3.40.0, 5.12.12-arch1-1, LLVM 12.0.0)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.1.3

@DanielGibson
Copy link
Member

Thanks!

@DanielGibson
Copy link
Member

DanielGibson commented Jun 24, 2021

I just pushed a commit to the master branch that should work around this issue, can you test it?
Thanks! :)

@hazelnot
Copy link
Author

Hey it worked! Thanks!

@DanielGibson
Copy link
Member

Awesome, thanks for the confirmation!

@DanielGibson
Copy link
Member

I installed the oibaf PPA mesa version (21.2.0-devel 2021-06-26) on my machine with the Radeon RX580 and can reproduce the glitches, so it seems like the bug indeed is specific to newer Mesa versions (and not to Polaris vs Navi)

@DanielGibson
Copy link
Member

I created a bugreport at Mesa's bugtracker: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5001

DanielGibson added a commit that referenced this issue Jan 20, 2022
that was an important fix
rorgoroth pushed a commit to rorgoroth/dhewm3 that referenced this issue Apr 8, 2023
shouldn't have reused i in the inner loop..
rorgoroth pushed a commit to rorgoroth/dhewm3 that referenced this issue Apr 8, 2023
this *shouldn't* matter, but due to some Mesa bug is does:
If the shaders have been loaded already (with R_LoadARBProgram()),
then loading them again (like from the `reloadARBprograms` console cmd
or as it happens if the `r_gammaInShader` has been modified) will
cause glitches with the open source radeonsi driver (maybe also with
others? at least the open source intel driver seems unaffected).
As r_gammaInShader was marked as modified at startup (before the shaders
were even loaded) they were loaded twice: First as expected when OpenGL
is initialized, then again in R_CheckCvars() which is executed each
frame. Marking as at not modified in R_InitOpenGL() prevents this and
thus works around the bug.
However this means that changing r_gammaInShader at runtime will still
trigger this bug (while with non-broken drivers it switches seamlessly
between gamma in shader and gamma in hardware without a vid_restart).
rorgoroth pushed a commit to rorgoroth/dhewm3 that referenced this issue Apr 8, 2023
that was an important fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants