Bug 108340

Summary: Ambient Occlusion in Two Point Hospital shows black spot artifacts
Product: Mesa Reporter: Christos Kotsaris <christos.kotsaris>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED MOVED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: freedesktop-bugs
Version: 18.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Recurring error in trace file replay in qapitrace

Description Christos Kotsaris 2018-10-12 13:11:19 UTC
Two point hospital works pretty well on my Archlinux system using Mesa 18.2.2, LLVM 7.0, kernel 4.18.12 with max graphical settings. The only setting that has an issue is Ambient Occlusion. With that enabled, when you move the camera around it produces a lot of black spots around the edges of walls and items. With that setting disabled everything displays fine. 

From what little search i did, i saw other people reporting this issue on the steam forums of the game but it is not reported here and i think it is an issue with Mesa. For the record i am using an R9 380 card and i saw people reporting the same problem on Polaris cards.
Comment 1 Timothy Arceri 2018-10-18 23:28:16 UTC
Getting an apitrace [1] of the problem would be useful.

[1] https://github.com/apitrace/apitrace/wiki/Steam
Comment 2 wietse.jorissen 2018-12-28 14:41:18 UTC
I am noticing the same issue, also running on max graphical settings.

Ubuntu 18.10
Kernel 4.18.0-13-generic
AMD RX 480
OpenGL version string: 4.4 (Compatibility Profile) Mesa 18.2.2

Steps followed:
1. Installed apitrace (sudo apt-get install apitrace)
2. Looked up the ID of Two Point Hospital (535930)
3. Ran the following command in terminal (DEBUGGER="apitrace trace" steam steam://rungameid/535930)
4. Once ingame with the Ambient Occlusion option active, I zoomed in and out and moved the camera around as this seems to exacerbate the black spots.
5. The trace file is stored next to the game executable (/home/username/.local/share/Steam/steamapps/common/TPH/TPH.x86_64.trace)

6. I compressed the trace file with 7z

https://mega.nz/#!y3IzRY6A!ksUZcYGjgeHnBk9XtZb3J7pnIb5meZV8TxB-T27XmPs
The file is hosted on MEGA, and I used 7z compression to make the uploaded file somewhat smaller.
Comment 3 wietse.jorissen 2018-12-29 17:51:34 UTC
Created attachment 142915 [details]
Recurring error in trace file replay in qapitrace

I've now installed qapitrace (sudo apt-get install apitrace-gui) and can now look into what errors are being listed after I replay the trace therein. 

Then I tried delving deeper into the error messages and think I may have at least found something relevant. But I'm quite out of my element here.

In the attached screenshot, you can see it lists 4 errors regarding "array index must be a scalar". These errors seem to refer to a glShaderSource call for a GL_FRAGMENT_SHADER, shader string 0, at lines 65,98,99 and 100.

What these four lines have in common is that they all use the same value to address a certain index in an array: 

ivec4(u_xlati12)

For line 65 it's unity_Builtins0Array and for 98,99 and 100 it's unity_Builtins0Array.

So now the question is, what is the value of ivec4(u_xlati12) and what generates it, to find out what is causing it.

The error is repeated quite often, and it's always that index.

The fact that I can also see variables named _OcclusionStrength and _OcclusionMap at least makes me think I'm looking in the right direction.
Comment 4 Thomas R. 2019-02-11 05:25:27 UTC
Parkitect has the same issue, it seems to be a general Unity thing.
Comment 5 GitLab Migration User 2019-09-25 18:28: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/1336.

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.