Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lines are thicker than 1px on Windows Dx12 #5830

Open
kjarosh opened this issue Jun 17, 2024 · 2 comments
Open

Lines are thicker than 1px on Windows Dx12 #5830

kjarosh opened this issue Jun 17, 2024 · 2 comments

Comments

@kjarosh
Copy link
Contributor

kjarosh commented Jun 17, 2024

Description

When drawing lines using PrimitiveTopology::LineList or PrimitiveTopology::LineStrip, they are 1px thick on Vulkan and Gl, but on Dx12 they are thicker than 1px when MSAA sample count is greater than 1.

I suspect this has something to do with their rasterization rules:

Rasterization rules for primitives are, in general, unchanged by multisample antialiasing, except:
[...]
A line is treated as a rectangle made up of two triangles, with a line width of 1.4.

Repro steps

Draw a line on Dx12 using PrimitiveTopology::LineList or PrimitiveTopology::LineStrip with MultisampleState.count > 1.

Expected vs observed behavior

Expected: lines always have 1px.

Observed: lines have 1px for Vulkan, Gl, Dx12 without MSAA, but they are thicker than 1px for Dx12 with MSAA.

Extra materials

Dx12 with MSAA on Windows Vulkan with MSAA on Linux

Platform

I actually do not use Windows at all, but unfortunately our tests at Ruffle started failing on the Windows runner when I started using PrimitiveTopology::LineStrip (ruffle-rs/ruffle#16619, failing job). I have confirmed that it in fact does look like that on a Windows machine.

@cwfitzgerald
Copy link
Member

This probably needs to be bumped up to webgpu as it's unclear what we're supposed to do here - I suspect there's not a ton we can do about this, without extremely expensive polyfills.

@Diggsey
Copy link
Contributor

Diggsey commented Jun 17, 2024

Couldn't you just set MultisampleEnable to FALSE in the rasterizer state?

https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_rasterizer_desc

MultisampleEnable

Type: BOOL

Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render targets. Set to TRUE to use the quadrilateral line anti-aliasing algorithm and to FALSE to use the alpha line anti-aliasing algorithm. For more info about this member, see Remarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants