From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 101739] An issue with alpha-to-coverage handling is causing Arma 3 64-bit Linux port to render trees incorrectly Date: Mon, 10 Jul 2017 14:32:12 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1350809898==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 36E556E151 for ; Mon, 10 Jul 2017 14:32:12 +0000 (UTC) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1350809898== Content-Type: multipart/alternative; boundary="14996971320.5e1b6a31.22113"; charset="UTF-8" --14996971320.5e1b6a31.22113 Date: Mon, 10 Jul 2017 14:32:12 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D101739 Bug ID: 101739 Summary: An issue with alpha-to-coverage handling is causing Arma 3 64-bit Linux port to render trees incorrectly Product: Mesa Version: git Hardware: Other OS: All Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel@lists.freedesktop.org Reporter: krystian.galaj@vpltd.com QA Contact: dri-devel@lists.freedesktop.org The game is sometimes rendering trees. It has multiple tree mesh models, and when the tree gets close, the game is switching between different LODs/mode= ls by rendering both models overlapping on a grid of pixels, as if checkerboar= d, pixels of old LOD in black fields of it, new one in white. As long as it=E2=80=99s doing that using single-sampled buffers as render t= argets, all is fine. However in higher quality modes, the game switches to multisampled buffers. When using multisampled buffers, if ATOC is turned on in settings,= the game is using alpha-to-coverage technique without polygon sorting to make s= ure that the grass is rendered correctly. At the same time it=E2=80=99s using d= epth test and depth write to fill up the depth buffer. In the same execution of fragm= ent shader it sets the output color and alpha value, and the depth buffer value, and it expects the alpha value to cause the color value to end up only in s= ome samples of multisampled texture, and - the important bit - the depth value = to end up only in the corresponding samples of the depth buffer. This technique works on DX11 on Windows, on all drivers on Mac OS X, and on NVidia drivers on Linux, but on Mesa Radeonsi drivers on Linux it makes the rendering go bad, rendering most of the tree pixels white until the LOD transition ends. The white is visible on the screen because it is the initial color of the multisampled render target, and for some reason this color is allowed to le= ak through, which means that in some cases the depth buffer value is set, when= the corresponding color buffer value isn=E2=80=99t. Both depth and color buffer have the same number of samples (8), and were created with fixedSamples =3D true in OpenGL call. It looks as if the depth buffer values in case of Mesa Radeonsi driver were: - correctly not written when the depth test fails for the fragment shader, - correctly written to all samples of the depth buffer when alpha coverage directs the draw to fill them all, but - INCORRECTLY assigned not only to those samples to which alpha coverage directed the fragment output color, but either to all the samples in depth buffer, or to samples in depth buffer that don=E2=80=99t correspond to the = samples in color attachment buffer. We encountered the same issue in 2015 in fglrx drivers, contacted AMD team about it, and received confirmation that it is a bug, and that it was fixed. Unfortunately, shortly after that fglrx drivers went out of use. The issue can be easily reproduced in Arma 3 by: - launching Arma 3 game, - switching to High quality or higher to turn on multisampled buffers, - enabling ATOC (alpha to coverage) in Video settings, or making sure it's enabled, - launching first level of Drawdown 2035 campaign, ie. starting a new campaign, bypassing optional tutorial, and observing as the main character walks into the base, the bushes flicker white from time to time as they get closer. The issue is present in Mesa 17.2.0-devel from padoka PPA, on at least Rade= on R7 260X/360. --=20 You are receiving this mail because: You are the assignee for the bug.= --14996971320.5e1b6a31.22113 Date: Mon, 10 Jul 2017 14:32:12 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated
Bug ID 101739
Summary An issue with alpha-to-coverage handling is causing Arma 3 64= -bit Linux port to render trees incorrectly
Product Mesa
Version git
Hardware Other
OS All
Status NEW
Severity normal
Priority medium
Component Drivers/Gallium/radeonsi
Assignee dri-devel@lists.freedesktop.org
Reporter krystian.galaj@vpltd.com
QA Contact dri-devel@lists.freedesktop.org

The game is sometimes rendering trees. It has multiple tree me=
sh models, and
when the tree gets close, the game is switching between different LODs/mode=
ls
by rendering both models overlapping on a grid of pixels, as if checkerboar=
d,
pixels of old LOD in black fields of it, new one in white.

As long as it=E2=80=99s doing that using single-sampled buffers as render t=
argets, all
is fine. However in higher quality modes, the game switches to multisampled
buffers. When using multisampled buffers, if ATOC is turned on in settings,=
 the
game is using alpha-to-coverage technique without polygon sorting to make s=
ure
that the grass is rendered correctly. At the same time it=E2=80=99s using d=
epth test
and depth write to fill up the depth buffer. In the same execution of fragm=
ent
shader it sets the output color and alpha value, and the depth buffer value,
and it expects the alpha value to cause the color value to end up only in s=
ome
samples of multisampled texture, and - the important bit - the depth value =
to
end up only in the corresponding samples of the depth buffer.

This technique works on DX11 on Windows, on all drivers on Mac OS X, and on
NVidia drivers on Linux, but on Mesa Radeonsi drivers on Linux it makes the
rendering go bad, rendering most of the tree pixels white until the LOD
transition ends.

The white is visible on the screen because it is the initial color of the
multisampled render target, and for some reason this color is allowed to le=
ak
through, which means that in some cases the depth buffer value is set, when=
 the
corresponding color buffer value isn=E2=80=99t.

Both depth and color buffer have the same number of samples (8), and were
created with fixedSamples =3D true in OpenGL call.

It looks as if the depth buffer values in case of Mesa Radeonsi driver were:
 - correctly not written when the depth test fails for the fragment shader,
 - correctly written to all samples of the depth buffer when alpha coverage
directs the draw to fill them all, but
 - INCORRECTLY assigned not only to those samples to which alpha coverage
directed the fragment output color, but either to all the samples in depth
buffer, or to samples in depth buffer that don=E2=80=99t correspond to the =
samples in
color attachment buffer.

We encountered the same issue in 2015 in fglrx drivers, contacted AMD team
about it, and received confirmation that it is a bug, and that it was fixed.
Unfortunately, shortly after that fglrx drivers went out of use.

The issue can be easily reproduced in Arma 3 by:
 - launching Arma 3 game,
 - switching to High quality or higher to turn on multisampled buffers,
 - enabling ATOC (alpha to coverage) in Video settings, or making sure it's
enabled,
 - launching first level of Drawdown 2035 campaign, ie. starting a new
campaign, bypassing optional tutorial, and observing as the main character
walks into the base, the bushes flicker white from time to time as they get
closer.

The issue is present in Mesa 17.2.0-devel from padoka PPA, on at least Rade=
on
R7 260X/360.


You are receiving this mail because:
  • You are the assignee for the bug.
= --14996971320.5e1b6a31.22113-- --===============1350809898== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1350809898==--