Return a size of 0 for external format GrSurfaces.
This fixes a case where Chrome was hitting the assert in ComputeSize that colorSize > 0. In general this shouldn't affect our memory/budget tracking since external textures are generally given to us as wrapped borrowed textures so they're memory was not counted against our budget to begin with. Change-Id: I2fd4eaaab52d9c3dc1af3a8f5b59a1b1f3c5dbb7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256656 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
0addbdf0fb
commit
ada451ca67
@ -365,7 +365,8 @@ public:
|
||||
void storeVkPipelineCacheData();
|
||||
|
||||
// Returns the gpu memory size of the the texture that backs the passed in SkImage. Returns 0 if
|
||||
// the SkImage is not texture backed.
|
||||
// the SkImage is not texture backed. For external format textures this will also return 0 as we
|
||||
// cannot determine the correct size.
|
||||
static size_t ComputeImageSize(sk_sp<SkImage> image, GrMipMapped, bool useNextPow2 = false);
|
||||
|
||||
/*
|
||||
|
@ -21,6 +21,12 @@ size_t GrSurface::ComputeSize(const GrCaps& caps,
|
||||
int colorSamplesPerPixel,
|
||||
GrMipMapped mipMapped,
|
||||
bool binSize) {
|
||||
// For external formats we do not actually know the real size of the resource so we just return
|
||||
// 0 here to indicate this.
|
||||
if (format.textureType() == GrTextureType::kExternal) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t colorSize;
|
||||
|
||||
if (binSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user