Bug 97852 - Unreal Engine corrupted preview viewport
Summary: Unreal Engine corrupted preview viewport
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Tapani Pälli
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-18 19:39 UTC by Markus
Modified: 2017-11-30 11:25 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Viewport corruption (41.14 KB, image/png)
2016-09-18 19:39 UTC, Markus
Details
API trace (27.62 MB, application/x-7z-compressed)
2016-10-30 16:57 UTC, Markus
Details
wokaround (10.88 KB, patch)
2017-11-21 07:23 UTC, Tapani Pälli
Details | Splinter Review
workaround (11.79 KB, patch)
2017-11-22 06:16 UTC, Tapani Pälli
Details | Splinter Review

Description Markus 2016-09-18 19:39:49 UTC
Created attachment 126603 [details]
Viewport corruption

Unreal Engine 4.13.1 editor shows corrupted preview viewports when at least one of the following post-processing effects is active in a viewport:
* Motion Blur
* Tonemapper

A screenshot of a viewport segment is attached.

When both effects are turned off, viewports appear to render correctly.


Graphics card: AMD TONGA chipset (Radeo R9 380)
Mesa version: 12.1~git1600917222200.073129c~x~padoka0 on Ubuntu 16.04 with Padoka PPA
glxinfo:
  OpenGL core profile version string: 4.3 (Core Profile) Mesa 12.1.0-devel - padoka PPA
  OpenGL version string: 3.0 Mesa 12.1.0-devel - padoka PPA
  OpenGL ES profile version string: OpenGL ES 3.1 Mesa 12.1.0-devel - padoka PPA
Comment 1 Nicolai Hähnle 2016-09-28 12:00:40 UTC
Hi Markus, can you provide an apitrace that can reproduce the corruption?
Comment 2 Markus 2016-10-09 15:59:48 UTC
(In reply to Nicolai Hähnle from comment #1)
> Hi Markus, can you provide an apitrace that can reproduce the corruption?
Hi Nicolai, I'm not familiar with debugging Mesa. Could you please provide a link to documentation on how I can obtain the information you need?
Comment 3 Nicolai Hähnle 2016-10-09 18:31:17 UTC
Use this tool: https://github.com/apitrace/apitrace to record a session that shows the problem. Once installed, you basically just run `apitrace trace <program under trace>`. The documentation linked to in the readme is generally pretty good.
Comment 4 Markus 2016-10-30 16:57:37 UTC
Created attachment 127627 [details]
API trace
Comment 5 Markus 2016-10-30 17:01:24 UTC
(In reply to Nicolai Hähnle from comment #3)
> Use this tool: https://github.com/apitrace/apitrace to record a session that
> shows the problem. Once installed, you basically just run `apitrace trace
> <program under trace>`. The documentation linked to in the readme is
> generally pretty good.

Hi Nicolai, an API trace is now attached. The trace was created with Mesa version 13.1~git161022230600.7b7eb71~x~padoka0 where the issue is still present.

The major part of the trace probably consists of the editor starting up, so the issue itself should only be captured in the seconds prior to the editor starting to shut down.
Comment 6 Michel Dänzer 2016-10-31 06:24:30 UTC
A shader program fails to link, see below. This may be an Unreal Engine (editor) bug, reassigning to the GLSL compiler for now.

839119 @4 glLinkProgram(program = 3018)
839119: warning: link failed
839119: warning: error: vertex shader output `out_TEXCOORD0' specifies noperspective interpolation qualifier, but fragment shader input specifies no interpolation qualifier

Mesa: User error: GL_INVALID_OPERATION in glUseProgram(program 3018 not linked)
[more errors]
Comment 7 Tapani Pälli 2016-10-31 07:15:07 UTC
AFAIK this error is valid for GLSL version < 440, which GLSL version is this shader written against?
Comment 8 Michel Dänzer 2016-10-31 07:18:28 UTC
strings UE4Editor.1.trace|grep '#version'|sort -u

only yields "#version 430".
Comment 9 Grazvydas Ignotas 2017-01-04 00:42:19 UTC
A game "Refunct" also suffers from this when "post process" setting is set to "ultra".

Since this limitation is rather artificial, and multiple released programs are affected, could it be demoted to a warning?
Comment 10 Markus 2017-08-01 22:26:35 UTC
Any news on this?
Comment 11 Timothee Besset 2017-10-05 15:35:13 UTC
Possibly related: https://github.com/EpicGames/UnrealEngine/pull/4080/files (engine side fix)

While an engine fix is always desireable .. "for the future", I agree that if this could be turned into a warning on the driver side it would be nice.
Comment 12 Tapani Pälli 2017-11-21 07:23:55 UTC
Created attachment 135622 [details] [review]
wokaround

since we now have another case (Observer_) here's a workaround suggestion.
Comment 13 Tapani Pälli 2017-11-22 06:16:16 UTC
Created attachment 135659 [details] [review]
workaround

sorry .. there was some issues, fixed workaround
Comment 14 Tapani Pälli 2017-11-30 11:25:32 UTC
workaround pushed to Mesa master

--- 8< ---
commit faccbaf3faf9a7cdcda3e4032fafd0f6064459bd
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Fri Nov 24 07:46:07 2017 +0200

    mesa: add AllowGLSLCrossStageInterpolationMismatch workaround
    
    This fixes issues seen with certain versions of Unreal Engine 4 editor
    and games built with that using GLSL 4.30.
    
    v2: add driinfo_gallium change (Emil Velikov)
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801
    Acked-by: Andres Gomez <agomez@igalia.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>


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.