这是indexloc提供的服务,不要输入任何密码
Skip to content

Viewport rect must lie entirely within the current attachment size? #373

@Richard-Yunchao

Description

@Richard-Yunchao

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIapi-milestone-2-202502api issues that were in milestone 2 before we triaged milestone 1 on 2025-02-19

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions