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

Side by Side Diff: src/gpu/gl/GrGpuGL.cpp

Issue 23404002: Add support for ES3 MSAA. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rebase and comments Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 ctx.info().caps()->getMSAACoverageMode(sampleCount); 782 ctx.info().caps()->getMSAACoverageMode(sampleCount);
783 GL_ALLOC_CALL(ctx.interface(), 783 GL_ALLOC_CALL(ctx.interface(),
784 RenderbufferStorageMultisampleCoverage(GR_GL_RENDERBUFFER, 784 RenderbufferStorageMultisampleCoverage(GR_GL_RENDERBUFFER,
785 mode.fCoverageSampleCnt, 785 mode.fCoverageSampleCnt,
786 mode.fColorSampleCnt, 786 mode.fColorSampleCnt,
787 format, 787 format,
788 width, height)); 788 width, height));
789 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); 789 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));
790 } 790 }
791 if (!created) { 791 if (!created) {
792 #if GR_GL_IGNORE_ES3_MSAA
792 GL_ALLOC_CALL(ctx.interface(), 793 GL_ALLOC_CALL(ctx.interface(),
793 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, 794 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER,
794 sampleCount, 795 sampleCount,
795 format, 796 format,
796 width, height)); 797 width, height));
798 #else
799 switch (ctx.info().caps()->msFBOType()) {
800 case GrGLCaps::kDesktop_ARB_MSFBOType:
801 case GrGLCaps::kDesktop_EXT_MSFBOType:
802 case GrGLCaps::kES_3_0_MSFBOType:
803 GL_ALLOC_CALL(ctx.interface(),
804 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER,
805 sampleCount,
806 format,
807 width, height));
808 break;
809 case GrGLCaps::kES_Apple_MSFBOType:
810 GL_ALLOC_CALL(ctx.interface(),
811 RenderbufferStorageMultisampleES2APPLE(GR_GL_RENDE RBUFFER,
812 sampleCount ,
813 format,
814 width, heig ht));
815 break;
816 case GrGLCaps::kES_EXT_MsToTexture_MSFBOType:
817 case GrGLCaps::kES_IMG_MsToTexture_MSFBOType:
818 GL_ALLOC_CALL(ctx.interface(),
819 RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERB UFFER,
820 sampleCount,
821 format,
822 width, height ));
823 break;
824 case GrGLCaps::kNone_MSFBOType:
825 GrCrash("Shouldn't be here if we don't support multisampled rend erbuffers.");
826 break;
827 }
828 #endif
797 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); 829 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));
798 } 830 }
799 return created; 831 return created;
800 } 832 }
801 } 833 }
802 834
803 bool GrGpuGL::createRenderTargetObjects(int width, int height, 835 bool GrGpuGL::createRenderTargetObjects(int width, int height,
804 GrGLuint texID, 836 GrGLuint texID,
805 GrGLRenderTarget::Desc* desc) { 837 GrGLRenderTarget::Desc* desc) {
806 desc->fMSColorRenderbufferID = 0; 838 desc->fMSColorRenderbufferID = 0;
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 2338
2307 namespace { 2339 namespace {
2308 // Determines whether glBlitFramebuffer could be used between src and dst. 2340 // Determines whether glBlitFramebuffer could be used between src and dst.
2309 inline bool can_blit_framebuffer(const GrSurface* dst, 2341 inline bool can_blit_framebuffer(const GrSurface* dst,
2310 const GrSurface* src, 2342 const GrSurface* src,
2311 const GrGpuGL* gpu, 2343 const GrGpuGL* gpu,
2312 bool* wouldNeedTempFBO = NULL) { 2344 bool* wouldNeedTempFBO = NULL) {
2313 if (gpu->isConfigRenderable(dst->config()) && 2345 if (gpu->isConfigRenderable(dst->config()) &&
2314 gpu->isConfigRenderable(src->config()) && 2346 gpu->isConfigRenderable(src->config()) &&
2315 gpu->glCaps().usesMSAARenderBuffers()) { 2347 gpu->glCaps().usesMSAARenderBuffers()) {
2348 // ES3 doesn't allow framebuffer blits when the src has MSAA and the con figs don't match
2349 // or the rects are not the same (not just the same size but have the sa me edges).
2350 if (GrGLCaps::kES_3_0_MSFBOType == gpu->glCaps().msFBOType() &&
2351 (src->desc().fSampleCnt > 0 || src->config() != dst->config())) {
2352 return false;
2353 }
2316 if (NULL != wouldNeedTempFBO) { 2354 if (NULL != wouldNeedTempFBO) {
2317 *wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->as RenderTarget(); 2355 *wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->as RenderTarget();
2318 } 2356 }
2319 return true; 2357 return true;
2320 } else { 2358 } else {
2321 return false; 2359 return false;
2322 } 2360 }
2323 } 2361 }
2324 2362
2325 inline bool can_copy_texsubimage(const GrSurface* dst, 2363 inline bool can_copy_texsubimage(const GrSurface* dst,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 this->setVertexArrayID(gpu, 0); 2616 this->setVertexArrayID(gpu, 0);
2579 } 2617 }
2580 int attrCount = gpu->glCaps().maxVertexAttributes(); 2618 int attrCount = gpu->glCaps().maxVertexAttributes();
2581 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2619 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2582 fDefaultVertexArrayAttribState.resize(attrCount); 2620 fDefaultVertexArrayAttribState.resize(attrCount);
2583 } 2621 }
2584 attribState = &fDefaultVertexArrayAttribState; 2622 attribState = &fDefaultVertexArrayAttribState;
2585 } 2623 }
2586 return attribState; 2624 return attribState;
2587 } 2625 }
OLDNEW
« 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