Bug 106687

Summary: radv: Fast color clears use incorrect format
Product: Mesa Reporter: Philip Rebohle <philip.rebohle>
Component: Drivers/Vulkan/radeonAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Possible fix

Description Philip Rebohle 2018-05-28 12:59:34 UTC
Created attachment 139814 [details] [review]
Possible fix

Hello,

When clearing render targets, fast color clears use the image format rather than the format of the image view, which is incorrect if the formats differ. This leads to a rendering issue in ELEX with DXVK:

    https://github.com/doitsujin/dxvk/issues/289

Here's a Renderdoc capture that shows the issue (recorded on Polaris):

    https://mega.nz/#!NfZAnTxQ!YwtksOUn5OLGxotQss5xbAFOfXddHilTDolUykqihB8

At EID 10305, the game clears a render target view with VK_FORMAT_R8G8B8A8_UNORM where the image itself has the format VK_FORMAT_R8G8B8A8_UINT. As a result, the alpha value of the cleared image is incorrect (129 instead of 1).

This issue does not occur when setting RADV_DEBUG=nofastclears.

The attached patch fixes the issue for this game, although I'm not sure if it is entirely correct.
Comment 1 Edmondo Tommasina 2018-06-03 15:05:38 UTC
This patch fixes the issue in Elex with DXVK for me. Thanks.

(Polaris, RX 470, radv)
Comment 2 Bas Nieuwenhuizen 2018-06-05 21:56:13 UTC
Looks correct to me and no CTS regressions here, so

https://cgit.freedesktop.org/mesa/mesa/commit/?id=cc21e96d5f412aae5d3982dde0d4c926e8d049e8

Thanks!

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.