Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 08e83ec197c59b03362d7a08a17d7005cdad2c1e..45d15e31161fccaf8513413a5a788b2b808ee9f8 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -373,6 +373,13 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { |
if (resetBits & kMSAAEnable_GrGLBackendState) { |
fMSAAEnabled = kUnknown_TriState; |
+ |
+ // In mixed samples mode coverage modulation allows the coverage to be converted to |
+ // "opacity", which can then be blended into the color buffer to accomplish antialiasing. |
+ // Enable coverage modulation suitable for premultiplied alpha colors. |
Chris Dalton
2015/06/11 23:34:38
// This state has no effect when not rendering to
|
+ if (this->glCaps().shaderCaps()->mixedSamplesSupport()) { |
+ GL_CALL(CoverageModulation(GR_GL_RGBA)); |
+ } |
} |
fHWActiveTextureUnitIdx = -1; // invalid |
@@ -851,6 +858,7 @@ static bool renderbuffer_storage_msaa(const GrGLContext& ctx, |
switch (ctx.caps()->msFBOType()) { |
case GrGLCaps::kDesktop_ARB_MSFBOType: |
case GrGLCaps::kDesktop_EXT_MSFBOType: |
+ case GrGLCaps::kMixedSamples_MSFBOType: |
case GrGLCaps::kES_3_0_MSFBOType: |
GL_ALLOC_CALL(ctx.interface(), |
RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, |
@@ -888,6 +896,9 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc, |
idDesc->fRTFBOID = 0; |
idDesc->fTexFBOID = 0; |
idDesc->fLifeCycle = lifeCycle; |
+ idDesc->fSampleConfig = (GrGLCaps::kMixedSamples_MSFBOType == this->glCaps().msFBOType() && |
+ desc.fSampleCnt > 0) ? GrRenderTarget::kStencil_SampleConfig : |
+ GrRenderTarget::kUnified_SampleConfig; |
GrGLenum status; |
@@ -1170,7 +1181,7 @@ bool GrGLGpu::createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int wid |
SkASSERT(width >= rt->width()); |
SkASSERT(height >= rt->height()); |
- int samples = rt->numSamples(); |
+ int samples = rt->numStencilSamples(); |
GrGLStencilAttachment::IDDesc sbDesc; |
int stencilFmtCnt = this->glCaps().stencilFormats().count(); |
@@ -1607,6 +1618,11 @@ void GrGLGpu::discard(GrRenderTarget* renderTarget) { |
SkFAIL("Should never get here."); |
break; |
case GrGLCaps::kInvalidate_InvalidateFBType: |
+ if (kNVIDIA_GrGLDriver == this->glContext().driver() && |
+ this->glCaps().shaderCaps()->mixedSamplesSupport()) { |
vbuzinov
2015/06/11 12:30:57
The nature of glInvalidateFramebuffer bug seems to
bsalomon
2015/06/11 13:33:14
Can we just disable support for framebuffer invali
|
+ // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples. |
+ break; |
+ } |
if (0 == glRT->renderFBOID()) { |
// When rendering to the default framebuffer the legal values for attachments |
// are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the various FBO attachment |
@@ -2090,7 +2106,7 @@ void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) { |
} |
void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) { |
- SkASSERT(!useHWAA || rt->isMultisampled()); |
+ SkASSERT(!useHWAA || rt->isStencilBufferMultisampled()); |
if (this->glCaps().multisampleDisableSupport()) { |
if (useHWAA) { |