Bug 98856 - DIRT: Showdown broken graphics with Mesa built with -Ofast
Summary: DIRT: Showdown broken graphics with Mesa built with -Ofast
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
Depends on:
Blocks: 77449
  Show dependency treegraph
Reported: 2016-11-25 17:17 UTC by Gregor Münch
Modified: 2018-03-08 00:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

garbled graphics #1 (2.06 MB, image/png)
2017-03-05 18:52 UTC, Gregor Münch

Description Gregor Münch 2016-11-25 17:17:07 UTC
For about 4 weeks the game has polygon distortion especially on the Nevada map. Its not on every map but it can be seen with the ingame benchmark.

Im on:
Radeon HD 7970
OpenGL renderer string: Gallium 0.4 on AMD TAHITI (DRM 2.48.0 / 4.9.0-rc4-gbc33b0c, LLVM 4.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 13.1.0-devel (git-b27be18)
Comment 1 Samuel Pitoiset 2017-01-05 13:46:59 UTC
Could you provide an apitrace that reproduces the issue?
Comment 2 Gregor Münch 2017-01-09 21:08:39 UTC
I tried getting this to work but I dont get any output file.

DEBUGGER="apitrace trace" steam steam://rungameid/201700
What am Im doing wrong here?

I installed:

If you want to do a regression testing,
this somewhat broke arround here: https://cgit.freedesktop.org/mesa/mesa/commit/?id=74e39de9324d2d2333cda6adca50ae2a3fc36de2
Comment 3 Samuel Pitoiset 2017-01-10 09:21:45 UTC
Does reverting that commit fix the issue?
Comment 4 Gregor Münch 2017-01-11 09:15:47 UTC
I managed to get a trace. Hope it works for you.

Comment 5 Gregor Münch 2017-01-11 09:26:43 UTC
(In reply to Samuel Pitoiset from comment #3)
> Does reverting that commit fix the issue?

I can't test (I would do if someone could show me how). I do weekly Mesa builds and Im quite sure it broke in the week when this commit appeared.
Comment 6 Gregor Münch 2017-01-23 09:21:14 UTC
Problem is still there as of mesa git from Friday.
Also, the trying replaying my trace hangs the GPU.
Comment 7 Gregor Münch 2017-02-07 10:34:59 UTC
I finally was able to start bisecting this, I was going back to Mesa from early October but couldnt find the culprit. I used PKGBUILD provided from here: https://aur.archlinux.org/packages/lib32-mesa-git/
Then I followed these instructions:

I guess since the executable name of the game is dirt.i386 so bisecting the 32bit package is the right one?

Im a bit lost here, I will try older Kernel and libdrm but after that Im running out of ideas what could caused this, any other ideas would be appreciated.

BTW, judging from the screenshots in https://bugs.freedesktop.org/show_bug.cgi?id=99136 it looks this is the same problem. Its interesting to see that enabling a minor heavy graphic option causes such crazy graphical corruption. He enables blood effects and in Dirt you have to set Crowd from OFF to LOW or higher. While ULTRA option makes the problem even worse.

Fun Fact: I tested Tomb Raider Benchmark, and the average FPS on went from 48fps with Mesa from October to 58fps with current Mesa git. So really good job on this!
Comment 8 Gregor Münch 2017-03-05 18:52:16 UTC
Created attachment 130076 [details]
garbled graphics #1

Found the problem. Seems like using -Ofast wasnt a good idea. Using -03 everything works as it should.
Still attaching screenshot showing the problem in case it is useful to others.
Comment 9 Gregor Münch 2018-01-21 19:21:12 UTC
Still the same with -Ofast.
Comment 10 Timothy Arceri 2018-03-08 00:42:58 UTC
Ofast disregards strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard-compliant programs.

In other words don't use it with Mesa :)

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.