| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 if (restoreGLRowLength) { | 761 if (restoreGLRowLength) { |
| 762 SkASSERT(this->glCaps().unpackRowLengthSupport()); | 762 SkASSERT(this->glCaps().unpackRowLengthSupport()); |
| 763 GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); | 763 GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); |
| 764 } | 764 } |
| 765 if (glFlipY) { | 765 if (glFlipY) { |
| 766 GL_CALL(PixelStorei(GR_GL_UNPACK_FLIP_Y, GR_GL_FALSE)); | 766 GL_CALL(PixelStorei(GR_GL_UNPACK_FLIP_Y, GR_GL_FALSE)); |
| 767 } | 767 } |
| 768 return succeeded; | 768 return succeeded; |
| 769 } | 769 } |
| 770 | 770 |
| 771 namespace { | 771 static bool renderbuffer_storage_msaa(GrGLContext& ctx, |
| 772 bool renderbuffer_storage_msaa(GrGLContext& ctx, | 772 int sampleCount, |
| 773 int sampleCount, | 773 GrGLenum format, |
| 774 GrGLenum format, | 774 int width, int height) { |
| 775 int width, int height) { | |
| 776 CLEAR_ERROR_BEFORE_ALLOC(ctx.interface()); | 775 CLEAR_ERROR_BEFORE_ALLOC(ctx.interface()); |
| 777 SkASSERT(GrGLCaps::kNone_MSFBOType != ctx.info().caps()->msFBOType()); | 776 SkASSERT(GrGLCaps::kNone_MSFBOType != ctx.info().caps()->msFBOType()); |
| 778 bool created = false; | |
| 779 if (GrGLCaps::kNVDesktop_CoverageAAType == | |
| 780 ctx.info().caps()->coverageAAType()) { | |
| 781 const GrGLCaps::MSAACoverageMode& mode = | |
| 782 ctx.info().caps()->getMSAACoverageMode(sampleCount); | |
| 783 GL_ALLOC_CALL(ctx.interface(), | |
| 784 RenderbufferStorageMultisampleCoverage(GR_GL_RENDERBUFFER, | |
| 785 mode.fCoverageSampleCnt, | |
| 786 mode.fColorSampleCnt, | |
| 787 format, | |
| 788 width, height)); | |
| 789 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); | |
| 790 } | |
| 791 if (!created) { | |
| 792 #if GR_GL_IGNORE_ES3_MSAA | 777 #if GR_GL_IGNORE_ES3_MSAA |
| 793 GL_ALLOC_CALL(ctx.interface(), | 778 GL_ALLOC_CALL(ctx.interface(), |
| 794 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, | 779 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, |
| 795 sampleCount, | 780 sampleCount, |
| 796 format, | 781 format, |
| 797 width, height)); | 782 width, height)); |
| 798 #else | 783 #else |
| 799 switch (ctx.info().caps()->msFBOType()) { | 784 switch (ctx.info().caps()->msFBOType()) { |
| 800 case GrGLCaps::kDesktop_ARB_MSFBOType: | 785 case GrGLCaps::kDesktop_ARB_MSFBOType: |
| 801 case GrGLCaps::kDesktop_EXT_MSFBOType: | 786 case GrGLCaps::kDesktop_EXT_MSFBOType: |
| 802 case GrGLCaps::kES_3_0_MSFBOType: | 787 case GrGLCaps::kES_3_0_MSFBOType: |
| 803 GL_ALLOC_CALL(ctx.interface(), | 788 GL_ALLOC_CALL(ctx.interface(), |
| 804 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, | 789 RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, |
| 805 sampleCount, | 790 sampleCount, |
| 806 format, | 791 format, |
| 807 width, height)); | 792 width, height)); |
| 808 break; | 793 break; |
| 809 case GrGLCaps::kES_Apple_MSFBOType: | 794 case GrGLCaps::kES_Apple_MSFBOType: |
| 810 GL_ALLOC_CALL(ctx.interface(), | 795 GL_ALLOC_CALL(ctx.interface(), |
| 811 RenderbufferStorageMultisampleES2APPLE(GR_GL_RENDE
RBUFFER, | 796 RenderbufferStorageMultisampleES2APPLE(GR_GL_RENDERB
UFFER, |
| 812 sampleCount
, | 797 sampleCount, |
| 813 format, | 798 format, |
| 814 width, heig
ht)); | 799 width, heigh
t)); |
| 815 break; | 800 break; |
| 816 case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: | 801 case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: |
| 817 case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: | 802 case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: |
| 818 GL_ALLOC_CALL(ctx.interface(), | 803 GL_ALLOC_CALL(ctx.interface(), |
| 819 RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERB
UFFER, | 804 RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERBUF
FER, |
| 820 sampleCount, | 805 sampleCount, |
| 821 format, | 806 format, |
| 822 width, height
)); | 807 width, height)); |
| 823 break; | 808 break; |
| 824 case GrGLCaps::kNone_MSFBOType: | 809 case GrGLCaps::kNone_MSFBOType: |
| 825 GrCrash("Shouldn't be here if we don't support multisampled rend
erbuffers."); | 810 GrCrash("Shouldn't be here if we don't support multisampled renderbu
ffers."); |
| 826 break; | 811 break; |
| 827 } | 812 } |
| 828 #endif | 813 #endif |
| 829 created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); | 814 return (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));; |
| 830 } | |
| 831 return created; | |
| 832 } | |
| 833 } | 815 } |
| 834 | 816 |
| 835 bool GrGpuGL::createRenderTargetObjects(int width, int height, | 817 bool GrGpuGL::createRenderTargetObjects(int width, int height, |
| 836 GrGLuint texID, | 818 GrGLuint texID, |
| 837 GrGLRenderTarget::Desc* desc) { | 819 GrGLRenderTarget::Desc* desc) { |
| 838 desc->fMSColorRenderbufferID = 0; | 820 desc->fMSColorRenderbufferID = 0; |
| 839 desc->fRTFBOID = 0; | 821 desc->fRTFBOID = 0; |
| 840 desc->fTexFBOID = 0; | 822 desc->fTexFBOID = 0; |
| 841 desc->fIsWrapped = false; | 823 desc->fIsWrapped = false; |
| 842 | 824 |
| (...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2616 this->setVertexArrayID(gpu, 0); | 2598 this->setVertexArrayID(gpu, 0); |
| 2617 } | 2599 } |
| 2618 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2600 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2619 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2601 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2620 fDefaultVertexArrayAttribState.resize(attrCount); | 2602 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2621 } | 2603 } |
| 2622 attribState = &fDefaultVertexArrayAttribState; | 2604 attribState = &fDefaultVertexArrayAttribState; |
| 2623 } | 2605 } |
| 2624 return attribState; | 2606 return attribState; |
| 2625 } | 2607 } |
| OLD | NEW |