Add GL_CHROMIUM_framebuffer_multisample support.
Review URL: http://codereview.appspot.com/4287072/ git-svn-id: http://skia.googlecode.com/svn/trunk@984 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
c04e6d500c
commit
a9ecdadfbc
@ -7,6 +7,7 @@
|
||||
// prototypes.
|
||||
#define GL_OES_mapbuffer 0
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define GR_GL_PLATFORM_HEADER <GLES2/gl2.h>
|
||||
#define GR_GL_PLATFORM_HEADER_EXT <GLES2/gl2ext.h>
|
||||
|
||||
|
@ -212,11 +212,26 @@ void InitializeGLInterfaceExtensions(GrGLInterface* glBindings) {
|
||||
fboFound = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GL_APPLE_framebuffer_multisample
|
||||
if (has_gl_extension_from_string("GL_APPLE_framebuffer_multisample",
|
||||
bool msaaFound = false;
|
||||
// Chrome advertises the equivalent of GL_EXT_framebuffer_blit plus
|
||||
// GL_EXT_framebuffer_multisample as GL_CHROMIUM_framebuffer_multisample
|
||||
// The EXT suffixes are used on the functions, however.
|
||||
#if GL_EXT_framebuffer_multisample
|
||||
if (!msaaFound &&
|
||||
has_gl_extension_from_string("GL_CHROMIUM_framebuffer_multisample",
|
||||
extensionString)) {
|
||||
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
|
||||
GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT);
|
||||
msaaFound = true;
|
||||
}
|
||||
#endif
|
||||
#if GL_APPLE_framebuffer_multisample
|
||||
if (!msaaFound &&
|
||||
has_gl_extension_from_string("GL_APPLE_framebuffer_multisample",
|
||||
extensionString)) {
|
||||
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, APPLE);
|
||||
GR_GL_GET_PROC_SUFFIX(ResolveMultisampleFramebuffer, APPLE);
|
||||
msaaFound = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -230,25 +230,37 @@ GrGpuGL::GrGpuGL() {
|
||||
|
||||
memset(fAASamples, 0, sizeof(fAASamples));
|
||||
fMSFBOType = kNone_MSFBO;
|
||||
if (has_gl_extension("GL_APPLE_framebuffer_multisample")) {
|
||||
fMSFBOType = kApple_MSFBO;
|
||||
if (gPrintStartupSpew) {
|
||||
GrPrintf("MSAA Support: APPLE ES EXT.\n");
|
||||
if (GR_GL_SUPPORT_ES) {
|
||||
if (has_gl_extension("GL_CHROMIUM_framebuffer_multisample")) {
|
||||
// chrome's extension is equivalent to the EXT msaa
|
||||
// and fbo_blit extensions.
|
||||
fMSFBOType = kDesktopEXT_MSFBO;
|
||||
} else if (has_gl_extension("GL_APPLE_framebuffer_multisample")) {
|
||||
fMSFBOType = kAppleES_MSFBO;
|
||||
}
|
||||
} else {
|
||||
GrAssert(GR_GL_SUPPORT_DESKTOP);
|
||||
if ((major >= 3) || has_gl_extension("GL_ARB_framebuffer_object")) {
|
||||
fMSFBOType = kDesktopARB_MSFBO;
|
||||
} else if (has_gl_extension("GL_EXT_framebuffer_multisample") &&
|
||||
has_gl_extension("GL_EXT_framebuffer_blit")) {
|
||||
fMSFBOType = kDesktopEXT_MSFBO;
|
||||
}
|
||||
}
|
||||
else if (GR_GL_SUPPORT_DESKTOP && (
|
||||
(major >= 3) ||
|
||||
has_gl_extension("GL_ARB_framebuffer_object") ||
|
||||
(has_gl_extension("GL_EXT_framebuffer_multisample") &&
|
||||
has_gl_extension("GL_EXT_framebuffer_blit")))) {
|
||||
fMSFBOType = kDesktop_MSFBO;
|
||||
if (gPrintStartupSpew) {
|
||||
GrPrintf("MSAA Support: DESKTOP\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (gPrintStartupSpew) {
|
||||
GrPrintf("MSAA Support: NONE\n");
|
||||
if (gPrintStartupSpew) {
|
||||
switch (fMSFBOType) {
|
||||
case kNone_MSFBO:
|
||||
GrPrintf("MSAA Support: NONE\n");
|
||||
break;
|
||||
case kDesktopARB_MSFBO:
|
||||
GrPrintf("MSAA Support: DESKTOP ARB.\n");
|
||||
break;
|
||||
case kDesktopEXT_MSFBO:
|
||||
GrPrintf("MSAA Support: DESKTOP EXT.\n");
|
||||
break;
|
||||
case kAppleES_MSFBO:
|
||||
GrPrintf("MSAA Support: APPLE ES.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1324,19 +1336,24 @@ void GrGpuGL::resolveTextureRenderTarget(GrGLTexture* texture) {
|
||||
// we will have rendered to the top of the FBO.
|
||||
GrGLint top = texture->allocHeight();
|
||||
GrGLint bottom = texture->allocHeight() - texture->height();
|
||||
if (kApple_MSFBO == fMSFBOType) {
|
||||
if (kAppleES_MSFBO == fMSFBOType) {
|
||||
// Apple's extension uses the scissor as the blit bounds.
|
||||
GR_GL(Enable(GR_GL_SCISSOR_TEST));
|
||||
GR_GL(Scissor(left, bottom, right-left, top-bottom));
|
||||
GR_GL(ResolveMultisampleFramebuffer());
|
||||
fHWBounds.fScissorRect.invalidate();
|
||||
fHWBounds.fScissorEnabled = true;
|
||||
} else {
|
||||
if (kDesktopARB_MSFBO != fMSFBOType) {
|
||||
// these respect the scissor during the blit, so disable it.
|
||||
GrAssert(kDesktopEXT_MSFBO == fMSFBOType);
|
||||
flushScissor(NULL);
|
||||
}
|
||||
GR_GL(BlitFramebuffer(left, bottom, right, top,
|
||||
left, bottom, right, top,
|
||||
GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST));
|
||||
}
|
||||
rt->setDirty(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,9 +165,10 @@ private:
|
||||
|
||||
GrGLuint fAASamples[4];
|
||||
enum {
|
||||
kNone_MSFBO = 0,
|
||||
kDesktop_MSFBO,
|
||||
kApple_MSFBO
|
||||
kNone_MSFBO = 0, //<! no support for MSAA FBOs
|
||||
kDesktopARB_MSFBO,//<! GL3.0-style MSAA FBO (GL_ARB_framebuffer_object)
|
||||
kDesktopEXT_MSFBO,//<! earlier GL_EXT_framebuffer* extensions
|
||||
kAppleES_MSFBO, //<! GL_APPLE_framebuffer_multisample ES extension
|
||||
} fMSFBOType;
|
||||
|
||||
// Do we have stencil wrap ops.
|
||||
|
Loading…
Reference in New Issue
Block a user