Created attachment 141109 [details]
Lack of rendered image
Slightly obtuse issue as it's a game inside Wine.
No Man's Sky used to work if you faked a compatibility profile. This no-longer works as, since the last game update, it seems they are actually using some of the COMPAT mode features. The result of this is that the game menu renders fine, but any of the "3D" graphics in the game are either missing or just render completely white.
e.g. the starfield during loading should be various pinkish colours, but instead you just see a black screen. Once in-game, you should see the game world, but instead just have a (what seems to be non-refreshing) white screen.
The game seems to be fine on Nvidia cards using their proprietary driver.
Attached is an image of the issue to see specific what I'm referring to and a trace, from launch of the game, to a few minutes in game, to exiting the game. Generated with APITrace (I'll attach the trace in the next comment).
Created attachment 141110 [details]
when replaying the trace I see some compilation issues:
227035: message: major shader compiler error 2: 0:25(25): error: no matching function for call to `texture2DLod(sampler2D, vec2, float)'; candidates are:
227035: message: major shader compiler error 3: 0:25(17): error: operands to arithmetic operators must be numeric
and there are some 0:1294(3): preprocessor error: Unterminated #if
I think this is mostly due to uncompiled shaders, maybe there is more to it, but we should concentrate on those issues first.
Created attachment 141122 [details]
APITrace Playback Log
As it may contain something useful.
(In reply to Benjamin Hodgetts from comment #1)
> Created attachment 141110 [details]
> ~900MB uncompressed.
Please don't attach large traces to the bug itself instead please upload to an external site such as google drive.
It seems you have captured the trace without using overrides. You must use MESA_GL_VERSION_OVERRIDE=4.5COMPAT for NMS to work correctly. Also there is a drirc option that is needed for the game to work correctly (you can also set it from the command line for testing) force_glsl_extensions_warn=true.
Do these two environment vars fix the issues for you?
I haven't tried force_glsl_extensions_warn, but MESA_GL_VERSION_OVERRIDE=4.5COMPAT doesn't help. It worked on older versions of the game, but has no positive effect with the current version of the game (aka No Man's Sky NEXT).
(In reply to Benjamin Hodgetts from comment #6)
> I haven't tried force_glsl_extensions_warn, but
> MESA_GL_VERSION_OVERRIDE=4.5COMPAT doesn't help. It worked on older versions
> of the game, but has no positive effect with the current version of the game
> (aka No Man's Sky NEXT).
The override used to be broken and actually caused you to get an OpenGL core like profile. Since this is now fixed things will have changed, this is not a regression.
Please try using force_glsl_extensions_warn=true it works around some game bugs.
Created attachment 141209 [details] [review]
hack around preprocessor stringification
Ok I've taken a closer look and there is indeed new issues with this game besides the existing ones.
Shaders include preprocessor stringification which is legal in C by not specified in the GLSL spec e.g.
#define DOMAIN_PARAMS(dmn) ROOT_SIG(DS) [domain(#dmn)]
I've hacked around that with the following patch but then hit further shaders that fail to compile "unexpected LAYOUT_TOK"
>Please try using force_glsl_extensions_warn=true it works around some game bugs.
That generated the two new messages in the terminal...
ATTENTION: default value of option force_glsl_extensions_warn overridden by environment.
ATTENTION: option value of option force_glsl_extensions_warn ignored.
... so I assume it was picked up properly, but rendering behaviour didn't change. The nebula clouds were still missing on the loading screen (so space is just black) and in-game looked the same as the screenshot I originally posted (screen is just white except for the menu). All in all, no change.
I'll try with your hack patch and see if that changes behaviour.
BTW, the attachment limit on bugs is 4GB and my attachment was 286MB. If people shouldn't post large attachments then it's probably worth lowering that limit, otherwise people have no way of knowing that they aren't supposed to attach large files.
Applied the patch in attachment 141209 [details] [review] and rebuilt, but the game looks the same. Something of note is that it's supposed to build the shaders on the first load of the game, but the SHADERCACHE folder of the game is remaining empty (I assume as the shaders are failing to build).
(In reply to Benjamin Hodgetts from comment #11)
> Applied the patch in attachment 141209 [details] [review] [review] and rebuilt, but
> the game looks the same. Something of note is that it's supposed to build
> the shaders on the first load of the game, but the SHADERCACHE folder of the
> game is remaining empty (I assume as the shaders are failing to build).
The hack should make the planets/stars render correctly on the shader loading screen. It also helps the sky render in-game, everything else is missing but I'm sure it's because of the remaining failing shaders. All in all this game is extremely buggy. Do you know if it actually renders correctly on the AMD windows drivers?
AFAIK it works fine on Windows. The only people that had issues were people with old cards (e.g. 6000 series and below, due to lack of support).
Just to clarify, you're using the latest version of the game, labeled "NEXT"?
I've just rebuilt Mesa again with your patch, no CCache or anything this time, just in case. I'm still getting no clouds on the loading screen (you can see the stars as white dot and the names, but there's no colour, everything is just black and white) and then when it gets "in game" the menu is there, but the screen is still just white.
I wonder if the card is specific here:
OpenGL renderer string: Radeon RX 580 Series (POLARIS10, DRM 3.26.0, 4.18.3-1-clear, LLVM 8.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.3.0-devel (git-9e5e3a8ead)
Created attachment 141230 [details] [review]
hack around layout qualifiers
The next shader compilation problem is that they are applying layout qualifiers to function params. e.g
layout( r32i ) iimage2D lFeedbackMap, < --------
uint liFeedbackIndex )
layout( r32i ) can only be applied to uniforms.
I've attached another hack that together with the other hack makes the game playable for me.
Looks like I lost MESA_GL_VERSION_OVERRIDE=4.5COMPAT somewhere along the line which is why I couldn't see anything. That, plus force_glsl_extensions_warn=true and your two patches does indeed work.
The starfield renders now but it's still missing the coloured cloud nebulae (this - https://cdn.cnn.com/cnnnext/dam/assets/150617071718-game-faces-no-mans-sky-ns-natpkg-00014710-large-169.jpg).
So it seems your patches (and the overrides) get us most of the way there.
I've been following this issue since it was reported and I would like to contribute if I can. Since the bug status is currently "NEEDINFO" I will endeavor to provide corroborating details and offer my platform for investigation and testing.
I can begin by validating everything discussed in the comments so far. The issue presents itself on my platform exactly as Benjamin documented. My platform only differs slightly:
OpenGL renderer string: Radeon RX Vega (VEGA10, DRM 3.26.0, 4.18.4-gentoo, LLVM 6.0.1)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.2.0-rc4
The patches Timothy provided apply and build perfectly, and with the suggested environment variables set while running NMS I can also exactly reproduce Benjamin's result. World assets render correctly; the game is playable; the galaxy map "clouds" are not visible; there appear to be significant artifacts in the semi-transparent background textures of most UI elements (conversation dialogs and the tab menu).
My first attempt at reproducing the problem and using the proposed patches was done on Mesa 18.2.0-rc4 built from source, but I have no problem in principle with testing further against the current 18.3.0 development branch.
I am happy to test additional patches and gather any additional information upon request. Thank you for starting the work.
(In reply to Matthew Vaughn from comment #17)
> The patches Timothy provided apply and build perfectly, and with the
> suggested environment variables set while running NMS I can also exactly
> reproduce Benjamin's result. World assets render correctly; the game is
> playable; the galaxy map "clouds" are not visible; there appear to be
> significant artifacts in the semi-transparent background textures of most UI
> elements (conversation dialogs and the tab menu).
The artifacts should be fixed by the zerovram part of this patch series  which you can already do with the following environment var R600_DEBUG=zerovram
I've reported the shaders bugs from this bug report to the No Mans Sky devs and also created some CTS tests to expose them on the Nvidia driver so hopefully they will get fixed in the game.
As for the missing nebulae I'm not sure what the problem is there. All I know is it was working before the last game update and I suspect there may have been another bug introduced somewhere. I'll have another look tomorrow but I'm probably not going to spend too much time on that issue since the game is otherwise now playable.
Thanks for all the work so far Timothy.
(In reply to Benjamin Hodgetts from comment #19)
> Thanks for all the work so far Timothy.
No problem. Thanks for reporting the issues.
I've now pushed patches to enable OpenGL 4.5 compat for radeonsi. I've fixed a bug in the lexer that was causing some shaders to fail to compile, and I've added a workaround to another shader bug in the game that they don't currently want to work around as the Nvidia driver depends on the buggy shaders. So as of git master a couple of minutes ago No Mans Sky should run out of the box no manual environment vars required.
As for the missing nebulae there is a shader failing to compile as they are missing an #endif to go with an #ifdef. This is my guess as to why its failing to display, and I've let the NMS devs know about it. If I'm correct this issue should be present even on Nvidia drivers currently.
So with that I think we can now close this bug.
*** Bug 107778 has been marked as a duplicate of this bug. ***
Just an FYI, testing with Mesa GIT this morning and the coloured space nebulae are being rendered correctly as well. Additionally the weird garbage/distortion below the "NEXT" notification when you first start the game has also disappeared.