diff options
author | vbuzinov <vbuzinov@nvidia.com> | 2015-06-12 08:59:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-12 08:59:45 -0700 |
commit | dded69693dd3779f081326cde24c3954505b129d (patch) | |
tree | 0cfc3a16d31093185082268ab16599edb7c0464f /src/gpu/gl/GrGLCaps.cpp | |
parent | 57856a1f589bea64ed84535efed0668221060f9b (diff) |
Implement support for mixed sampled render targets
Adds a new FBO type kStencil_MSFBOType that is selected whenever
NV_framebuffer_mixed_samples extension is available. In this new
FBO type a non-msaa color buffer is created with a multisampled
stencil buffer attachment.
Replaces numSamples() with separate numColorSamples and numStencilSamples
methods in RenderTarget.
In mixed samples mode non-MSAA codepaths are used to draw simple shapes,
while NVPR-rendered paths and text are rendered with a multisampled
stencil.
BUG=skia:3177
Review URL: https://codereview.chromium.org/1001503002
Diffstat (limited to 'src/gpu/gl/GrGLCaps.cpp')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 40405fd55c..e8c3b55163 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -292,6 +292,11 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") && ctxInfo.hasExtension("GL_EXT_raster_multisample"); } + // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples. + if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSupport()) { + fDiscardRenderTargetSupport = false; + fInvalidateFBType = kNone_InvalidateFBType; + } /************************************************************************** * GrCaps fields @@ -789,6 +794,8 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa fMSFBOType = kES_EXT_MsToTexture_MSFBOType; } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")) { fMSFBOType = kES_IMG_MsToTexture_MSFBOType; + } else if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRenderingSupport()) { + fMSFBOType = kMixedSamples_MSFBOType; } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { @@ -799,7 +806,9 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa fMSFBOType = kES_Apple_MSFBOType; } } else { - if ((ctxInfo.version() >= GR_GL_VER(3,0)) || + if (fShaderCaps->mixedSamplesSupport() && fShaderCaps->pathRenderingSupport()) { + fMSFBOType = kMixedSamples_MSFBOType; + } else if ((ctxInfo.version() >= GR_GL_VER(3,0)) || ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && @@ -932,6 +941,7 @@ SkString GrGLCaps::dump() const { "Apple", "IMG MS To Texture", "EXT MS To Texture", + "MixedSamples", }; GR_STATIC_ASSERT(0 == kNone_MSFBOType); GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); @@ -940,6 +950,7 @@ SkString GrGLCaps::dump() const { GR_STATIC_ASSERT(4 == kES_Apple_MSFBOType); GR_STATIC_ASSERT(5 == kES_IMG_MsToTexture_MSFBOType); GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType); + GR_STATIC_ASSERT(7 == kMixedSamples_MSFBOType); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); static const char* kInvalidateFBTypeStr[] = { |