gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 548 forks source link

basic conservative rasterization support for Vulkan & DX12 #3672

Closed Wumpf closed 3 years ago

Wumpf commented 3 years ago

Sorta fixes #3637

Only provides the very basic option of enabling/disabling overestimation rasterization. This is almost everything DX12 has to offer anyways except the optional SV_InnerCoverage support, but leaves out even more Vulkan goodies (e.g. underestimation, various device properties, configurable extra-over-estimation, conservative raster of lines...). Availability of the coverage variable is the most important missing thing but could later be exposed as an additional feature flag (debatable, since this is not how Vulkan does it, so more of a device property?)

Probably more controversial about this PR: validate_creation_desc_support I didn't want to repeat feature check code over all devices so I created a function on the desc that validates against features (and made unallowed use of DEPTH_CLAMP an error since this was close by..). Imho this is the only sane way forward for stuff like this since more often than not there needs to be a check somewhere but the philosophy of having this on this level and in that particular place might be questionable.

Tested this with wgpu - I already have wgpu and wgpu-rs branches ready with a sample that can swap back and forth between enabled and disabled conservative rasterization. Going to look like this:

image

PR checklist:

kvark commented 3 years ago

Looks great @Wumpf , thank you for adding this!

I share the concern about validate_creation_desc_support. The problem is - how do we consistently draw the line between what we validate and what not? A loooot of things can be validated. In some places the cost is nothing, in another the cost can be visible. Right now the balance is - validate the minimum, i.e. just the feature set on device creation, that's pretty much it! Everything else is just "oops, unexpected stuff came", it's not really validation. Adding the check for conservative and depth clamping, while leaving all the other 100 pipeline states, seems like a wrong balance to me.

So that "check somewhere" should be in wgpu, which is safe. Would you mind removing the validate_creation_desc_support check from the PR?

Wumpf commented 3 years ago

Alright, makes sense. Done!

kvark commented 3 years ago

Bors r+

On Mar 14, 2021, at 04:45, Wumpf @.***> wrote:

 Alright, makes sense. Done!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

bors[bot] commented 3 years ago

Build succeeded: