Bug 91951 - [radeonsi] Arma 3 crashes: Too many fragment shader texture samplers
Summary: [radeonsi] Arma 3 crashes: Too many fragment shader texture samplers
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 11.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-09 21:57 UTC by riku
Modified: 2016-04-12 18:06 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Backtrace (12.84 KB, text/plain)
2015-09-09 21:57 UTC, riku
Details
Crash report (eon.txt) (18.58 KB, text/plain)
2015-09-09 22:02 UTC, riku
Details
Log with MESA_GLSL=dump (gzipped) (1.17 MB, application/gzip)
2015-09-10 07:47 UTC, riku
Details
failing shader (109.15 KB, text/plain)
2015-09-11 01:05 UTC, Ilia Mirkin
Details

Description riku 2015-09-09 21:57:21 UTC
Created attachment 118172 [details]
Backtrace

Arma 3 crashes when entering map. Last lines from eon.txt:

[thread 0000000f][E][48299]: Program from shader GL_FRAGMENT_SHADER with length 20611 and CRC 0xae61bc1c has not been successfully linked. Program info log:
error: Too many fragment shader texture samplers

Mesa version: 11.0.0-rc3
GPU: R9 390
GCC options: -O1 -ggdb -march=native

Attaching backtrace and eon.txt in case there is some useful information. MESA_GLSL=log didn't save the failing shader, just all before it. Please let me know if I can provide more information.
Comment 1 riku 2015-09-09 22:02:26 UTC
Created attachment 118173 [details]
Crash report (eon.txt)
Comment 2 Ilia Mirkin 2015-09-09 22:19:47 UTC
Should show up if you do MESA_GLSL=dump.

I suspect they have a sampler somewhere funny... the number of samplers is counted with link_uniforms.cpp:values_for_type which seems like it'll be off for a sampler inside a struct or something.
Comment 3 riku 2015-09-10 07:47:27 UTC
Created attachment 118179 [details]
Log with MESA_GLSL=dump (gzipped)

Thank you for looking at this. Here is the gzipped log from Arma 3 with MESA_GLSL=dump. It is pretty big, and I was unsure where to cut it, so I'm attaching it uncut. Sorry about that.
Comment 4 Ilia Mirkin 2015-09-11 01:05:54 UTC
Created attachment 118201 [details]
failing shader

Looks like for maximal convenience, the shader dump truncates the text representation. Anyways, this thing has 34 sampler uniforms. Not sure if they all get counted as used.

Haven't gone over the LISP-y IR that's printed.
Comment 5 Tapani Pälli 2015-09-18 11:43:19 UTC
FWIW Arma 3 works on i965 (tested today with Mesa @ afa1efd).
Comment 6 altosk 2015-11-12 09:44:58 UTC
disabling shadows allows me to play the game on radeonsi fyi
Comment 7 Stepan Bakshaev 2016-01-05 19:03:11 UTC
@altosk

> disabling shadows allows me to play the game on radeonsi fyi

Yes. But it would be better to have shadows. I'm affected too and play without shadows.
Comment 8 Ian Romanick 2016-01-07 01:04:00 UTC
I believe radeonsi only advertises support for 32 samplers, and this shader declares 33.

$ grep 'uniform[[:space:]]\+sampler' ~/file_91951.txt  | wc -l
33

Looking at the code, far fewer than 33 are used.

$ grep 'var_ref tex[0-9]' ~/file_91951.txt  | wc -l
21

If there are only 21 references to sampler variables, it is impossible for more than 21 samplers to be used.

I also notice that this shader has

#ifdef GL_ARB_separate_shader_objects
#extension GL_ARB_separate_shader_objects : enable
#endif

at the top.  GL_ARB_separate_shader_objects changes some of the rules about what things are allowed to be eliminated from a linked shader.  I didn't think it had any affect on uniforms, so it's possible there's some bad interaction there.

Can someone try running this on radeonsi with the environment variable MESA_EXTENSION_OVERRIDE=-GL_ARB_separate_shader_objects?
Comment 9 riku 2016-01-07 13:37:11 UTC
Thank you Ian for looking at this.

Unfortunately, MESA_EXTENSION_OVERRIDE=-GL_ARB_separate_shader_objects didn't help. Same error message with same CRC for the failing shader, and no differences in any of the 207 shaders I got with MESA_GLSL=log. Maybe I did something wrong, or is it normal to get an implementation error with MESA_EXTENSION_OVERRIDE?

MESA_EXTENSION_OVERRIDE=-GL_ARB_separate_shader_objects MESA_GLSL=log ./arma3
Mesa 11.0.8 implementation error: Trying to disable permanently enabled extensions: GL_ARB_separate_shader_objects

Tested with mesa 11.0.8 and llvm-3.7.1. Please let me know if there is something more I can do. There should be a new version of Arma 3 out soon, so this might resolve itself.
Comment 10 Stepan Bakshaev 2016-04-09 11:07:47 UTC
Arma 3: version 1.54
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.3.0-devel (git-4420f18 2016-04-08 wily-oibaf-ppa)

Shadows is set to "standart". There is no crash and shadows are on there places.

I report "bug is fixed". Thank you.
Comment 11 riku 2016-04-12 18:06:03 UTC
Fixed for me too. Thank you!


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.