-
Notifications
You must be signed in to change notification settings - Fork 329
Description
Metal documentation says that "The x/y rectangle of the viewport must lie entirely within the current attachment size". See https://developer.apple.com/documentation/metal/mtlrendercommandencoder/1515527-setviewport?language=objc.
The current setViewport API in WebGPU doesn't require this. The viewport rect can be bigger than the current attachment size, or it can be set to somewhere outside of the attachment size.
When I implement this API in Dawn project, I obey the WebGPU's rule and break Metal's requirement, the tests (outside of current attachment size) can pass on Metal backend even the Metal validation layer is on. Looks like Metal's implementation doesn't follow its documentation on this.
Say the attachment's (x, y, w, h) = {0, 0, 4, 4}. The viewport rect is {0, 0, 8, 8}, or {-2, -2, 4, 4} or something like this.
What do you think, @litherum , @grorg , @JusSn ? Can you verify this with Metal team? BTW, I can find similar statement in Metal documentation for SetScissorRect that the scissor rect must lie entirely inside the attachment. And we do need to obey this rule.
FYI. @Kangz , @kainino0x , @austinEng . We simply discussed this in Dawn patch.