aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLGpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index e117488647..ae31495b06 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -545,7 +545,7 @@ sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
surfDesc.fWidth = backendTex.width();
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
- surfDesc.fSampleCnt = 1;
+ surfDesc.fSampleCnt = 0;
GrMipMapsStatus mipMapsStatus = backendTex.hasMipMaps() ? GrMipMapsStatus::kValid
: GrMipMapsStatus::kNotAllocated;
@@ -582,9 +582,6 @@ sk_sp<GrTexture> GrGLGpu::onWrapRenderableBackendTexture(const GrBackendTexture&
surfDesc.fHeight = backendTex.height();
surfDesc.fConfig = backendTex.config();
surfDesc.fSampleCnt = this->caps()->getSampleCount(sampleCnt, backendTex.config());
- if (surfDesc.fSampleCnt < 1) {
- return nullptr;
- }
GrGLRenderTarget::IDDesc rtIDDesc;
if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) {
@@ -689,7 +686,7 @@ bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOri
}
// If the dst is MSAA, we have to draw, or we'll just be writing to the resolve target.
- if (dstSurface->asRenderTarget() && dstSurface->asRenderTarget()->numColorSamples() > 1) {
+ if (dstSurface->asRenderTarget() && dstSurface->asRenderTarget()->numColorSamples() > 0) {
ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
}
@@ -707,7 +704,7 @@ bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOri
tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig;
tempDrawInfo->fTempSurfaceDesc.fWidth = width;
tempDrawInfo->fTempSurfaceDesc.fHeight = height;
- tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 1;
+ tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0;
tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU y-flip for TL.
bool configsAreRBSwaps = GrPixelConfigSwapRAndB(srcConfig) == dstSurface->config();
@@ -1280,13 +1277,13 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
idDesc->fTexFBOID = 0;
SkASSERT((GrGLCaps::kMixedSamples_MSFBOType == this->glCaps().msFBOType()) ==
this->caps()->usesMixedSamples());
- idDesc->fIsMixedSampled = desc.fSampleCnt > 1 && this->caps()->usesMixedSamples();
+ idDesc->fIsMixedSampled = desc.fSampleCnt > 0 && this->caps()->usesMixedSamples();
GrGLenum status;
GrGLenum colorRenderbufferFormat = 0; // suppress warning
- if (desc.fSampleCnt > 1 && GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType()) {
+ if (desc.fSampleCnt > 0 && GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType()) {
goto FAILED;
}
@@ -1299,7 +1296,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
// the texture bound to the other. The exception is the IMG multisample extension. With this
// extension the texture is multisampled when rendered to and then auto-resolves it when it is
// rendered from.
- if (desc.fSampleCnt > 1 && this->glCaps().usesMSAARenderBuffers()) {
+ if (desc.fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) {
GL_CALL(GenFramebuffers(1, &idDesc->fRTFBOID));
GL_CALL(GenRenderbuffers(1, &idDesc->fMSColorRenderbufferID));
if (!idDesc->fRTFBOID ||
@@ -1316,7 +1313,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
// below here we may bind the FBO
fHWBoundRenderTargetUniqueID.makeInvalid();
if (idDesc->fRTFBOID != idDesc->fTexFBOID) {
- SkASSERT(desc.fSampleCnt > 1);
+ SkASSERT(desc.fSampleCnt > 0);
GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, idDesc->fMSColorRenderbufferID));
if (!renderbuffer_storage_msaa(*fGLContext,
desc.fSampleCnt,
@@ -1341,7 +1338,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
fStats.incRenderTargetBinds();
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, idDesc->fTexFBOID));
- if (this->glCaps().usesImplicitMSAAResolve() && desc.fSampleCnt > 1) {
+ if (this->glCaps().usesImplicitMSAAResolve() && desc.fSampleCnt > 0) {
GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
texInfo.fTarget,
@@ -1418,7 +1415,7 @@ sk_sp<GrTexture> GrGLGpu::onCreateTexture(const GrSurfaceDesc& desc,
const GrMipLevel texels[],
int mipLevelCount) {
// We fail if the MSAA was requested and is not available.
- if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType() && desc.fSampleCnt > 1) {
+ if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType() && desc.fSampleCnt) {
//SkDebugf("MSAA RT requested but not supported on this platform.");
return return_null_texture();
}
@@ -1697,7 +1694,7 @@ GrStencilAttachment* GrGLGpu::createStencilAttachmentForRenderTarget(const GrRen
CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
// we do this "if" so that we don't call the multisample
// version on a GL that doesn't have an MSAA extension.
- if (samples > 1) {
+ if (samples > 0) {
SkAssertResult(renderbuffer_storage_msaa(*fGLContext,
samples,
sFmt.fInternalFormat,
@@ -2197,7 +2194,7 @@ bool GrGLGpu::onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrig
tempDrawInfo->fTempSurfaceDesc.fFlags = kRenderTarget_GrSurfaceFlag;
tempDrawInfo->fTempSurfaceDesc.fWidth = width;
tempDrawInfo->fTempSurfaceDesc.fHeight = height;
- tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 1;
+ tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0;
tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU y-flip for TL.
tempDrawInfo->fTempSurfaceFit = this->glCaps().partialFBOReadIsSlow() ? SkBackingFit::kExact
: SkBackingFit::kApprox;
@@ -3337,8 +3334,8 @@ static inline bool can_blit_framebuffer_for_copy_surface(
}
}
if (GrGLCaps::kResolveMustBeFull_BlitFrambufferFlag & blitFramebufferFlags) {
- if (srcRT && srcRT->numColorSamples() > 1) {
- if (dstRT && 1 == dstRT->numColorSamples()) {
+ if (srcRT && srcRT->numColorSamples()) {
+ if (dstRT && !dstRT->numColorSamples()) {
return false;
}
if (SkRect::Make(srcRect) != srcRT->getBoundsRect()) {
@@ -3347,7 +3344,7 @@ static inline bool can_blit_framebuffer_for_copy_surface(
}
}
if (GrGLCaps::kNoMSAADst_BlitFramebufferFlag & blitFramebufferFlags) {
- if (dstRT && dstRT->numColorSamples() > 1) {
+ if (dstRT && dstRT->numColorSamples() > 0) {
return false;
}
}
@@ -3357,12 +3354,12 @@ static inline bool can_blit_framebuffer_for_copy_surface(
}
} else if (GrGLCaps::kNoFormatConversionForMSAASrc_BlitFramebufferFlag & blitFramebufferFlags) {
const GrRenderTarget* srcRT = src->asRenderTarget();
- if (srcRT && srcRT->numColorSamples() > 1 && dst->config() != src->config()) {
+ if (srcRT && srcRT->numColorSamples() && dst->config() != src->config()) {
return false;
}
}
if (GrGLCaps::kRectsMustMatchForMSAASrc_BlitFramebufferFlag & blitFramebufferFlags) {
- if (srcRT && srcRT->numColorSamples() > 1) {
+ if (srcRT && srcRT->numColorSamples()) {
if (dstPoint.fX != srcRect.fLeft || dstPoint.fY != srcRect.fTop) {
return false;
}
@@ -3379,7 +3376,7 @@ static bool rt_has_msaa_render_buffer(const GrGLRenderTarget* rt, const GrGLCaps
// 1) It's multisampled
// 2) We're using an extension with separate MSAA renderbuffers
// 3) It's not FBO 0, which is special and always auto-resolves
- return rt->numColorSamples() > 1 && glCaps.usesMSAARenderBuffers() && rt->renderFBOID() != 0;
+ return rt->numColorSamples() > 0 && glCaps.usesMSAARenderBuffers() && rt->renderFBOID() != 0;
}
static inline bool can_copy_texsubimage(const GrSurface* dst, GrSurfaceOrigin dstOrigin,