Bug 91993

Summary: Graphical glitch in Astromenace (open-source game).
Product: Mesa Reporter: pc.jago1337
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: daniel, mc.return
Version: 10.6   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Main menu rendered normally with GPU.
Main menu rendered in software/CPU.
Main menu rendered normally with GPU.
Patche for the game from the Debian package
GLSL and Shadows not available on radeonsi with OpenGL 3.0, LLVM 3.6.2

Description pc.jago1337 2015-09-13 15:07:01 UTC
What the main menu looks like when I just run "astromenace" in terminal:
http://i.imgur.com/Of8uC4t.png

What the main menu looks like when I run "LIBGL_ALWAYS_SOFTWARE=1 astromenace" in terminal:
http://i.imgur.com/KDmjrjh.png

CS:GO runs without any glitches/graphical corruptions though, if that's useful.

Graphics card: R9 270X
Distro: Arch Linux (AMD64), updated on 14 September.
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.6.7
Comment 1 pc.jago1337 2015-09-13 15:14:41 UTC
Created attachment 118241 [details]
Main menu rendered normally with GPU.
Comment 2 pc.jago1337 2015-09-13 15:16:13 UTC
Created attachment 118242 [details]
Main menu rendered in software/CPU.
Comment 3 pc.jago1337 2015-09-13 15:18:15 UTC
Created attachment 118243 [details]
Main menu rendered normally with GPU.

Didn't realise I needed to flag the content-type. Same image, but now it's marked as an image.
Comment 4 pc.jago1337 2015-09-13 15:31:04 UTC
Also:

kernel version: linux 4.1.6-1 
xorg version: 1.17.2
llvm-libs version: 3.6.2-3
Comment 5 smoki 2015-09-13 18:58:59 UTC
 Can't reproduce this with Debian version of astromenance neither with radeonsi or swrast - works fine here with that llvm+mesa version.

 Likely game bug or it need some patches on Arch, look at a Debian changelog there are some patching involved:

 http://metadata.ftp-master.debian.org/changelogs//contrib/a/astromenace/astromenace_1.3.2+repack-3_changelog
Comment 6 smoki 2015-09-13 19:05:53 UTC
 Yeah either w32 version from site has broken rendering.

 But Debian patched version is all fine for me on both radeonsi or with Catalyst.
Comment 7 Daniel Scharrer 2015-09-13 20:40:10 UTC
Created attachment 118248 [details] [review]
Patche for the game from the Debian package

I can reproduce this with openastromenace in Gentoo. fix_work_on_intel_videocards.patch from the debian package (attached) fixes the menu for me, but even the comment for the patch mentions that this is only a workaround and GL_ARB_texture_storage needs to be fixed in mesa.
Comment 8 smoki 2015-09-13 22:21:21 UTC
 Hm and 2 years passed :( does that work on intel's current driver?

 Just checked Catalyst, does not complain with or without.
Comment 9 Roland Scheidegger 2015-09-25 01:05:50 UTC
FWIW 19604d30e1351868f7f54847c91ffec7b3fcd27e fixes the crash (on intel), might also fix the graphical issues on radeonsi but not really sure.
Comment 10 Daniel Scharrer 2015-09-25 12:09:55 UTC
It does not - at least for me the issue is unchanged with current Mesa git.
Comment 11 Roland Scheidegger 2015-09-25 12:54:20 UTC
(In reply to Daniel Scharrer from comment #10)
> It does not - at least for me the issue is unchanged with current Mesa git.
Since it reportedly works with the "intel" debian patch, my guess would be there's another bug somewhere with handling (or creating) incomplete mip pyramids in case of immutable textures, which is apparently (at least for compressed textures) unusual enough that there's no piglit test for it, and no other app so far using it (as at least on intel, it was a guaranteed crash for 2+ years). That's just a shot in the dark though...
Comment 12 MC Return 2015-10-03 13:08:02 UTC
I am also affected by this bug, Gallium 0.4 on AMD HAWAII (DRM 2.43.0, LLVM 3.8.0), OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.0.2 (git-4c0b484) here.

It is quite painful as this is by far the best FOSS 3d scroll shooter around, for those interested, the homepage is here:
http://www.viewizard.com/astromenace/index_linux.php

download/build wiki here:
http://www.viewizard.com/download.php

sourcecode here:
http://sourceforge.net/p/openastromenace/code/HEAD/tree/

As I am running a 390X with Mesa 11.0.2 from git and had no problems before upgrading my card from a Radeon 6950 it is probably radeonsi related ?
Could someone please test this with some modern GCN hardware on latest Mesa to confirm ?
Comment 13 Marek Olšák 2015-10-15 11:29:45 UTC
I've built Astromenace from source and couldn't reproduce this.
Comment 14 Daniel Scharrer 2015-10-18 00:34:14 UTC
Here's a trace from the openastromenace version in Gentoo (1.3.2) that works with Catalyst but is broken with radeonsi git for me:

 http://constexpr.org/tmp/AstroMenace-radeonsi.trace.xz (49 MiB)

Can you reproduce it with that?
Comment 15 Nicolai Hähnle 2015-10-21 12:26:41 UTC
With the apitrace, I do see an obvious graphical glitch (looking slightly different than the attachment).

apitrace reports an error: api issue 1: FBO incomplete: no attachments [-1] in frame 0. I do not know whether this is related to the graphical glitch, but you should probably report it to AstroMenace in any case.
Comment 16 Nicolai Hähnle 2015-10-21 17:22:44 UTC
The bug is caused by the combination of a (technically correct, but unintentional) off-by-one problem in AstroMenace with a bug in the Mesa state tracker.

(Old versions of) AstroMenace use glTexStorage2D to create a texture with an incomplete mipmap pyramid (the 1x1 level is missing). This pyramid is not honored by the state tracker's implementation of glGenerateMipmap, which results in various broken textures.

Current versions of AstroMenace no longer have the off-by-one problem, which is why Marek could not reproduce the bug.

I'm working on a Piglit test and Mesa patch to fix the bug on our side.
Comment 17 MC Return 2015-10-21 20:24:53 UTC
I can confirm that updating and recompiling of the AstroMenace source (Version 1.3.3 svn build 140929 now) now fully fixed the problem for me \o/ (radeonsi, R390X here).

Thanks a lot to everyone helping with this !
Comment 18 MC Return 2015-10-21 20:38:34 UTC
I noticed though that the OpenGL Shading Language and Shadow Quality options in AstroMenace's Advanced Video Settings are not available (red), while the log shows no problems.
I do not remember if those settings could be activated in previous versions of the game though and if they are even implemented... maybe someone could also check that ?
Comment 19 MC Return 2015-10-21 20:43:46 UTC
Created attachment 119055 [details]
GLSL and Shadows not available on radeonsi with OpenGL 3.0, LLVM 3.6.2
Comment 20 Roland Scheidegger 2015-10-22 01:11:37 UTC
(In reply to Nicolai Hähnle from comment #16)
> (Old versions of) AstroMenace use glTexStorage2D to create a texture with an
> incomplete mipmap pyramid (the 1x1 level is missing). This pyramid is not
> honored by the state tracker's implementation of glGenerateMipmap, which
> results in various broken textures.

Hmm I totally missed this when I fixed pretty much the same bug in mesa core mipgen code. I guess it's a real pity there's no piglit test for this...
Comment 21 Nicolai Hähnle 2015-10-22 12:08:25 UTC
(In reply to Roland Scheidegger from comment #20)
> Hmm I totally missed this when I fixed pretty much the same bug in mesa core
> mipgen code. I guess it's a real pity there's no piglit test for this...

Now there is :)

MC Return, as for these menu options: Since I don't think any features were _removed_ from the driver, this sounds like it's an AstroMenace bug if anything, so you should probably talk to their developers. In any case, that topic is separate and therefore does not belong into the discussion of this particular bug here. Thanks for your patience :)
Comment 22 Nicolai Hähnle 2015-11-06 13:36:58 UTC
The fix for this has been in Mesa master for a while now (rev 24c9088), let's mark this as resolved.

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.