diff options
author | Greg Daniel <egdaniel@google.com> | 2017-10-09 15:06:20 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-10 16:45:43 +0000 |
commit | 834f12076f703c114173486de6470412d92f6506 (patch) | |
tree | 0cdbc645742e740f3934a96f2cb8b80e6fb62c6d /src/gpu/GrTexture.cpp | |
parent | c5b94988915920ed359eecec34d4fbd6bdc0a3fd (diff) |
Set correct mip map status on GrTexture since we no longer require all mip data
Bug: skia:
Change-Id: I5074028f307187eef3201523cbd1ddc7d9bf9013
Reviewed-on: https://skia-review.googlesource.com/54102
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrTexture.cpp')
-rw-r--r-- | src/gpu/GrTexture.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp index 361fd1a5f7..c134c64c29 100644 --- a/src/gpu/GrTexture.cpp +++ b/src/gpu/GrTexture.cpp @@ -19,12 +19,12 @@ void GrTexture::dirtyMipMaps(bool mipMapsDirty) { if (mipMapsDirty) { - if (kValid_MipMapsStatus == fMipMapsStatus) { - fMipMapsStatus = kAllocated_MipMapsStatus; + if (kInvalid_MipMapsStatus == fMipMapsStatus || kClean_MipMapsStatus == fMipMapsStatus) { + fMipMapsStatus = kDirty_MipMapsStatus; } } else { const bool sizeChanged = kNotAllocated_MipMapsStatus == fMipMapsStatus; - fMipMapsStatus = kValid_MipMapsStatus; + fMipMapsStatus = kClean_MipMapsStatus; if (sizeChanged) { // This must not be called until after changing fMipMapsStatus. this->didChangeGpuMemorySize(); @@ -41,14 +41,21 @@ size_t GrTexture::onGpuMemorySize() const { ///////////////////////////////////////////////////////////////////////////// GrTexture::GrTexture(GrGpu* gpu, const GrSurfaceDesc& desc, GrSLType samplerType, - GrSamplerState::Filter highestFilterMode, bool wasMipMapDataProvided) + GrSamplerState::Filter highestFilterMode, + bool mipsAllocated, bool wasFullMipMapDataProvided) : INHERITED(gpu, desc) , fSamplerType(samplerType) , fHighestFilterMode(highestFilterMode) // Mip color mode is explicitly set after creation via GrTexturePriv , fMipColorMode(SkDestinationSurfaceColorMode::kLegacy) { - if (wasMipMapDataProvided) { - fMipMapsStatus = kValid_MipMapsStatus; + if (mipsAllocated) { + if (wasFullMipMapDataProvided) { + fMipMapsStatus = kClean_MipMapsStatus; + } else { + // Currently we should only hit this case when none of the mips were uploaded including + // the base. Thus we set this to invalid. + fMipMapsStatus = kInvalid_MipMapsStatus; + } fMaxMipMapLevel = SkMipMap::ComputeLevelCount(this->width(), this->height()); } else { fMipMapsStatus = kNotAllocated_MipMapsStatus; |