Bug 93144

Summary: [radeonsi] Alien: Isolation feature request
Product: Mesa Reporter: Stepan Bakshaev <step2back+freedesktop>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: 0xe2.0x9a.0x9b, aaalmosss, alexandre.f.demers, darkbasic, marcus.hewat
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=93840
Whiteboard:
i915 platform: i915 features:
Attachments: Rendering bug
Video of gameplay
Openning cutscene I guess it is on game engine
Openning cutscene I guess it is on game engine 2
SSAO set to HDAO (less flickery, too dark)

Description Stepan Bakshaev 2015-11-27 16:39:53 UTC
Created attachment 120177 [details]
Rendering bug

Menu, opening clip, opening cutscene on game engine (I guess game engine renders it) render fine. There is bug in first gameplay. I attached screenshot and video of it. The game is on sale before 1 december in steam. I can purchase it as gift (one or two copies) for assigned developer.
Comment 1 Stepan Bakshaev 2015-11-27 16:41:16 UTC
Created attachment 120178 [details]
Video of gameplay
Comment 2 Stepan Bakshaev 2015-11-27 16:49:21 UTC
I forget to attach important information.

OpenGL renderer string: Gallium 0.4 on AMD CAPE VERDE (DRM 2.43.0, LLVM 3.8.0)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.2.0-devel (padoka PPA)

mesa git151127001200.27a88a9 https://launchpad.net/~paulo-miguel-dias/+archive/ubuntu/mesa/+sourcepub/5729700/+listing-archive-extra 
llvm svn254183 https://launchpad.net/~paulo-miguel-dias/+archive/ubuntu/mesa/+sourcepub/5730044/+listing-archive-extra

packages from https://launchpad.net/~paulo-miguel-dias/+archive/ubuntu/mesa/

Linux silver 4.2.0-10-generic #12-Ubuntu SMP Tue Sep 15 19:43:01 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD 7770/8760 / R7 250X]
Comment 3 Stepan Bakshaev 2015-11-27 17:15:52 UTC
Created attachment 120179 [details]
Openning cutscene I guess it is on game engine
Comment 4 Stepan Bakshaev 2015-11-27 17:16:09 UTC
Created attachment 120180 [details]
Openning cutscene I guess it is on game engine 2
Comment 5 Marcus 2015-12-10 22:29:11 UTC
I confirm I have the same rendering issue, all rendering OK until the first gameplay. During first gameplay, the body of the player seems mostly OK but the environment flashes violently.

Running
Distribution: ubuntu 15.10
Latest Linux kernel: 4.4.0-040400rc4-generic
OpenGL renderer string: Gallium 0.4 on AMD PITCAIRN (DRM 2.43.0, LLVM 3.8.0)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.2.0-devel (padoka PPA)
Comment 6 Nicolai Hähnle 2015-12-11 00:26:18 UTC
Could one of you record an apitrace of this behavior?
Comment 7 Stepan Bakshaev 2015-12-11 05:21:56 UTC
I will try to figure out how and do api trace on saturday.
Comment 8 Daniel Scharrer 2015-12-11 13:08:31 UTC
FYI, the game requires OpenGL 4.3 [1] (the porters have mentioned compute shaders specifically [2]), so it *can't* work with radeonsi yet.


[1] See the Linux system requirements on http://store.steampowered.com/app/214490/
[2] https://www.reddit.com/r/linux_gaming/comments/3t5p0r/a/cx3hn8i
Comment 9 Stepan Bakshaev 2015-12-12 13:52:58 UTC
apitrace link
https://drive.google.com/file/d/0BytXisVUnJ7QV1VONjloamZ0WWs/view?usp=sharing

mesa updated to 27d5be0b8fafecefc4f0378ca940cea8c0415715
llvm 255314
Comment 10 Nicolai Hähnle 2015-12-12 20:12:08 UTC
Wait, so if the game requires OpenGL 4.3, why does it even start? Did they mess up their version checking?
Comment 11 Stepan Bakshaev 2015-12-13 06:10:53 UTC
I used page https://www.opengl.org/wiki/Compute_Shader to find out compute shared api calls in opengl. I searched for glDispatchCompute and glDispatchComputeIndirect​with qapitrace. Both were not located in the apitrace.
Comment 12 Tapani Pälli 2015-12-14 05:54:33 UTC
AFAIK this game does not require compute but it does require tessellation. Game renders much better (correct colors, vertex positions) on i965 than the attached video but has bunch of random polygons on top of rendered image which I believe are related to tessellation bugs on i965.
Comment 13 Stepan Bakshaev 2015-12-19 12:11:00 UTC
Please, if it valid bug report and there are other owners of radeonsi video cards are affected change status to CONFIRMED.
Comment 14 Luzipher 2016-01-03 02:30:44 UTC
@Stepan Bakshaev, Comment #13: Well, it's a known issue. There is a video of the same effects on youtube ( https://www.youtube.com/watch?v=n35hwmN3VmQ ) that was made shortly after the release. Also the developers said multiple times it'd need OpenGL 4.3 and especially compute shaders - check Comment #8 or the posts by Feral employees on the steam forum (for example post 32 from [FERAL] Edwin here: http://steamcommunity.com/app/214490/discussions/0/490123938446209677/#p3 ). I don't think it's a bug if the game wants 4.3 and we only got 4.1, and I trust the devs if they say it needs compute shaders. Of course it's a bit strange that it looked better on i965 before they had compute shaders, according to Tapani Pälli in Comment #12.

@Nicolai Hähnle, Comment #10: well, it fires up a dialog that the graphics driver isn't supported and asks you if you want to continue anyway. I think I didn't get that dialog when I forced mesa to 4.3 (it doesn't help). I actually think it's not a bad idea to let the user decide.

To add some not-yet-mentioned info: the effect you see depends on the setting for SSAO (Screen Space Ambient Occlusion). If you set it to "Off" or "Standard" you'll get the flickery colours everywhere. If you set it to "HDAO" it's way less flickery (fog still does), but way too dark. Maybe that's a hint why radeonsi is different compared to i965 ?
Comment 15 Luzipher 2016-01-03 02:38:16 UTC
Created attachment 120771 [details]
SSAO set to HDAO (less flickery, too dark)
Comment 16 Tapani Pälli 2016-01-04 07:49:25 UTC
(In reply to Luzipher from comment #14)
> @Stepan Bakshaev, Comment #13: Well, it's a known issue. There is a video of
> the same effects on youtube ( https://www.youtube.com/watch?v=n35hwmN3VmQ )
> that was made shortly after the release. Also the developers said multiple
> times it'd need OpenGL 4.3 and especially compute shaders - check Comment #8
> or the posts by Feral employees on the steam forum (for example post 32 from
> [FERAL] Edwin here:
> http://steamcommunity.com/app/214490/discussions/0/490123938446209677/#p3 ).
> I don't think it's a bug if the game wants 4.3 and we only got 4.1, and I
> trust the devs if they say it needs compute shaders. Of course it's a bit
> strange that it looked better on i965 before they had compute shaders,
> according to Tapani Pälli in Comment #12.

Yep, I was just guessing there since we did not have compute in extension string at that time .. *but* we did have most of implementation so it is possible that game engine just queried the functions and started using it. When I have time I'll test this again since now we have both compute and tessellation support in place for i965.
Comment 17 Darius Spitznagel 2016-01-24 14:12:14 UTC
I tested this game with my Iris Pro 5200 (i965) and mesa master as GL_ARB_compute_shader for Intel is ready there.

But the game quits right before the 20th Century Fox video should play.
When I disable compute_shader (MESA_EXTENSION_OVERRIDE=-GL_ARB_compute_shader) I can get into the game but all I see are the legs from Ripley, the rest is totally dark. Switching SSAO doesn't help.

I also did an apitrace with disabled compute_shader and can confirm, that the game requests compute_shader right before the start of the 20th Century Fox video.

@Tapani: Did you had time to look into this in the meantime?
Maybe the game also needs GL_ARB_stencil_texturing which is ready for Intel gen8 GPUs but not gen7 (like mine).
I say this because Shadow of Mordor also uses compute_shader but this games works great on Intel gen7 and mesa master.
Comment 18 Alexandre Demers 2016-01-24 15:28:52 UTC
I would suggest to create a different bug for Intel's driver and then to add a "See Also" between both bugs. My suggestion comes from the fact that Intel users and Radeon users seem to have not exactly the visual problem and also because some OpenGL extensions are present in one but not in the other.
Comment 19 Darius Spitznagel 2016-01-24 15:58:59 UTC
(In reply to Alexandre Demers from comment #18)
> I would suggest to create a different bug for Intel's driver and then to add
> a "See Also" between both bugs. My suggestion comes from the fact that Intel
> users and Radeon users seem to have not exactly the visual problem and also
> because some OpenGL extensions are present in one but not in the other.

You are right, sorry.
For Intel see also: https://bugs.freedesktop.org/show_bug.cgi?id=93840
Comment 20 Marek Olšák 2016-02-25 12:26:16 UTC
Why is this bug called "feature request"?
Comment 21 Luzipher 2016-02-29 23:22:14 UTC
(In reply to Marek Olšák from comment #20)
> Why is this bug called "feature request"?

I guess the feature requested is compute shaders ;-) Or GL 4.3 of course, if you prefer.

To clarify: the game wants GL 4.3 and the game devs said it'd require compute shaders - yet it runs on radeonsi (GL 4.1), but with heavy psychedelic flickering (see attachements).
Comment 22 darkbasic 2016-04-02 18:31:21 UTC
Any idea why it doesn't still run even with the compute shader patches? (I didn't test it, that's what I read)
Comment 23 Alexandre Demers 2016-04-02 20:49:31 UTC
(In reply to darkbasic from comment #22)
> Any idea why it doesn't still run even with the compute shader patches? (I
> didn't test it, that's what I read)

You may be a bit too fast. First, the patches haven't been merged in mesa yet to my knowledge. Secondly, it also needs a patched LLVM, which is also not yet included yet.

However, if you apply both sets of patches, who knows. Where did you read about it not working yet?
Comment 24 Alexandre Demers 2016-04-02 21:03:48 UTC
Ok, I saw the comment in Phoronix' forum. I suspect the extension to still be disabled in his case. I'll wait for the patches to be officially merged in mesa and LLVM.
Comment 25 almos 2016-04-02 23:26:16 UTC
I took a look at the trace in comment 9, and it doesn't try to use compute shader AFACT. I tried to run the trace with catalyst, but glretrace immediately exits with error (I think catalyst doesn't support the visual radeonsi used when recording the trace).

I think the cutscene screenshots can be removed, the intro is a prerendered video.
Comment 26 Christoph Haag 2016-04-03 00:39:35 UTC
(In reply to Alexandre Demers from comment #24)
> Ok, I saw the comment in Phoronix' forum. I suspect the extension to still
> be disabled in his case.

glxinfo says opengl 4.2 and that the compute shader extension is there.

I tried making an apitrace, but it turned out to be 6.1 gigabyte, so I'm not uploading that if there's no real need.

I don't know terribly much about shaders, but if I see
68300 @1 glCreateShader(type = GL_COMPUTE_SHADER) = 3085
68301 @1 glShaderSource(shader = 3085, count = 1, string = ["#version 420 core
etc...
68302 @1 glCompileShader(shader = 3085)
in apitrace, doesn't that mean it successfully uses compute shaders?

Mesa: User error: GL_INVALID_OPERATION in unsupported function called (unsupported extension or deprecated function?)

But the skeptical approach might be the right one, that my first test didn't actually test it with compute shaders.

I tried it with MESA_GL_VERSION_OVERRIDE=4.3fc MESA_GLSL_VERSION_OVERRIDE=430fc to see whether the game would do something different - and if I'm not completely blind it does look a lot better beyond the colorful flickering, doesn't it?

New Video: https://www.youtube.com/watch?v=ueoELXXduvk

It did say once on startup:
  Mesa: User error: GL_INVALID_OPERATION in unsupported function called (unsupported extension or deprecated function?)
so there's possibly still something missing. (would be nice for mesa to actually print what the "unsupported function" is)

Anyway, not investigating further right now because I want to go to sleep before 3 AM.
Comment 27 Christoph Haag 2016-04-03 09:39:09 UTC
Double post, but it wasn't so clear in this thread up to now: The game will only really use compute shaders when OpenGL is 4.3, not when it is 4.2.

With the mesa override to version 4.3 I can find calls like
604839 @3 glDispatchCompute(num_groups_x = 256, num_groups_y = 1, num_groups_z = 1)
in the apitrace, without the override I do not see those.

So here is an apitrace with 4.3fc override: http://haagch.frickel.club/files/AlienIsolation.trace.xz
(1.3 Gigabyte download)
Comment 28 hadack 2016-04-03 15:38:01 UTC
The game runs fine for me with 
MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430

I have already played a few hours on the branches from Bas.
Its looking great, and is quite playable on my 7750 :-)
Comment 29 Christoph Haag 2016-04-04 00:55:26 UTC
That's interesting. I played a bit with the settings and the color flicker never went away.

Did you build the compute shader branch directly? I merged it into mesa master...

Can you replay my apitrace? Sorry, it takes a while, but at the end, do you see the colors flickering?
Comment 30 almos 2016-04-05 20:38:44 UTC
(In reply to hadack from comment #28)
> The game runs fine for me with 
> MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430
> 
> I have already played a few hours on the branches from Bas.
> Its looking great, and is quite playable on my 7750 :-)

So the issue was that the game uses a fallback if 4.3 is not available, and that fallback rendering path is buggy?
Comment 31 Edwin Smith (Feral Interactive) 2016-04-07 11:40:41 UTC
There is no fallback path on Alien Isolation. If you don't have compute then the entire lighting pass will fail. 

What you see if compute is missing is other parts of the render that don't use compute trying to draw with missing and junk data due to the missing compute sections giving you the acid trip effect you see in the screenshots.

If any engineers are working on compute please do contact me and we can look at providing keys to valid requests. :-)
Comment 32 Christoph Haag 2016-04-14 09:06:13 UTC
You can ignore my comment 27 and comment 29.

For some reason with the first compute shader patchset the compute shaders would compile fine but not *really* work, at least for me - but for others they did.

Now with v2 they work for me too - mostly. In some small areas there still appears to be some colorful flickering. Here's how it looks now: https://www.youtube.com/watch?v=T9eAcYthPOc

Where I see some colors that I think shouldn't be there: very briefly at 2:36 and 2:38, from 2:50 ongoing the door and some short flickers on the whole room, then 3:20 the same door, and lastly from 6:20 ongoing that room. But it's no comparison to before..
Comment 33 Stepan Bakshaev 2016-04-14 15:30:08 UTC
@Christoph Haag,

You wrote about patches to mesa. What is about llvm patches? Did you apply? Was it upsteam?
Comment 34 Christoph Haag 2016-04-14 18:05:28 UTC
(In reply to Stepan Bakshaev from comment #33)
> @Christoph Haag,
> 
> You wrote about patches to mesa. What is about llvm patches? Did you apply?
> Was it upsteam?

This one is upstream I assume: http://reviews.llvm.org/D18559

So I only applied the diff from http://reviews.llvm.org/D18340 to llvm-svn 266255.
Comment 35 Luzipher 2016-04-20 20:18:41 UTC
Today, since compute shaders are committed to the mesa repo (commit 	7143068296aaca8c5af3469c013a7c2a850aee84) and the llvm repo this game runs flawlessly with nothing but "MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430" (which isn't enabled yet due to some bug that doesn't affect Alien Isolation). I didn't see any flickery colours on fog or anywhere else during the first level (on the Torrens).

Setting this bug to resolved. Thanks for getting it working, devs ! :-)
Comment 36 Christoph Haag 2016-04-20 22:21:18 UTC
For me it's still only almost.

Here is another video I recorded:
https://youtu.be/RDO0MeZAvms?t=321

This time all doors and rooms were fine, but the characters were not.

Hardware:
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Wimbledon XT [Radeon HD 7970M] (rev ff)
Comment 37 Nicolai Hähnle 2016-04-21 17:26:25 UTC
Can you open a new bug report for this and provide an apitrace?
Comment 38 Christoph Haag 2016-05-14 11:56:19 UTC
(In reply to Nicolai Hähnle from comment #37)
> Can you open a new bug report for this and provide an apitrace?

To tie up this loose end: I put it off because this would have been a massive apitrace with walking to that room etc.

I first made a video of how it had become even worse with the NPCs being completely black/white and how it was this way with high and with low settings:
https://youtu.be/Hk9VrJ99jcc?t=110

After restarting the game, I can not reproduce it anymore, not even with the exact same settings I had previously in the video. I can see neither the blue/red lighting problem nor the black/white problem anymore and everything seems to render fine now.

My guess is that it wasn't a driver problem in the first place and that it was caused by the game itself caching something and invalidating it after changing the settings and restarting the game.

So if anyone has a similar problem: Try changing *all* graphics settings and restarting the game.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.