WindowSurfaceCGL: make resizing work correctly.
Previously the code didn't resize the depth buffer. Also adds a magic
setNeedsDisplay call when resizing a CALayer.
BUG=angleproject:1233
Change-Id: Id1906312f58d474e95a1b5ebfc15eff4344cd126
Reviewed-on: https://chromium-review.googlesource.com/318450
Tryjob-Request: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
index 656e91a..f80bb1a 100644
--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
+++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
@@ -112,6 +112,9 @@
if ([self frame].size.width != texture.width || [self frame].size.height != texture.height)
{
[self setFrame:CGRectMake(0, 0, texture.width, texture.height)];
+
+ // Without this, the OSX compositor / window system doesn't see the resize.
+ [self setNeedsDisplay];
}
// TODO(cwallez) support 2.1 contexts too that don't have blitFramebuffer nor the
@@ -251,6 +254,10 @@
mStateManager->bindTexture(GL_TEXTURE_2D, texture.texture);
mFunctions->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr);
+
+ mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mDSRenderbuffer);
+ mFunctions->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
+
texture.width = width;
texture.height = height;
}