Only call glInvalidateFramebuffer if it is available.
BUG=angleproject:885
Change-Id: I30a9bcebc80805aea0c12d9c67194b7b0c98200f
Reviewed-on: https://chromium-review.googlesource.com/263475
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 685fd04..d543f95 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -149,15 +149,25 @@
gl::Error FramebufferGL::invalidate(size_t count, const GLenum *attachments)
{
- mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
- mFunctions->invalidateFramebuffer(GL_FRAMEBUFFER, count, attachments);
+ // Since this function is just a hint and not available until OpenGL 4.3, only call it if it is available.
+ if (mFunctions->invalidateFramebuffer)
+ {
+ mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+ mFunctions->invalidateFramebuffer(GL_FRAMEBUFFER, count, attachments);
+ }
+
return gl::Error(GL_NO_ERROR);
}
gl::Error FramebufferGL::invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area)
{
- mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
- mFunctions->invalidateSubFramebuffer(GL_FRAMEBUFFER, count, attachments, area.x, area.y, area.width, area.height);
+ // Since this function is just a hint and not available until OpenGL 4.3, only call it if it is available.
+ if (mFunctions->invalidateSubFramebuffer)
+ {
+ mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+ mFunctions->invalidateSubFramebuffer(GL_FRAMEBUFFER, count, attachments, area.x, area.y, area.width, area.height);
+ }
+
return gl::Error(GL_NO_ERROR);
}