Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1640)

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 14091008: Add support for GL_EXT_multisampled_render_to_texture. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
===================================================================
--- src/gpu/gl/GrGpuGL.cpp (revision 8935)
+++ src/gpu/gl/GrGpuGL.cpp (working copy)
@@ -781,6 +781,10 @@
GrGLenum msColorFormat = 0; // suppress warning
+ if (desc->fSampleCnt > 0 && GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType()) {
+ goto FAILED;
+ }
+
GL_CALL(GenFramebuffers(1, &desc->fTexFBOID));
if (!desc->fTexFBOID) {
goto FAILED;
@@ -791,10 +795,7 @@
// the texture bound to the other. The exception is the IMG multisample extension. With this
// extension the texture is multisampled when rendered to and then auto-resolves it when it is
// rendered from.
- if (desc->fSampleCnt > 0 && GrGLCaps::kImaginationES_MSFBOType != this->glCaps().msFBOType()) {
- if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType()) {
- goto FAILED;
- }
+ if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) {
GL_CALL(GenFramebuffers(1, &desc->fRTFBOID));
GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID));
if (!desc->fRTFBOID ||
@@ -802,7 +803,9 @@
!this->configToGLFormats(desc->fConfig,
// GLES requires sized internal formats
kES2_GrGLBinding == this->glBinding(),
- &msColorFormat, NULL, NULL)) {
+ &msColorFormat,
+ NULL,
+ NULL)) {
goto FAILED;
}
} else {
@@ -836,7 +839,7 @@
}
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID));
- if (GrGLCaps::kImaginationES_MSFBOType == this->glCaps().msFBOType() && desc->fSampleCnt > 0) {
+ if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) {
GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_TEXTURE_2D,
@@ -1681,9 +1684,8 @@
void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) {
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target);
if (rt->needsResolve()) {
- // The IMG extension automatically resolves the texture when it is read.
- if (GrGLCaps::kImaginationES_MSFBOType != this->glCaps().msFBOType()) {
- GrAssert(GrGLCaps::kNone_MSFBOType != this->glCaps().msFBOType());
+ // Some extensions automatically resolves the texture when it is read.
+ if (this->glCaps().usesMSAARenderBuffers()) {
GrAssert(rt->textureFBOID() != rt->renderFBOID());
GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID()));
GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID()));
@@ -1697,7 +1699,7 @@
dirtyRect.width(), dirtyRect.height(), target->origin());
GrAutoTRestore<ScissorState> asr;
- if (GrGLCaps::kAppleES_MSFBOType == this->glCaps().msFBOType()) {
+ if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) {
// Apple's extension uses the scissor as the blit bounds.
asr.reset(&fScissorState);
fScissorState.fEnabled = true;
@@ -1705,9 +1707,8 @@
this->flushScissor();
GL_CALL(ResolveMultisampleFramebuffer());
} else {
- if (GrGLCaps::kDesktopARB_MSFBOType != this->glCaps().msFBOType()) {
+ if (GrGLCaps::kDesktop_EXT_MSFBOType == this->glCaps().msFBOType()) {
// this respects the scissor during the blit, so disable it.
- GrAssert(GrGLCaps::kDesktopEXT_MSFBOType == this->glCaps().msFBOType());
asr.reset(&fScissorState);
fScissorState.fEnabled = false;
this->flushScissor();
@@ -2233,9 +2234,9 @@
const GrSurface* src,
const GrGpuGL* gpu,
bool* wouldNeedTempFBO = NULL) {
- if (gpu->isConfigRenderable(dst->config()) && gpu->isConfigRenderable(src->config()) &&
- (GrGLCaps::kDesktopEXT_MSFBOType == gpu->glCaps().msFBOType() ||
- GrGLCaps::kDesktopARB_MSFBOType == gpu->glCaps().msFBOType())) {
+ if (gpu->isConfigRenderable(dst->config()) &&
+ gpu->isConfigRenderable(src->config()) &&
+ gpu->glCaps().usesMSAARenderBuffers()) {
if (NULL != wouldNeedTempFBO) {
*wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->asRenderTarget();
}
@@ -2411,7 +2412,7 @@
dst->origin());
GrAutoTRestore<ScissorState> asr;
- if (GrGLCaps::kDesktopEXT_MSFBOType == this->glCaps().msFBOType()) {
+ if (GrGLCaps::kDesktop_EXT_MSFBOType == this->glCaps().msFBOType()) {
// The EXT version applies the scissor during the blit, so disable it.
asr.reset(&fScissorState);
fScissorState.fEnabled = false;
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698