Bug 47607 - [advocacy] Make Anomaly Warzone Earth work with Mesa
Summary: [advocacy] Make Anomaly Warzone Earth work with Mesa
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL: http://forum.anomalythegame.com/viewf...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-20 12:31 UTC by Sven Arvidsson
Modified: 2013-04-15 16:58 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
LD_PRELOAD hack to renumber uniform locations in a dense manner (2.77 KB, text/plain)
2013-03-28 16:45 UTC, Alexander Monakov
Details

Description Sven Arvidsson 2012-03-20 12:31:12 UTC
The game "Anomaly Warzone Earth" from the previous Humble Android Bundle does not work with Mesa.

There's two problems, at least the second is a bug in the game:

• The game segfaults at start 9/10 times. When it does start it's only to segfault a short while later. Backtraces only point to the game, but it does work with fglrx.

• GLSL in the game fails to compile: "error: no matching function for call to `texture2DLod(sampler2D, vec2, float)'" this is out of spec behaviour, but apparently working with blobs from Nvidia/AMD. (This is probably not the reason for the segfaults, as modifing the shaders to compile still results in crashes).

I have used ApiTrace to grab traces of the game, but I'm not sure if that's of any help. The trace made with fglrx plays back with Mesa, with no problems except a warning: "could not infer drawable size (glViewport never called)"
http://dl.dropbox.com/u/28577999/anomalywarzoneearth-no-start.trace (trace with mesa, game segfaulting, 2.7M)
http://dl.dropbox.com/u/28577999/anomalywarzoneearth-working.trace (trace with fglrx 170M)

So far the developers of the game have shown very little interest in anything not related to Nvidia/AMD blobs, so I'm filing this bug in the hope that they would be more likely to listen to a Mesa developer rather than a random user. 

* Mozilla used to have an advocacy bug keyword used for broken websites where someone would contact and try to convince the operators of a buggy website to support Firefox, rather than adding workarounds in the browser. Maybe Mesa needs something similar?
Comment 1 Kenneth Graunke 2012-03-20 13:26:57 UTC
(In reply to comment #0)
> • GLSL in the game fails to compile: "error: no matching function for call to
> `texture2DLod(sampler2D, vec2, float)'" this is out of spec behaviour, but
> apparently working with blobs from Nvidia/AMD. (This is probably not the reason
> for the segfaults, as modifing the shaders to compile still results in
> crashes).

This is indeed out of spec behavior that can be fixed in the application by either using #version 130 or specifying #extension GL_ARB_shader_texture_lod : warn.

You can also work around this by setting the force_glsl_extensions_warn driconf option.  (Either run "force_glsl_extensions_warn=true ./AnomalyWarzoneEarth" or set it in ~/.drirc or /etc/drirc.  The driconf GUI can help with that.)

If they absolutely won't fix it, we might have to add the game to our blacklist.

Not sure about the other issues.
Comment 2 Sven Arvidsson 2012-03-22 12:39:40 UTC
(In reply to comment #1)
> You can also work around this by setting the force_glsl_extensions_warn driconf
> option.  (Either run "force_glsl_extensions_warn=true ./AnomalyWarzoneEarth" or
> set it in ~/.drirc or /etc/drirc.  The driconf GUI can help with that.)

Thanks, that's good to know!

> Not sure about the other issues.

Yeah, I suppose only the game devs know for sure what's causing the segfault, but there seems to be zero interest in supporting Intel GPUs or Mesa overall.
Comment 3 Eugeni Dodonov 2012-04-02 14:39:21 UTC
I think Eric was working on similar Humble Bundle issues in the past, so CC'ing him as well.

I have this bundle myself, but I haven't tried it on anything except real android. I'll give it a try and see if I can find something wrong there.
Comment 4 Md Imam Hossain 2012-08-18 00:16:12 UTC
same with GMA 4500, but Windows version runs fine in Windows.
Comment 5 Md Imam Hossain 2012-12-06 04:54:38 UTC
does not work with Intel HD either even with glsl extension behavior warn

Tested On:

Ubuntu 12.10
Linux 3.5 (both 32 and 64 bit)
X.Org X Server 1.13.0
xf86-video-intel 2.20.15
libdrm 2.4.40
Mesa 8, 9 and git (both 32 and 64 bit)

Hardware: Intel GMA 4500 MHD (device id 2a42)
Hardware: Intel HD (device id 0106)
Comment 6 Alexander Monakov 2013-03-12 20:56:25 UTC
When diffing the traces it's obvious that the only substantial difference before the crash is in the uniform locations numbering: fglrx returns tightly-packed 0, 1, 2 ... while Mesa likes to return bigger numbers like 65536 for some kinds.  I bet it overflows a fixed-size buffer in the game.  It's possible to test this theory by injecting a renumbering hack.
Comment 7 Alexander Monakov 2013-03-28 16:45:13 UTC
Created attachment 77166 [details]
LD_PRELOAD hack to renumber uniform locations in a dense manner

To follow up to my previous comment, attaching a quick'n'dirty LD_PRELOAD interposer that avoids exposing uniform locations such as 655360 to the game.  With this, the game doesn't segfault, but I think I'm getting rendering errors in map view (IVB, Mesa-9.0).

(if anyone wants to try: compile command is at the first line of the .cpp file, to use: export LD_PRELOAD=/path/to/compiled/anomalyhack.so ./AnomalyWarzoneEarth)
Comment 8 bartosz.brzostek 2013-04-03 09:23:36 UTC
(In reply to comment #0)
> The game "Anomaly Warzone Earth" from the previous Humble Android Bundle
> does not work with Mesa.
> 

Guys, we solved the crash and updated the Steam version first. If you own the game as a part of Humble Bundle you should have received a Steam code. Could you please check if it's ok now? If so, we'll update the installer package as well.
Comment 9 Md Imam Hossain 2013-04-04 14:16:09 UTC
fixed with steam version on my Intel GMA 4500,

please update the installer.

Cheers
Comment 10 Eric Anholt 2013-04-04 15:45:46 UTC
Great to hear it's fixed -- closing this bug for us.
Comment 11 Jordan Justen 2013-04-05 17:59:29 UTC
I wanted to add one note. The game now works for me with
Mesa 9.0.3 via Steam, but it is crashing for me with Mesa 9.1.1
after the intro movie. I'll work with the game developer on
this...
Comment 12 Jordan Justen 2013-04-15 16:58:57 UTC
(In reply to comment #11)
> I wanted to add one note. The game now works for me with
> Mesa 9.0.3 via Steam, but it is crashing for me with Mesa 9.1.1
> after the intro movie. I'll work with the game developer on
> this...

I cherry-picked f5a80846 to the 9.1 branch as 4f441462
to fix this.


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.