Bug 91169 - The Chronicles of Riddick: Assault on Dark Athena fails to start with nouveau
Summary: The Chronicles of Riddick: Assault on Dark Athena fails to start with nouveau
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-07-01 03:39 UTC by Béla Gyebrószki
Modified: 2018-04-24 01:23 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
trace file (unpatched mesa, game fails to start) (146.91 KB, application/octet-stream)
2015-07-01 03:39 UTC, Béla Gyebrószki
Details
proper patch (9.10 KB, patch)
2015-09-05 18:03 UTC, Ilia Mirkin
Details | Splinter Review

Description Béla Gyebrószki 2015-07-01 03:39:50 UTC
Created attachment 116838 [details]
trace file (unpatched mesa, game fails to start)

The game uses OpenGL and runs fine in Wine with Nvidia binary drivers 340.76.
With nouveau the game crashes on start and pops up an error message something about: 
'CCException. 
Location: class CRenderContextGL::GLSL_LoadSrc
Message: OpenGL: no error'
I get the same error message with the software renderer too.

The following proposed patched written by Ilia Mirkin fixes the problem for me, the game starts, shows the intro videos and menus correctly:

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index efab299..9c3037b 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -2045,7 +2045,7 @@ builtin_builder::create_builtins()
 
    add_function("texture2D",
                 _texture(ir_tex, always_available, glsl_type::vec4_type,  glsl_type::sampler2D_type, glsl_type::vec2_type),
-                _texture(ir_txb, fs_only,          glsl_type::vec4_type,  glsl_type::sampler2D_type, glsl_type::vec2_type),
+                _texture(ir_txb, always_available,          glsl_type::vec4_type,  glsl_type::sampler2D_type, glsl_type::vec2_type),
                 _texture(ir_tex, texture_external, glsl_type::vec4_type,  glsl_type::samplerExternalOES_type, glsl_type::vec2_type),
                 NULL);
 
@@ -2096,7 +2096,7 @@ builtin_builder::create_builtins()
 
    add_function("textureCube",
                 _texture(ir_tex, always_available, glsl_type::vec4_type,  glsl_type::samplerCube_type, glsl_type::vec3_type),
-                _texture(ir_txb, fs_only,          glsl_type::vec4_type,  glsl_type::samplerCube_type, glsl_type::vec3_type),
+                _texture(ir_txb, always_available,          glsl_type::vec4_type,  glsl_type::samplerCube_type, glsl_type::vec3_type),
                 NULL);
 
    add_function("textureCubeLod",
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 046d5d7..6b1a104 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -655,6 +655,8 @@ void _mesa_glsl_extension::set_flags(_mesa_glsl_parse_state *state,
  */
 static const _mesa_glsl_extension *find_extension(const char *name)
 {
+   if (strcmp(name, "GL_ATI_shader_texture_lod") == 0)
+      name = "GL_ARB_shader_texture_lod";
    for (unsigned i = 0; i < ARRAY_SIZE(_mesa_glsl_supported_extensions); ++i) {
       if (strcmp(name, _mesa_glsl_supported_extensions[i].name) == 0) {
          return &_mesa_glsl_supported_extensions[i];


Trace file with patch applied:
https://drive.google.com/open?id=0B-tTbLKBl-tOQUNwWEgtekN6LVE

Fedora 22 32-bit
Mesa 10.6-branchpoint-773-g1de93f9
Kernel 4.0.6-300.fc22.i686+PAE
Xorg 1.17.2
libdrm-2.4.61-3.fc22.i686
Comment 1 Ilia Mirkin 2015-07-01 05:26:37 UTC
One thing to note is that the shaders don't *actually* use the functionality. They all have the same copy & pasted adapter which makes glsl look more like hlsl, and it includes some functions which call the various texture functions. However they don't actually get used, at least in the few shaders I've looked at.

It may be sufficient to provide the prototypes but then fail at link-time. This should allow the glsl compiler to optimize those functions out and thus work. But I haven't checked -- perhaps there are in fact vertex shaders that try to call texture2D(bias) or textureLod() from fp.
Comment 2 Ilia Mirkin 2015-09-05 18:03:42 UTC
Created attachment 118090 [details] [review]
proper patch

Can you see if this helps? I wasn't sure what the binary name was so couldn't add it to drirc. However you should be able to enable the relevant settings by setting

alias_ati_to_arb_shader_texture_lod=true allow_vertex_texture_bias=true

in your environment. If this helps, composing a drirc entry is pretty easy, assuming you have the binary name. You can use existing drirc entries for inspiration (see /etc/drirc).
Comment 3 Béla Gyebrószki 2015-09-06 06:10:26 UTC
(In reply to Ilia Mirkin from comment #2)
> Created attachment 118090 [details] [review] [review]
> proper patch
> 
> Can you see if this helps? I wasn't sure what the binary name was so
> couldn't add it to drirc. However you should be able to enable the relevant
> settings by setting
> 
> alias_ati_to_arb_shader_texture_lod=true allow_vertex_texture_bias=true
> 
> in your environment. If this helps, composing a drirc entry is pretty easy,
> assuming you have the binary name. You can use existing drirc entries for
> inspiration (see /etc/drirc).

With the attached patch and those environment settings enabled I can start the game.
Comment 4 Ilia Mirkin 2015-09-06 06:12:09 UTC
(In reply to Béla Gyebrószki from comment #3)
> (In reply to Ilia Mirkin from comment #2)
> > Created attachment 118090 [details] [review] [review] [review]
> > proper patch
> > 
> > Can you see if this helps? I wasn't sure what the binary name was so
> > couldn't add it to drirc. However you should be able to enable the relevant
> > settings by setting
> > 
> > alias_ati_to_arb_shader_texture_lod=true allow_vertex_texture_bias=true
> > 
> > in your environment. If this helps, composing a drirc entry is pretty easy,
> > assuming you have the binary name. You can use existing drirc entries for
> > inspiration (see /etc/drirc).
> 
> With the attached patch and those environment settings enabled I can start
> the game.

What is the name of the binary (so that I can write a proper drirc entry)?
Comment 5 Béla Gyebrószki 2015-09-06 10:24:31 UTC
(In reply to Ilia Mirkin from comment #4)
> (In reply to Béla Gyebrószki from comment #3)
> > (In reply to Ilia Mirkin from comment #2)
> > > Created attachment 118090 [details] [review] [review] [review] [review]
> > > proper patch
> > > 
> > > Can you see if this helps? I wasn't sure what the binary name was so
> > > couldn't add it to drirc. However you should be able to enable the relevant
> > > settings by setting
> > > 
> > > alias_ati_to_arb_shader_texture_lod=true allow_vertex_texture_bias=true
> > > 
> > > in your environment. If this helps, composing a drirc entry is pretty easy,
> > > assuming you have the binary name. You can use existing drirc entries for
> > > inspiration (see /etc/drirc).
> > 
> > With the attached patch and those environment settings enabled I can start
> > the game.
> 
> What is the name of the binary (so that I can write a proper drirc entry)?

The game executable is DarkAthena.exe

I tried adding these lines to my ~/.drirc, but apparently the setting was ignored.

<application name="Chronicles of Riddick" executable="DarkAthena.exe">
            <option name="alias_ati_to_arb_shader_texture_lod" value="true" />
            <option name="allow_vertex_texture_bias" value="true" />
</application>
Comment 6 xdshot9000 2016-04-12 17:55:49 UTC
It also crashes on Intel graphics with the latest mesa from git. The patch fixes this problem though.
Comment 7 Vladimir 2016-09-07 08:40:06 UTC
I can confirm this happens on Intel with mesa 12.0.2. Is this patch going to be merged?
Comment 8 Ilia Mirkin 2016-09-07 15:51:36 UTC
(In reply to Vladimir from comment #7)
> I can confirm this happens on Intel with mesa 12.0.2. Is this patch going to
> be merged?

The situation was a bit unclear to me. Without re-reading everything, my recollection is that

(a) For some reason drirc matching doesn't work.
(b) The game(s?) in question is no longer available.

If either of those aren't true, let me know, and I'll re-re-re-polish the patch and send it out. Even the "proper" patch as attached here is kinda crap. And I rewrote all the ext matching stuff in the meanwhile.
Comment 9 Timothy Arceri 2018-04-24 01:23:34 UTC
The game is no longer available for Linux. Closing for now.


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.