OLD | NEW |
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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 ctx.info().caps()->getMSAACoverageMode(sampleCount); | 765 ctx.info().caps()->getMSAACoverageMode(sampleCount); |
766 GL_ALLOC_CALL(ctx.interface(), | 766 GL_ALLOC_CALL(ctx.interface(), |
767 RenderbufferStorageMultisampleCoverage(GR_GL_RENDERBUFFER, | 767 RenderbufferStorageMultisampleCoverage(GR_GL_RENDERBUFFER, |
768 mode.fCoverageSampleCnt, | 768 mode.fCoverageSampleCnt, |
769 mode.fColorSampleCnt, | 769 mode.fColorSampleCnt, |
770 format, | 770 format, |
771 width, height)); | 771 width, height)); |
772 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); | 772 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); |
773 } | 773 } |
774 if (!created) { | 774 if (!created) { |
| 775 #if GR_GL_IGNORE_ES3_MSAA |
775 GL_ALLOC_CALL(ctx.interface(), | 776 GL_ALLOC_CALL(ctx.interface(), |
776 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, | 777 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, |
777 sampleCount, | 778 sampleCount, |
778 format, | 779 format, |
779 width, height)); | 780 width, height)); |
| 781 #else |
| 782 switch (ctx.info().caps()->msFBOType()) { |
| 783 case GrGLCaps::kDesktop_ARB_MSFBOType: |
| 784 case GrGLCaps::kDesktop_EXT_MSFBOType: |
| 785 case GrGLCaps::kES_3_0_MSFBOType: |
| 786 GL_ALLOC_CALL(ctx.interface(), |
| 787 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, |
| 788 sampleCount, |
| 789 format, |
| 790 width, height)); |
| 791 break; |
| 792 case GrGLCaps::kES_Apple_MSFBOType: |
| 793 GL_ALLOC_CALL(ctx.interface(), |
| 794 RenderbufferStorageMultisampleES2APPLE(GR_GL_RENDE
RBUFFER, |
| 795 sampleCount
, |
| 796 format, |
| 797 width, heig
ht)); |
| 798 break; |
| 799 case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: |
| 800 case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: |
| 801 GL_ALLOC_CALL(ctx.interface(), |
| 802 RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERB
UFFER, |
| 803 sampleCount, |
| 804 format, |
| 805 width, height
)); |
| 806 break; |
| 807 case GrGLCaps::kNone_MSFBOType: |
| 808 GrCrash("Shouldn't be here if we don't support multisampled rend
erbuffers."); |
| 809 break; |
| 810 } |
| 811 #endif |
780 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); | 812 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); |
781 } | 813 } |
782 return created; | 814 return created; |
783 } | 815 } |
784 } | 816 } |
785 | 817 |
786 bool GrGpuGL::createRenderTargetObjects(int width, int height, | 818 bool GrGpuGL::createRenderTargetObjects(int width, int height, |
787 GrGLuint texID, | 819 GrGLuint texID, |
788 GrGLRenderTarget::Desc* desc) { | 820 GrGLRenderTarget::Desc* desc) { |
789 desc->fMSColorRenderbufferID = 0; | 821 desc->fMSColorRenderbufferID = 0; |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 | 2319 |
2288 namespace { | 2320 namespace { |
2289 // Determines whether glBlitFramebuffer could be used between src and dst. | 2321 // Determines whether glBlitFramebuffer could be used between src and dst. |
2290 inline bool can_blit_framebuffer(const GrSurface* dst, | 2322 inline bool can_blit_framebuffer(const GrSurface* dst, |
2291 const GrSurface* src, | 2323 const GrSurface* src, |
2292 const GrGpuGL* gpu, | 2324 const GrGpuGL* gpu, |
2293 bool* wouldNeedTempFBO = NULL) { | 2325 bool* wouldNeedTempFBO = NULL) { |
2294 if (gpu->isConfigRenderable(dst->config()) && | 2326 if (gpu->isConfigRenderable(dst->config()) && |
2295 gpu->isConfigRenderable(src->config()) && | 2327 gpu->isConfigRenderable(src->config()) && |
2296 gpu->glCaps().usesMSAARenderBuffers()) { | 2328 gpu->glCaps().usesMSAARenderBuffers()) { |
| 2329 // ES3 doesn't allow framebuffer blits when the src has MSAA and the con
figs don't match |
| 2330 // or the rects are not the same (not just the same size but have the sa
me edges). |
| 2331 if (GrGLCaps::kES_3_0_MSFBOType == gpu->glCaps().msFBOType() && |
| 2332 (src->desc().fSampleCnt > 0 || src->config() != dst->config())) { |
| 2333 return false; |
| 2334 } |
2297 if (NULL != wouldNeedTempFBO) { | 2335 if (NULL != wouldNeedTempFBO) { |
2298 *wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->as
RenderTarget(); | 2336 *wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->as
RenderTarget(); |
2299 } | 2337 } |
2300 return true; | 2338 return true; |
2301 } else { | 2339 } else { |
2302 return false; | 2340 return false; |
2303 } | 2341 } |
2304 } | 2342 } |
2305 | 2343 |
2306 inline bool can_copy_texsubimage(const GrSurface* dst, | 2344 inline bool can_copy_texsubimage(const GrSurface* dst, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 this->setVertexArrayID(gpu, 0); | 2597 this->setVertexArrayID(gpu, 0); |
2560 } | 2598 } |
2561 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2599 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2562 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2600 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2563 fDefaultVertexArrayAttribState.resize(attrCount); | 2601 fDefaultVertexArrayAttribState.resize(attrCount); |
2564 } | 2602 } |
2565 attribState = &fDefaultVertexArrayAttribState; | 2603 attribState = &fDefaultVertexArrayAttribState; |
2566 } | 2604 } |
2567 return attribState; | 2605 return attribState; |
2568 } | 2606 } |
OLD | NEW |