Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 248a5dfbd250e91f45daa974be4f8b8d929324bc..d3fe62f91519b3e4aa99719404a19d0e0bf3d610 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -483,7 +483,11 @@ GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, |
surfDesc.fWidth = desc.fWidth; |
surfDesc.fHeight = desc.fHeight; |
surfDesc.fConfig = desc.fConfig; |
- surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()); |
+ // We require the sample count to be less than both the max color sample count and |
+ // max stencil sample count supported by the system |
+ int maxSampleCount = SkTMin(this->caps()->maxColorSampleCount(), |
+ this->caps()->maxStencilSampleCount()); |
+ surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, maxSampleCount); |
bsalomon
2016/01/15 18:08:29
Probably want to consider mixed samples here
|
// FIXME: this should be calling resolve_origin(), but Chrome code is currently |
// assuming the old behaviour, which is that backend textures are always |
// BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: |
@@ -533,7 +537,11 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe |
desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; |
desc.fWidth = wrapDesc.fWidth; |
desc.fHeight = wrapDesc.fHeight; |
- desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount()); |
+ // We require the sample count to be less than both the max color sample count and |
+ // max stencil sample count supported by the system |
+ int maxSampleCount = SkTMin(this->caps()->maxColorSampleCount(), |
+ this->caps()->maxStencilSampleCount()); |
+ desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, maxSampleCount); |
bsalomon
2016/01/15 18:08:29
and here
|
desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); |
return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencilBits); |