diff --git a/src/gpu/SkRenderEngineAbortf.h b/src/gpu/SkRenderEngineAbortf.h new file mode 100644 index 0000000000..f143030665 --- /dev/null +++ b/src/gpu/SkRenderEngineAbortf.h @@ -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 diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index e8d2182992..4240f94e05 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -32,6 +32,7 @@ #include "src/gpu/GrShaderCaps.h" #include "src/gpu/GrSurfaceProxyPriv.h" #include "src/gpu/GrTexture.h" +#include "src/gpu/SkRenderEngineAbortf.h" #include "src/gpu/gl/GrGLAttachment.h" #include "src/gpu/gl/GrGLBuffer.h" #include "src/gpu/gl/GrGLOpsRenderPass.h" @@ -1221,6 +1222,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrGLTexture::Desc& desc, GL_CALL(GenFramebuffers(1, &rtIDs->fSingleSampleFBOID)); if (!rtIDs->fSingleSampleFBOID) { + RENDERENGINE_ABORTF("%s failed to GenFramebuffers!", __func__); return false; } diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 5faf40475a..aafe76ffe1 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -24,6 +24,7 @@ #include "src/gpu/GrRecordingContextPriv.h" #include "src/gpu/GrRenderTarget.h" #include "src/gpu/GrTexture.h" +#include "src/gpu/SkRenderEngineAbortf.h" #include "src/image/SkImage_Base.h" #include "src/image/SkImage_Gpu.h" #include "src/image/SkSurface_Base.h" @@ -425,12 +426,6 @@ sk_sp SkSurface::MakeRenderTarget(GrRecordingContext* rContext, 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, int sampleCnt, GrColorType grCT, bool texturable) { @@ -525,8 +520,18 @@ sk_sp SkSurface::MakeFromBackendTexture(GrRecordingContext* rContext, tex, sampleCnt, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, std::move(releaseHelper))); if (!proxy) { - RENDERENGINE_ABORTF("%s failed to wrap the texture into a renderable target ", - __func__); +#ifdef SK_IN_RENDERENGINE + 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(tex.textureType()), + retrievedTextureInfo, textureInfo.fTarget, textureInfo.fFormat, + rContext->priv().caps()->maxRenderTargetSize()); +#endif return nullptr; }