Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb98faf6 authored by Leon Scroggins's avatar Leon Scroggins Committed by Automerger Merge Worker
Browse files

Merge "Better logs for "Unable to generate SkImage/SkSurface"" into udc-dev am: eaa7b055

parents d9c07dfd eaa7b055
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -82,6 +82,18 @@ void AutoBackendTexture::releaseImageProc(SkImage::ReleaseContext releaseContext
    textureRelease->unref(false);
}

void logFatalTexture(const char* msg, const GrBackendTexture& tex, ui::Dataspace dataspace,
                     SkColorType colorType) {
    GrGLTextureInfo textureInfo;
    bool retrievedTextureInfo = tex.getGLTextureInfo(&textureInfo);
    LOG_ALWAYS_FATAL("%s isTextureValid:%d dataspace:%d"
                     "\n\tGrBackendTexture: (%i x %i) hasMipmaps: %i isProtected: %i texType: %i"
                     "\n\t\tGrGLTextureInfo: success: %i fTarget: %u fFormat: %u colorType %i",
                     msg, tex.isValid(), dataspace, tex.width(), tex.height(), tex.hasMipmaps(),
                     tex.isProtected(), static_cast<int>(tex.textureType()), retrievedTextureInfo,
                     textureInfo.fTarget, textureInfo.fFormat, colorType);
}

sk_sp<SkImage> AutoBackendTexture::makeImage(ui::Dataspace dataspace, SkAlphaType alphaType,
                                             GrDirectContext* context) {
    ATRACE_CALL();
@@ -107,9 +119,9 @@ sk_sp<SkImage> AutoBackendTexture::makeImage(ui::Dataspace dataspace, SkAlphaTyp

    mImage = image;
    mDataspace = dataspace;
    LOG_ALWAYS_FATAL_IF(mImage == nullptr,
                        "Unable to generate SkImage. isTextureValid:%d dataspace:%d",
                        mBackendTexture.isValid(), dataspace);
    if (!mImage) {
        logFatalTexture("Unable to generate SkImage.", mBackendTexture, dataspace, colorType);
    }
    return mImage;
}

@@ -131,9 +143,9 @@ sk_sp<SkSurface> AutoBackendTexture::getOrCreateSurface(ui::Dataspace dataspace,
    }

    mDataspace = dataspace;
    LOG_ALWAYS_FATAL_IF(mSurface == nullptr,
                        "Unable to generate SkSurface. isTextureValid:%d dataspace:%d",
                        mBackendTexture.isValid(), dataspace);
    if (!mSurface) {
        logFatalTexture("Unable to generate SkSurface.", mBackendTexture, dataspace, mColorType);
    }
    return mSurface;
}