diff options
author | 2013-09-06 20:00:41 +0000 | |
---|---|---|
committer | 2013-09-06 20:00:41 +0000 | |
commit | 040fd8f5670c8a4f73e0fe13f949681a23e6add8 (patch) | |
tree | 2d29451745ea7f86653f058bfc3afb897e5a31fe /src/gpu | |
parent | 96a7a9623f7b00bacf502adb99d485f2b376d328 (diff) |
Rip out CSAA support
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/23882009
git-svn-id: http://skia.googlecode.com/svn/trunk@11138 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 60 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 45 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 86 | ||||
-rw-r--r-- | src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp | 3 | ||||
-rw-r--r-- | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp | 3 |
5 files changed, 34 insertions, 163 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 8ca88c14aa..aac97361f8 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -24,7 +24,6 @@ void GrGLCaps::reset() { fStencilFormats.reset(); fStencilVerifiedColorConfigs.reset(); fMSFBOType = kNone_MSFBOType; - fCoverageAAType = kNone_CoverageAAType; fFBFetchType = kNone_FBFetchType; fMaxFragmentUniformVectors = 0; fMaxVertexAttributes = 0; @@ -65,8 +64,6 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords; fMSFBOType = caps.fMSFBOType; - fCoverageAAType = caps.fCoverageAAType; - fMSAACoverageModes = caps.fMSAACoverageModes; fFBFetchType = caps.fFBFetchType; fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; fBGRAFormatSupport = caps.fBGRAFormatSupport; @@ -368,20 +365,6 @@ bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type; } -namespace { -bool cov_mode_less(const GrGLCaps::MSAACoverageMode& left, - const GrGLCaps::MSAACoverageMode& right) { - if (left.fCoverageSampleCnt < right.fCoverageSampleCnt) { - return true; - } else if (right.fCoverageSampleCnt < left.fCoverageSampleCnt) { - return false; - } else if (left.fColorSampleCnt < right.fColorSampleCnt) { - return true; - } - return false; -} -} - void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { fMSFBOType = kNone_MSFBOType; @@ -409,49 +392,6 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; } - // TODO: We could populate fMSAACoverageModes using GetInternalformativ - // on GL 4.2+. It's format-specific, though. See also - // http://code.google.com/p/skia/issues/detail?id=470 about using actual - // rather than requested sample counts in cache key. - if (ctxInfo.hasExtension("GL_NV_framebuffer_multisample_coverage")) { - fCoverageAAType = kNVDesktop_CoverageAAType; - GrGLint count; - GR_GL_GetIntegerv(gli, - GR_GL_MAX_MULTISAMPLE_COVERAGE_MODES, - &count); - fMSAACoverageModes.setCount(count); - GR_GL_GetIntegerv(gli, - GR_GL_MULTISAMPLE_COVERAGE_MODES, - (int*)&fMSAACoverageModes[0]); - // The NV driver seems to return the modes already sorted but the - // spec doesn't require this. So we sort. - typedef SkTLessFunctionToFunctorAdaptor<MSAACoverageMode, cov_mode_less> SortFunctor; - SortFunctor sortFunctor; - SkTQSort<MSAACoverageMode, SortFunctor>(fMSAACoverageModes.begin(), - fMSAACoverageModes.end() - 1, - sortFunctor); - } - } -} - -const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(int desiredSampleCount) const { - static const MSAACoverageMode kNoneMode = {0, 0}; - if (0 == fMSAACoverageModes.count()) { - return kNoneMode; - } else { - SkASSERT(kNone_CoverageAAType != fCoverageAAType); - int max = (fMSAACoverageModes.end() - 1)->fCoverageSampleCnt; - desiredSampleCount = GrMin(desiredSampleCount, max); - MSAACoverageMode desiredMode = {desiredSampleCount, 0}; - int idx = SkTSearch<const MSAACoverageMode, cov_mode_less>(&fMSAACoverageModes[0], - fMSAACoverageModes.count(), - desiredMode, - sizeof(MSAACoverageMode)); - if (idx < 0) { - idx = ~idx; - } - SkASSERT(idx >= 0 && idx < fMSAACoverageModes.count()); - return fMSAACoverageModes[idx]; } } diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 857ebbc101..1eaae2287b 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -28,23 +28,6 @@ public: typedef GrGLStencilBuffer::Format StencilFormat; /** - * Represents a supported multisampling/coverage-sampling mode. - */ - struct MSAACoverageMode { - // "Coverage samples" includes samples that actually have color, depth, - // stencil, ... as well as those that don't (coverage only). All samples - // are coverage samples. (We're using the word "coverage sample" to - // match the NV extension language.) - int fCoverageSampleCnt; - - // Color samples are samples that store data values (color, stencil, - // depth) rather than just representing coverage. They are a subset - // of coverage samples. (Again the wording was chosen to match the - // extension.) - int fColorSampleCnt; - }; - - /** * The type of MSAA for FBOs supported. Different extensions have different * semantics of how / when a resolve is performed. */ @@ -95,18 +78,6 @@ public: kLast_FBFetchType = kNV_FBFetchType, }; - enum CoverageAAType { - /** - * No coverage sample support - */ - kNone_CoverageAAType, - - /** - * GL_NV_framebuffer_multisample_coverage - */ - kNVDesktop_CoverageAAType, - }; - /** * Creates a GrGLCaps that advertises no support for any extensions, * formats, etc. Call init to initialize from a GrGLContextInfo. @@ -186,20 +157,6 @@ public: kES_EXT_MsToTexture_MSFBOType == fMSFBOType; } - /** - * Reports the type of coverage sample AA support. - */ - CoverageAAType coverageAAType() const { return fCoverageAAType; } - - /** - * Chooses a supported coverage mode based on a desired sample count. The - * desired sample count is rounded up the next supported coverage sample - * count unless a it is larger than the max in which case it is rounded - * down. Once a coverage sample count is decided, the supported mode with - * the fewest color samples is chosen. - */ - const MSAACoverageMode& getMSAACoverageMode(int desiredSampleCount) const; - FBFetchType fbFetchType() const { return fFBFetchType; } /** @@ -348,8 +305,6 @@ private: int fMaxFixedFunctionTextureCoords; MSFBOType fMSFBOType; - CoverageAAType fCoverageAAType; - SkTDArray<MSAACoverageMode> fMSAACoverageModes; FBFetchType fFBFetchType; diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 75b4191366..bc067e0062 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -768,27 +768,12 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc, return succeeded; } -namespace { -bool renderbuffer_storage_msaa(GrGLContext& ctx, - int sampleCount, - GrGLenum format, - int width, int height) { +static bool renderbuffer_storage_msaa(GrGLContext& ctx, + int sampleCount, + GrGLenum format, + int width, int height) { CLEAR_ERROR_BEFORE_ALLOC(ctx.interface()); SkASSERT(GrGLCaps::kNone_MSFBOType != ctx.info().caps()->msFBOType()); - bool created = false; - if (GrGLCaps::kNVDesktop_CoverageAAType == - ctx.info().caps()->coverageAAType()) { - const GrGLCaps::MSAACoverageMode& mode = - ctx.info().caps()->getMSAACoverageMode(sampleCount); - GL_ALLOC_CALL(ctx.interface(), - RenderbufferStorageMultisampleCoverage(GR_GL_RENDERBUFFER, - mode.fCoverageSampleCnt, - mode.fColorSampleCnt, - format, - width, height)); - created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); - } - if (!created) { #if GR_GL_IGNORE_ES3_MSAA GL_ALLOC_CALL(ctx.interface(), RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, @@ -796,40 +781,37 @@ bool renderbuffer_storage_msaa(GrGLContext& ctx, format, width, height)); #else - switch (ctx.info().caps()->msFBOType()) { - case GrGLCaps::kDesktop_ARB_MSFBOType: - case GrGLCaps::kDesktop_EXT_MSFBOType: - case GrGLCaps::kES_3_0_MSFBOType: - GL_ALLOC_CALL(ctx.interface(), - RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, - sampleCount, - format, - width, height)); - break; - case GrGLCaps::kES_Apple_MSFBOType: - GL_ALLOC_CALL(ctx.interface(), - RenderbufferStorageMultisampleES2APPLE(GR_GL_RENDERBUFFER, - sampleCount, - format, - width, height)); - break; - case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: - case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: - GL_ALLOC_CALL(ctx.interface(), - RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERBUFFER, - sampleCount, - format, - width, height)); - break; - case GrGLCaps::kNone_MSFBOType: - GrCrash("Shouldn't be here if we don't support multisampled renderbuffers."); - break; - } -#endif - created = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface())); + switch (ctx.info().caps()->msFBOType()) { + case GrGLCaps::kDesktop_ARB_MSFBOType: + case GrGLCaps::kDesktop_EXT_MSFBOType: + case GrGLCaps::kES_3_0_MSFBOType: + GL_ALLOC_CALL(ctx.interface(), + RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, + sampleCount, + format, + width, height)); + break; + case GrGLCaps::kES_Apple_MSFBOType: + GL_ALLOC_CALL(ctx.interface(), + RenderbufferStorageMultisampleES2APPLE(GR_GL_RENDERBUFFER, + sampleCount, + format, + width, height)); + break; + case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: + case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: + GL_ALLOC_CALL(ctx.interface(), + RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERBUFFER, + sampleCount, + format, + width, height)); + break; + case GrGLCaps::kNone_MSFBOType: + GrCrash("Shouldn't be here if we don't support multisampled renderbuffers."); + break; } - return created; -} +#endif + return (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));; } bool GrGpuGL::createRenderTargetObjects(int width, int height, diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp index 1b44900b1a..a71922e012 100644 --- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp +++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp @@ -123,9 +123,6 @@ const GrGLInterface* GrGLCreateNativeInterface() { interface->fPixelStorei = glPixelStorei; interface->fReadBuffer = glReadBuffer; interface->fReadPixels = glReadPixels; - if (extensions.has("GL_NV_framebuffer_multisample_coverage")) { - GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisampleCoverage, NV); - } interface->fScissor = glScissor; GR_GL_GET_PROC(ShaderSource); interface->fStencilFunc = glStencilFunc; diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp index e6f1d1f81b..e9207b162a 100644 --- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp +++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp @@ -180,9 +180,6 @@ const GrGLInterface* GrGLCreateNativeInterface() { WGL_SET_PROC(GetStringi) WGL_SET_PROC(GetUniformLocation); WGL_SET_PROC(LinkProgram); - if (extensions.has("GL_NV_framebuffer_multisample_coverage")) { - WGL_SET_PROC_SUFFIX(RenderbufferStorageMultisampleCoverage, NV); - } WGL_SET_PROC(ShaderSource); WGL_SET_PROC(StencilFuncSeparate); WGL_SET_PROC(StencilMaskSeparate); |