Fixed Canvases on iOS, added support for Canvas MSAA on OpenGL ES 3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-24 02:36:32 -04:00
parent 52c4f2c119
commit 517ee44e84
4 changed files with 46 additions and 28 deletions
+8 -17
View File
@@ -520,7 +520,7 @@ bool Canvas::createMSAAFBO(GLenum internalformat)
// Create our FBO without a texture.
status = strategy->createFBO(fbo, 0);
GLuint previous = 0;
GLuint previous = gl.getDefaultFBO();
if (current != this)
{
if (current != nullptr)
@@ -567,11 +567,8 @@ bool Canvas::loadVolatile()
return false;
}
int max_samples = 0;
if (GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object || GLAD_EXT_framebuffer_multisample)
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
requested_samples = std::max(std::min(requested_samples, max_samples), 0);
requested_samples = std::min(requested_samples, gl.getMaxRenderbufferSamples());
requested_samples = std::max(requested_samples, 0);
glGenTextures(1, &texture);
gl.bindTexture(texture);
@@ -596,14 +593,8 @@ bool Canvas::loadVolatile()
while (glGetError() != GL_NO_ERROR)
/* Clear the error buffer. */;
glTexImage2D(GL_TEXTURE_2D,
0,
iformat,
width, height,
0,
externalformat,
textype,
nullptr);
glTexImage2D(GL_TEXTURE_2D, 0, iformat, width, height, 0,
externalformat, textype, nullptr);
if (glGetError() != GL_NO_ERROR)
{
@@ -890,7 +881,7 @@ void Canvas::clear(Color c)
if (strategy == &strategyNone)
return;
GLuint previous = 0;
GLuint previous = gl.getDefaultFBO();
if (current != this)
{
@@ -1024,12 +1015,12 @@ bool Canvas::resolveMSAA()
if (!msaa_dirty)
return true;
GLuint previous = 0;
GLuint previous = gl.getDefaultFBO();
if (current != nullptr)
previous = current->fbo;
// Do the MSAA resolve by blitting the MSAA renderbuffer to the texture.
if (GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object)
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo);