Bug 109519

Summary: Input sample mask has unexpected values
Product: Mesa Reporter: Józef Kucia <joseph.kucia>
Component: Drivers/Vulkan/intelAssignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: CLOSED NOTOURBUG QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: danylo.piliaiev, jason
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: resulting image on anv

Description Józef Kucia 2019-01-31 14:41:52 UTC
This can be reproduced using vkd3d tests. test_coverage() sets pSampleMask when creating a pipeline and writes shader input SampleMask to the render target. The test passes on other Vulkan implementations and on Intel D3D12 implementation.

d3d12:23726:sample mask 0x7: Test failed: Got 0x00000003, expected 0x00000007 at (0, 0, 0).
d3d12:23726:sample mask 0x9: Test failed: Got 0x00000001, expected 0x00000009 at (0, 0, 0).
d3d12:23726:sample mask 0xd: Test failed: Got 0x00000001, expected 0x0000000d at (0, 0, 0).
d3d12:23726:sample mask 0xf: Test failed: Got 0x00000003, expected 0x0000000f at (0, 0, 0).
d3d12:23726:sample mask 0xff: Test failed: Got 0x00000003, expected 0x0000000f at (0, 0, 0).
d3d12:23726:sample mask 0xffffffff: Test failed: Got 0x00000003, expected 0x0000000f at (0, 0, 0).
Comment 1 Danylo 2019-03-01 13:38:48 UTC
Created attachment 143510 [details]
resulting image on anv

Hi, sorry for the delay.

I checked an output of the test in RenderDoc and saw this (see attachment). There is a diagonal of pixels having a *wrong* mask.

It is happening because this test draws a big triangle which covers the whole render area and this triangle is being clipped which divides it and creates new geometry.

So on this diagonal there are two fragments per one pixel and to get the right coverage you should add their coverages together.

e.g. you can achieve this by having ssbo and atomic adding sample mask to the corresponding fragment's position (suggested by Lionel on irc).
Comment 2 Lionel Landwerlin 2019-03-01 13:44:30 UTC
(In reply to Danylo from comment #1)
> Created attachment 143510 [details]
> resulting image on anv
> 
> Hi, sorry for the delay.
> 
> I checked an output of the test in RenderDoc and saw this (see attachment).
> There is a diagonal of pixels having a *wrong* mask.
> 
> It is happening because this test draws a big triangle which covers the
> whole render area and this triangle is being clipped which divides it and
> creates new geometry.
> 
> So on this diagonal there are two fragments per one pixel and to get the
> right coverage you should add their coverages together.
> 
> e.g. you can achieve this by having ssbo and atomic adding sample mask to
> the corresponding fragment's position (suggested by Lionel on irc).

Here is how we did it for a post depth coverage test :

https://gitlab.freedesktop.org/mesa/piglit/blob/master/tests/spec/arb_post_depth_coverage/multisampling.c#L75
Comment 3 Józef Kucia 2019-03-01 13:49:04 UTC
I should have a closer look into the issue before reporting the bug. 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.