Commit 902b5587 by Corentin Wallez Committed by Commit Bot

CGL/EAGL: Fix default FBO size on Retina displays

This was found while trying to fix https://github.com/glfw/glfw/issues/1169 VulkanSurfaceMtl and metal/SurfaceMtl already handle contentsScale correctly. Change-Id: I234d7b0901dd7c075cf1e9d58466f52140ab1e2b Bug: None Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2154670Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 4a1d9226
......@@ -212,6 +212,7 @@ egl::Error WindowSurfaceCGL::initialize(const egl::Display *display)
withContext:mContext
withFunctions:mFunctions];
[mLayer addSublayer:mSwapLayer];
[mSwapLayer setContentsScale:[mLayer contentsScale]];
mFunctions->genRenderbuffers(1, &mDSRenderbuffer);
mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mDSRenderbuffer);
......@@ -301,12 +302,12 @@ void WindowSurfaceCGL::setSwapInterval(EGLint interval)
EGLint WindowSurfaceCGL::getWidth() const
{
return (EGLint)CGRectGetWidth([mLayer frame]);
return static_cast<EGLint>(CGRectGetWidth([mLayer frame]) * [mLayer contentsScale]);
}
EGLint WindowSurfaceCGL::getHeight() const
{
return (EGLint)CGRectGetHeight([mLayer frame]);
return static_cast<EGLint>(CGRectGetHeight([mLayer frame]) * [mLayer contentsScale]);
}
EGLint WindowSurfaceCGL::isPostSubBufferSupported() const
......
......@@ -177,6 +177,7 @@ egl::Error WindowSurfaceEAGL::initialize(const egl::Display *display)
withContext:mContext
withFunctions:mFunctions];
[mLayer addSublayer:mSwapLayer];
[mSwapLayer setContentsScale:[mLayer contentsScale]];
mFunctions->genRenderbuffers(1, &mDSRenderbuffer);
mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mDSRenderbuffer);
......@@ -266,12 +267,12 @@ void WindowSurfaceEAGL::setSwapInterval(EGLint interval)
EGLint WindowSurfaceEAGL::getWidth() const
{
return (EGLint)CGRectGetWidth([mLayer frame]);
return static_cast<EGLint>(CGRectGetWidth([mLayer frame]) * [mLayer contentsScale]);
}
EGLint WindowSurfaceEAGL::getHeight() const
{
return (EGLint)CGRectGetHeight([mLayer frame]);
return static_cast<EGLint>(CGRectGetHeight([mLayer frame]) * [mLayer contentsScale]);
}
EGLint WindowSurfaceEAGL::isPostSubBufferSupported() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment