Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 0793d7b0475079cdbb5615b1d89bc7dbbe8d5172..9b7cac03a1d423b5331d4796c9f607cdac2ecdd9 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -301,6 +301,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { |
if (resetBits & kMSAAEnable_GrGLBackendState) { |
fMSAAEnabled = kUnknown_TriState; |
+ fCoverageModulationEnabled = kUnknown_TriState; |
} |
fHWActiveTextureUnitIdx = -1; // invalid |
@@ -435,6 +436,7 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe |
idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); |
idDesc.fMSColorRenderbufferID = 0; |
idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; |
+ idDesc.fSampleConfig = wrapDesc.fSampleConfig; |
idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle; |
GrSurfaceDesc desc; |
@@ -782,6 +784,7 @@ static bool renderbuffer_storage_msaa(GrGLContext& ctx, |
switch (ctx.caps()->msFBOType()) { |
case GrGLCaps::kDesktop_ARB_MSFBOType: |
case GrGLCaps::kDesktop_EXT_MSFBOType: |
+ case GrGLCaps::kStencil_MSFBOType: |
case GrGLCaps::kES_3_0_MSFBOType: |
GL_ALLOC_CALL(ctx.interface(), |
RenderbufferStorageMultisample(GR_GL_RENDERBUFFER, |
@@ -818,6 +821,9 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc, bool budgeted |
idDesc->fTexFBOID = 0; |
idDesc->fLifeCycle = budgeted ? GrGpuResource::kCached_LifeCycle : |
GrGpuResource::kUncached_LifeCycle; |
+ idDesc->fSampleConfig = GrGLCaps::kStencil_MSFBOType == |
+ this->glCaps().msFBOType() ? kStencil_GrSampleConfig : |
+ kUnified_GrSampleConfig; |
GrGLenum status; |
@@ -1139,7 +1145,7 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, |
SkASSERT(width >= rt->width()); |
SkASSERT(height >= rt->height()); |
- int samples = rt->numSamples(); |
+ int samples = rt->numSamples(GrRenderTarget::kStencilBuffer_PipelineStage); |
GrGLStencilBuffer::IDDesc sbDesc; |
int stencilFmtCnt = this->glCaps().stencilFormats().count(); |
@@ -2076,9 +2082,10 @@ void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) { |
} |
void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) { |
- SkASSERT(!useHWAA || rt->isMultisampled()); |
+ SkASSERT(!useHWAA || rt->isMultisampled(GrRenderTarget::kAnywhere_PipelineStage)); |
- if (kGL_GrGLStandard == this->glStandard()) { |
+ if (kGL_GrGLStandard == this->glStandard() || |
+ this->glCaps().fbMixedSamplesSupport()) { |
if (useHWAA) { |
if (kYes_TriState != fMSAAEnabled) { |
GL_CALL(Enable(GR_GL_MULTISAMPLE)); |
@@ -2091,6 +2098,19 @@ void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) { |
} |
} |
} |
+ if (this->glCaps().fbMixedSamplesSupport()) { |
+ if (useHWAA && kStencil_GrSampleConfig == rt->sampleConfig()) { |
+ if (kYes_TriState != fCoverageModulationEnabled) { |
+ GL_CALL(CoverageModulation(GR_GL_RGBA)); |
+ fCoverageModulationEnabled = kYes_TriState; |
bsalomon
2015/03/31 16:37:33
For cases where we couldn't tweak alpha for covera
Chris Dalton
2015/03/31 19:47:30
Yes that's right. useHWAA always ends up false whe
|
+ } |
+ } else { |
+ if (kNo_TriState != fCoverageModulationEnabled) { |
+ GL_CALL(CoverageModulation(GR_GL_NONE)); |
+ fCoverageModulationEnabled = kNo_TriState; |
+ } |
+ } |
+ } |
} |
void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo) { |