Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1001503002: Implement support for mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@mix1
Patch Set: Multisampling and other fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 7090ca93d415ed5de8816b3dbf32268f0ed408ba..f41794ff22c62adc9df9ba594e398d3727733d8c 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -311,6 +311,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
if (resetBits & kMSAAEnable_GrGLBackendState) {
fMSAAEnabled = kUnknown_TriState;
+ fCoverageModulationEnabled = kUnknown_TriState;
}
fHWActiveTextureUnitIdx = -1; // invalid
@@ -447,6 +448,7 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
GrGLuint fboID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle);
idDesc.fRenderFBO.reset(SkNEW_ARGS(GrGLFBO, (fboID)));
idDesc.fMSColorRenderbufferID = 0;
+ idDesc.fSampleConfig = wrapDesc.fSampleConfig;
idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle;
GrSurfaceDesc desc;
@@ -794,6 +796,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,
@@ -828,6 +831,9 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc, bool budgeted
idDesc->fMSColorRenderbufferID = 0;
idDesc->fLifeCycle = budgeted ? GrGpuResource::kCached_LifeCycle :
GrGpuResource::kUncached_LifeCycle;
+ idDesc->fSampleConfig = GrGLCaps::kStencil_MSFBOType ==
+ this->glCaps().msFBOType() ? kStencil_GrSampleConfig :
+ kUnified_GrSampleConfig;
GrGLenum status;
@@ -1147,7 +1153,7 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width,
SkASSERT(width >= rt->width());
SkASSERT(height >= rt->height());
- int samples = rt->numSamples();
+ int samples = rt->numSamples(kStencil_GrSampleConfig);
GrGLStencilBuffer::IDDesc sbDesc;
int stencilFmtCnt = this->glCaps().stencilFormats().count();
@@ -2095,9 +2101,10 @@ void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) {
}
void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) {
- SkASSERT(!useHWAA || rt->isMultisampled());
+ SkASSERT(!useHWAA || rt->isMultisampled(kStencil_GrSampleConfig));
- 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));
@@ -2110,6 +2117,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));
Chris Dalton 2015/03/17 00:39:35 I verified with Brian that Skia always writes prem
+ fCoverageModulationEnabled = kYes_TriState;
+ }
+ } else {
+ if (kNo_TriState != fCoverageModulationEnabled) {
+ GL_CALL(CoverageModulation(GR_GL_NONE));
+ fCoverageModulationEnabled = kNo_TriState;
+ }
+ }
+ }
}
void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo) {

Powered by Google App Engine
This is Rietveld 408576698