Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 08e83ec197c59b03362d7a08a17d7005cdad2c1e..2e38b64d71e903833fc289ce3e1c68372145ed6a 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -373,6 +373,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { |
if (resetBits & kMSAAEnable_GrGLBackendState) { |
fMSAAEnabled = kUnknown_TriState; |
+ fCoverageModulationEnabled = kUnknown_TriState; |
Chris Dalton
2015/06/09 17:39:51
At this point we can just call:
glCoverageModula
|
} |
fHWActiveTextureUnitIdx = -1; // invalid |
@@ -504,6 +505,9 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe |
idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); |
idDesc.fMSColorRenderbufferID = 0; |
idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; |
+ idDesc.fSampleConfig = (wrapDesc.fFlags & kStencilMSAAOnly_GrBackendRenderTargetFlags) ? |
Chris Dalton
2015/06/09 17:39:51
Here we ought to ignore the multisample stencil bu
|
+ GrRenderTarget::kStencil_SampleConfig : |
+ GrRenderTarget::kUnified_SampleConfig; |
idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle; |
GrSurfaceDesc desc; |
@@ -851,6 +855,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 +893,9 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc, |
idDesc->fRTFBOID = 0; |
idDesc->fTexFBOID = 0; |
idDesc->fLifeCycle = lifeCycle; |
+ idDesc->fSampleConfig = GrGLCaps::kMixedSamples_MSFBOType == |
+ this->glCaps().msFBOType() ? GrRenderTarget::kStencil_SampleConfig : |
+ GrRenderTarget::kUnified_SampleConfig; |
GrGLenum status; |
@@ -1170,7 +1178,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(); |
@@ -2090,9 +2098,10 @@ 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 (this->glCaps().multisampleDisableSupport() || |
+ this->glCaps().shaderCaps()->mixedSamplesSupport()) { |
Chris Dalton
2015/06/09 17:39:52
I would recommend rolling this into the multisampl
|
if (useHWAA) { |
if (kYes_TriState != fMSAAEnabled) { |
GL_CALL(Enable(GR_GL_MULTISAMPLE)); |
@@ -2105,6 +2114,19 @@ void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) { |
} |
} |
} |
+ if (this->glCaps().shaderCaps()->mixedSamplesSupport()) { |
+ if (useHWAA && GrRenderTarget::kStencil_SampleConfig == rt->sampleConfig()) { |
+ if (kYes_TriState != fCoverageModulationEnabled) { |
+ GL_CALL(CoverageModulation(GR_GL_RGBA)); |
+ fCoverageModulationEnabled = kYes_TriState; |
+ } |
+ } else { |
+ if (kNo_TriState != fCoverageModulationEnabled) { |
+ GL_CALL(CoverageModulation(GR_GL_NONE)); |
+ fCoverageModulationEnabled = kNo_TriState; |
+ } |
+ } |
+ } |
} |
void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo) { |