diff options
author | Robert Phillips <robertphillips@google.com> | 2017-05-01 13:12:20 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-03 16:59:37 +0000 |
commit | a91e0b7cc2537dc57ccf67914638e13b4612ffd1 (patch) | |
tree | 858fb3b4d98cb07461468f9b9ea1935f7950392e /src/gpu/GrProcessor.cpp | |
parent | 7eb86981a954c500fa4a4d8425496a5beb789e5d (diff) |
Allow TextureSamplers to have null GrTexture pointer
Bug: 715488
Change-Id: I69775cbb50d334d81872e236e59368fe65e698ff
Reviewed-on: https://skia-review.googlesource.com/14605
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrProcessor.cpp')
-rw-r--r-- | src/gpu/GrProcessor.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 4856c42a34..c5ccc3fbc9 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -129,6 +129,10 @@ void GrProcessor::operator delete(void* target) { /////////////////////////////////////////////////////////////////////////////// void GrResourceIOProcessor::addTextureSampler(const TextureSampler* access) { + if (access->isBad()) { + this->markAsBad(); + } + fTextureSamplers.push_back(access); } @@ -234,13 +238,17 @@ void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourcePr sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, GrShaderFlags visibility) { + fParams = params; + // For now, end the deferral at this time. Once all the TextureSamplers are swapped over // to taking a GrSurfaceProxy just use the IORefs on the proxy GrTexture* texture = proxy->instantiate(resourceProvider); - SkASSERT(texture); - fTexture.set(SkRef(texture), kRead_GrIOType); - fParams = params; - fParams.setFilterMode(SkTMin(params.filterMode(), texture->texturePriv().highestFilterMode())); + if (texture) { + fTexture.set(SkRef(texture), kRead_GrIOType); + fParams.setFilterMode(SkTMin(params.filterMode(), + texture->texturePriv().highestFilterMode())); + } + fVisibility = visibility; } @@ -252,9 +260,11 @@ void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourcePr // For now, end the deferral at this time. Once all the TextureSamplers are swapped over // to taking a GrSurfaceProxy just use the IORefs on the proxy GrTexture* texture = proxy->instantiate(resourceProvider); - SkASSERT(texture); - fTexture.set(SkRef(texture), kRead_GrIOType); - filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode()); + if (texture) { + fTexture.set(SkRef(texture), kRead_GrIOType); + filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode()); + } + fParams.reset(tileXAndY, filterMode); fVisibility = visibility; } |