Bug 102634

Summary: 0 Color write masks with multiple render targets redirects color outputs to wrong attachment
Product: Mesa Reporter: maister
Component: Drivers/Vulkan/radeonAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: 17.1   
Hardware: Other   
OS: All   
i915 platform: i915 features:
Attachments: Expected output
Wrong output when WORKAROUND_RADV = 0

Description maister 2017-09-09 10:19:17 UTC
Created attachment 134107 [details]
Expected output

Hardware: RX 470
Mesa: 17.1.8
OS: Arch Linux

I have a deferred shader which emits color data to 4 attachments. When colorWriteMask of all attachments are 0xf, this works as expected, but when I try to mask out writes to layout(location = 0), it is almost as if all the attachments are reshuffled so that location = 1 writes to attachment 0, location = 2 writes to attachment = 1 ... and so on.

Here is the current workaround I must apply: https://github.com/Themaister/Granite/blob/master/assets/shaders/inc/render_target.h#L8

The scenario which fails:
- 4 color attachments in a subpass
- Color masks are {0, 0xf, 0xf, 0xf}
- The shader does not declare layout(location = 0) output

To reproduce:
Build Granite: https://github.com/Themaister/Granite
Run Suzanne model: ./granite/tests/gltf-viewer ~/git/glTF-Sample-Models/2.0/Suzanne/glTF/Suzanne.gltf

Fiddle with WORKAROUND_RADV define mentioned above:
Comment 1 maister 2017-09-09 10:19:51 UTC
Created attachment 134108 [details]
Wrong output when WORKAROUND_RADV = 0
Comment 2 maister 2017-09-09 22:05:24 UTC
Actually, this seems to work in Mesa 17.2
Comment 3 Bas Nieuwenhuizen 2017-10-01 11:50:19 UTC
Since this has been reported to work with 17.2 and the last release of 17.1 has been released, there is nothing to be done here.

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.