Chromium Code Reviews| Index: src/gpu/GrTexture.cpp |
| diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp |
| index 7984460545db61d3b5dfb8c6120f24719e909365..99a9d3d2cd7c71d2ebbc99eddb0b422fdd181dda 100644 |
| --- a/src/gpu/GrTexture.cpp |
| +++ b/src/gpu/GrTexture.cpp |
| @@ -14,21 +14,7 @@ |
| #include "GrRenderTargetPriv.h" |
| #include "GrTexture.h" |
| #include "GrTexturePriv.h" |
| - |
| -void GrTexture::dirtyMipMaps(bool mipMapsDirty) { |
| - if (mipMapsDirty) { |
| - if (kValid_MipMapsStatus == fMipMapsStatus) { |
| - fMipMapsStatus = kAllocated_MipMapsStatus; |
| - } |
| - } else { |
| - const bool sizeChanged = kNotAllocated_MipMapsStatus == fMipMapsStatus; |
| - fMipMapsStatus = kValid_MipMapsStatus; |
| - if (sizeChanged) { |
| - // This must not be called until after changing fMipMapsStatus. |
| - this->didChangeGpuMemorySize(); |
| - } |
| - } |
| -} |
| +#include <cmath> |
| size_t GrTexture::onGpuMemorySize() const { |
| size_t textureSize; |
| @@ -93,6 +79,11 @@ GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) |
| // only make sense if alloc size is pow2 |
| fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); |
| fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); |
| + if (desc.fIsMipMapped) { |
| + fMipMapsStatus = kAllocated_MipMapsStatus; |
| + } else { |
| + fMipMapsStatus = kNotAllocated_MipMapsStatus; |
| + } |
| } |
| void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) { |
| @@ -105,11 +96,13 @@ void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k |
| SkASSERT(desc.fWidth <= SK_MaxU16); |
| SkASSERT(desc.fHeight <= SK_MaxU16); |
| - SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6)); |
| + // make sure desc.fConfig fits in 5 bits |
| + SkASSERT(log2(kLast_GrPixelConfig) <= 5); |
|
bsalomon
2015/09/15 13:14:11
Can you use sk_float_log2? It looks like it works
cblume
2015/09/16 18:40:46
Good catch.
|
| + SkASSERT(static_cast<int>(desc.fConfig) < (1 << 5)); |
| SkASSERT(desc.fSampleCnt < (1 << 8)); |
| SkASSERT(flags < (1 << 10)); |
| SkASSERT(static_cast<int>(origin) < (1 << 8)); |
| builder[0] = desc.fWidth | (desc.fHeight << 16); |
| - builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); |
| + builder[1] = desc.fConfig | desc.fIsMipMapped << 5 | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); |
|
bsalomon
2015/09/15 13:14:11
100 col wrap
cblume
2015/09/16 18:40:46
Done.
|
| } |