Added Canvas MSAA support in OpenGL ES 2 on iOS and when ANGLE is used on Windows.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-24 03:07:46 -04:00
parent 517ee44e84
commit 2cc53bb85c
3 changed files with 44 additions and 20 deletions
+12 -4
View File
@@ -149,12 +149,11 @@ struct FramebufferStrategyCorePacked : public FramebufferStrategy
return true;
}
virtual bool createMSAABuffer(int width, int height, int &samples, GLenum internalformat, GLuint &buffer)
virtual bool createMSAABuffer(int width, int height, int &samples, GLenum iformat, GLuint &buffer)
{
glGenRenderbuffers(1, &buffer);
glBindRenderbuffer(GL_RENDERBUFFER, buffer);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, internalformat,
width, height);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, iformat, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, buffer);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &samples);
@@ -1020,7 +1019,10 @@ bool Canvas::resolveMSAA()
previous = current->fbo;
// Do the MSAA resolve by blitting the MSAA renderbuffer to the texture.
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object)
// For many of the extensions that add suffixes to the functions, we assign
// function pointers in OpenGL.cpp so we can call the core functions.
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object
|| GLAD_ANGLE_framebuffer_multisample)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo);
@@ -1034,6 +1036,12 @@ bool Canvas::resolveMSAA()
glBlitFramebufferEXT(0, 0, width, height, 0, 0, width, height,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
else if (GLAD_APPLE_framebuffer_multisample)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo);
glResolveMultisampleFramebufferAPPLE();
}
else
return false;