Bug 93292 - "Thea: The Awakening" world map textures not rendered (blue background)
Summary: "Thea: The Awakening" world map textures not rendered (blue background)
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-08 08:07 UTC by Jan-Marek Glogowski
Modified: 2019-09-18 19:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Thea with interface only world map (124.10 KB, image/png)
2015-12-08 08:07 UTC, Jan-Marek Glogowski
Details
Additional debugging for the r600/sb shader compiler (8.17 KB, patch)
2016-01-19 17:37 UTC, Jan-Marek Glogowski
Details | Splinter Review
Shader with peephole optimize_CNDcc_op run (100.94 KB, text/plain)
2016-01-19 17:41 UTC, Jan-Marek Glogowski
Details
Shader without peephole optimize_CNDcc_op run (101.50 KB, text/plain)
2016-01-19 17:41 UTC, Jan-Marek Glogowski
Details

Description Jan-Marek Glogowski 2015-12-08 08:07:25 UTC
Created attachment 120410 [details]
Thea with interface only world map

The problematic game can be downloaded from the link in the first message in the following steam thread or via the steam beta channel (DRM free, free for Linux): https://steamcommunity.com/app/378720/discussions/0/490125737485986607?fp=2#p1

Someone else with older AMD hardware reported the same problem in the linked communty thread. My hardware is:
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV710/M92 [Mobility Radeon HD 4530/4570/545v]

When starting the actual gameplay, only the interface is rendered but not the games world map, basically rendering the game unplayable (see attached image).

I'm on Ubuntu Trusty 14.04, 3.13 kernel. This happens with stock Mesa from the Ubuntu release and with the git release from the oibaf PPA: https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers

The apitrace is too large to upload for me (1.5 GB), but doesn't show a particular error, except for an early glClear without a context; even the trimmed one is 1,25GB. xz compressed is still 620MB.

The game renders correctly when started with "LIBGL_ALWAYS_SOFTWARE=1". I confirmed this by also rendering the apitrace in software. imirkin told me on IRC, that this actually is a bug in the r600 driver.

I've compiled Mesa git packages with "--enable-debug" and can test a patch, if needed. I'm jmux on freenode and will be lingering around in the channel for some time and normally can be found in the libreoffice-dev channel.
Comment 1 Jan-Marek Glogowski 2015-12-21 10:31:43 UTC
I added an trimmed apitrace run for download: https://docs.google.com/uc?id=0Bwde9zQo1PeCVEExTm83Wk16WDA&export=download
Comment 2 Ilia Mirkin 2015-12-21 15:12:06 UTC
In case it's of any interest, I tested this on nouveau -- on nvc0 (GF108) the trace replays seemingly fine. On nv50 (GT215), I also get a failure on the map screen, but it's different -- everything is drawn except the background, so it appears as though it's all black(ish), with trees/etc drawn over it.
Comment 3 Jan-Marek Glogowski 2015-12-23 11:16:41 UTC
(In reply to Ilia Mirkin from comment #2)
> In case it's of any interest, I tested this on nouveau -- on nvc0 (GF108)
> the trace replays seemingly fine. On nv50 (GT215), I also get a failure on
> the map screen, but it's different -- everything is drawn except the
> background, so it appears as though it's all black(ish), with trees/etc
> drawn over it.

The current bugs component is tagged Drivers/Gallium/r600

Probably you should open a new bug for nv50 or change the component, otherwise it'll probably be unnoticed. I'm actually not sure if the component is right, as I expected it to be reported to the mesa-dev mailing list.
Comment 4 Jan-Marek Glogowski 2016-01-16 17:49:05 UTC
I uploaded a new apitrace with low details settings and disabled intro video, which makes it much smaller (170 MB xz).

https://docs.google.com/uc?id=0Bwde9zQo1PeCVVdZU2ZSM3hKcXc&export=download

While I was at it I played a bit with qapitrace, comparing the r600 and swrast output. And I found the origin of the bug.

The "breaking" call is "1247216" in the new trace:
  glDrawElements(mode = GL_TRIANGLES, count = 600, type = GL_UNSIGNED_SHORT, indices = NULL)

The call "destroys" the depth map, filling it with a constant value, so nothing is rendered.

Actually I suspect the glUseProgram(87) in call 1247202 to be the origin of the problem, as it installs a shader program (AFAIK OpenGL) and because I'm able to play Thea using the llvm r600 backend via "R600_DEBUG=llvm" and if I disable "ambient occlusion", which is also broken.

My current mesa build is based on commit 6303231a1ddf646b05c43c6bbc7fa71314ebb3fc
Comment 5 Jan-Marek Glogowski 2016-01-19 17:37:41 UTC
Created attachment 121137 [details] [review]
Additional debugging for the r600/sb shader compiler
Comment 6 Jan-Marek Glogowski 2016-01-19 17:41:14 UTC
Created attachment 121138 [details]
Shader with peephole optimize_CNDcc_op run
Comment 7 Jan-Marek Glogowski 2016-01-19 17:41:58 UTC
Created attachment 121139 [details]
Shader without peephole optimize_CNDcc_op run

Working shader
Comment 8 Jan-Marek Glogowski 2016-01-19 17:56:50 UTC
working command line with patch to get the shader log:
  R600_SB_DSKIP_START=94 R600_SB_DSKIP_END=94 R600_SB_DSKIP_MODE=63 glretrace thea.trace

working command line without the patch to verify shader bug:
  R600_SB_DSKIP_START=94 R600_SB_DSKIP_END=94 R600_SB_DSKIP_MODE=1 glretrace thea.trace

In the end I'm just using the llvm backend (R600_DEBUG=llvm). I just see a minimal difference on this HW in game of ~0.5 frames (slower LLVM). Actually I had other small rendering glitches with the SB shader backend, which I didn't track down.

(In reply to Ilia Mirkin from comment #2)
> In case it's of any interest, I tested this on nouveau -- on nvc0 (GF108)
> the trace replays seemingly fine. On nv50 (GT215), I also get a failure on
> the map screen, but it's different -- everything is drawn except the
> background, so it appears as though it's all black(ish), with trees/etc
> drawn over it.

The original (large) apitrace had ambient occlusion (AO) activated AFAIK, but I deleted it, so I don't know. AO was fixed for me with a patch in the last week.
As my hardware is already slow (just 15fps in the game), enabling this renders the game unplayable, but now I get soft shadows at the price of ~50% frame drop.
Comment 9 Grazvydas Ignotas 2016-01-22 22:28:09 UTC
(In reply to Jan-Marek Glogowski from comment #4)
> I uploaded a new apitrace with low details settings and disabled intro
> video, which makes it much smaller (170 MB xz).
> 
> https://docs.google.com/uc?id=0Bwde9zQo1PeCVVdZU2ZSM3hKcXc&export=download
> 

FWIW this trace works fine for me on my Juniper XT [Radeon HD 5770] on current git (cd9c07e7cdf) with default settings. R600_DEBUG=llvm crashes, R600_DEBUG=llvm,nosb shows some glitches and R600_DEBUG=nosb seems to be fine too. The other trace does a 404 now so can't check.
Comment 10 GitLab Migration User 2019-09-18 19:20:01 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/561.


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.