Validation for setViewport should be `minDepth <= maxDepth`
The validation for setViewport says:
If any of the following conditions are unsatisfied, make this invalid and stop. ... minDepth < maxDepth
However, based on the discussion in https://github.com/gpuweb/cts/issues/3307#issuecomment-1908832369:
This seems like a bug in the WebGPU spec. I can't exactly recall exactly the discussions around this, but it seems the only constraint was reverse depth, not < vs <=. The D3D11 functional spec require <=, not < and that's the only constraint I have found (Vulkan doesn't have a constraint even in 1.0, and Metal docs say the two can be reversed).
it seems like that line should read:
minDepth <= maxDepth
I'm honestly not sure which is the correct answer. If the range is zero-sized, it might cause division by zero somewhere in the rasterization step?
cc @Kangz for insight
maxDepth - minDepth is used as a scaling factor for the Z coordinate, but not as a divider so we're ok I think.
I don't see anything in the Vulkan spec either which divides by pz := (maxDepth - minDepth)
LGTM to make this change - I've added it to the meeting agenda in case we don't resolve this before then.
I probably could have put this in Milestone 1 (as a request to loosen validation), but the CTS has already done the correct thing for 4 years (and Dawn didn't have any trouble implementing that) so I don't think this needs WG approval - since the tests were already enforcing it, it's effectively a spec typo (and thus milestone 0). https://github.com/gpuweb/cts/blame/9c8e5ba09314be2cec8a5cbd69b7b2f0fec7f89f/src/webgpu/api/validation/encoding/cmds/render/dynamic_state.spec.ts#L219