Add more debugging info for backend texture failure

Print out information regarding the GrBackendTexture, along with the max
render target size, when we crash.

Add another crash in another file which may be responsible for the
failure.

Consolidate RENDERENGINE_ABORTF into a header file so it can be shared.

Bug: b/206415266
Change-Id: I2cceb847bc913a43c5341a26558e74ac13cc7b7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490277
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
Leon Scroggins III 2021-12-30 15:26:18 -05:00 committed by SkCQ
parent dcf2710c89
commit 13f244c95c
3 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1,19 @@
/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkRenderEngineAbortf_DEFINED
#define SkRenderEngineAbortf_DEFINED
#include "include/core/SkTypes.h"
#ifdef SK_IN_RENDERENGINE
#define RENDERENGINE_ABORTF(...) SK_ABORT(__VA_ARGS__)
#else
#define RENDERENGINE_ABORTF(...)
#endif
#endif// SkRenderEngineAbortf_DEFINED

View File

@ -32,6 +32,7 @@
#include "src/gpu/GrShaderCaps.h" #include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrSurfaceProxyPriv.h" #include "src/gpu/GrSurfaceProxyPriv.h"
#include "src/gpu/GrTexture.h" #include "src/gpu/GrTexture.h"
#include "src/gpu/SkRenderEngineAbortf.h"
#include "src/gpu/gl/GrGLAttachment.h" #include "src/gpu/gl/GrGLAttachment.h"
#include "src/gpu/gl/GrGLBuffer.h" #include "src/gpu/gl/GrGLBuffer.h"
#include "src/gpu/gl/GrGLOpsRenderPass.h" #include "src/gpu/gl/GrGLOpsRenderPass.h"
@ -1221,6 +1222,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrGLTexture::Desc& desc,
GL_CALL(GenFramebuffers(1, &rtIDs->fSingleSampleFBOID)); GL_CALL(GenFramebuffers(1, &rtIDs->fSingleSampleFBOID));
if (!rtIDs->fSingleSampleFBOID) { if (!rtIDs->fSingleSampleFBOID) {
RENDERENGINE_ABORTF("%s failed to GenFramebuffers!", __func__);
return false; return false;
} }

View File

@ -24,6 +24,7 @@
#include "src/gpu/GrRecordingContextPriv.h" #include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTarget.h" #include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrTexture.h" #include "src/gpu/GrTexture.h"
#include "src/gpu/SkRenderEngineAbortf.h"
#include "src/image/SkImage_Base.h" #include "src/image/SkImage_Base.h"
#include "src/image/SkImage_Gpu.h" #include "src/image/SkImage_Gpu.h"
#include "src/image/SkSurface_Base.h" #include "src/image/SkSurface_Base.h"
@ -425,12 +426,6 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrRecordingContext* rContext,
return result; return result;
} }
#ifdef SK_IN_RENDERENGINE
#define RENDERENGINE_ABORTF(...) SK_ABORT(__VA_ARGS__)
#else
#define RENDERENGINE_ABORTF(...)
#endif
static bool validate_backend_texture(const GrCaps* caps, const GrBackendTexture& tex, static bool validate_backend_texture(const GrCaps* caps, const GrBackendTexture& tex,
int sampleCnt, GrColorType grCT, int sampleCnt, GrColorType grCT,
bool texturable) { bool texturable) {
@ -525,8 +520,18 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrRecordingContext* rContext,
tex, sampleCnt, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, tex, sampleCnt, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
std::move(releaseHelper))); std::move(releaseHelper)));
if (!proxy) { if (!proxy) {
RENDERENGINE_ABORTF("%s failed to wrap the texture into a renderable target ", #ifdef SK_IN_RENDERENGINE
__func__); GrGLTextureInfo textureInfo;
bool retrievedTextureInfo = tex.getGLTextureInfo(&textureInfo);
RENDERENGINE_ABORTF("%s failed to wrap the texture into a renderable target "
"\n\tGrBackendTexture: (%i x %i) hasMipmaps: %i isProtected: %i texType: %i"
"\n\t\tGrGLTextureInfo: success: %i fTarget: %u fFormat: %u"
"\n\tmaxRenderTargetSize: %d",
__func__, tex.width(), tex.height(), tex.hasMipmaps(),
tex.isProtected(), static_cast<int>(tex.textureType()),
retrievedTextureInfo, textureInfo.fTarget, textureInfo.fFormat,
rContext->priv().caps()->maxRenderTargetSize());
#endif
return nullptr; return nullptr;
} }