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

Metal Viewport: The values for znear and zfar must be between 0.0 and 1.0 #20611

Open
sgosztyla opened this issue Nov 20, 2020 · 0 comments
Open

Comments

@sgosztyla
Copy link
Contributor

  • cocos2d-x version:0x00040000
  • devices test on:iPhone iOS14

Steps to Reproduce:

  1. Run any app on device on iOS14

CommandBufferMTL Line:287

void CommandBufferMTL::setViewport(int x, int y, unsigned int w, unsigned int h)
{
    MTLViewport viewport;
    viewport.originX = x;
    viewport.originY = (int)(_renderTargetHeight - y - h);
    viewport.width = w;
    viewport.height = h;
    viewport.znear = -1;
    viewport.zfar = 1;
    [_mtlRenderEncoder setViewport:viewport];
}

The values for znear and zfar must be between 0.0 and 1.0

viewport.znear = 0;

Apple Developer Documentation
(https://developer.apple.com/documentation/metal/mtlrendercommandencoder/1515527-setviewport?language=objc)

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

1 participant