From c186e17a6b78e4897a9180f33b638d6b6cc6d959 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Tue, 17 Apr 2018 16:09:28 -0400 Subject: Add handling to ViaDDL for images that are too large to be uploaded in one go In Chrome's use case they are already doing a lot of work to determine where a given texture lands in device space. Presumably, part of that analysis is to determine if a texture is too big and either resize it or break it up. It seems unlikely they would be letting us upload it and draw it tiled. Bug: skia:7762 Change-Id: Ia95abc52f7e99c0a6ddef9f6db6237adba8cbc93 Reviewed-on: https://skia-review.googlesource.com/121892 Commit-Queue: Robert Phillips Reviewed-by: Greg Daniel --- dm/DMSrcSink.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'dm/DMSrcSink.cpp') diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index f0b329c5b9..9829e2978d 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -2099,12 +2099,14 @@ public: sk_sp callbackContext( new PromiseImageCallbackContext(context)); + const PromiseImageInfo& info = fImageInfo[i]; + // DDL TODO: how can we tell if we need mipmapping! callbackContext->setBackendTexture(gpu->createTestingOnlyBackendTexture( - fImageInfo[i].fBitmap.getPixels(), - fImageInfo[i].fBitmap.width(), - fImageInfo[i].fBitmap.height(), - fImageInfo[i].fBitmap.colorType(), + info.fBitmap.getPixels(), + info.fBitmap.width(), + info.fBitmap.height(), + info.fBitmap.colorType(), false, GrMipMapped::kNo)); // The GMs sometimes request too large an image //SkAssertResult(callbackContext->backendTexture().isValid()); @@ -2262,8 +2264,11 @@ private: const PromiseImageHelper::PromiseImageInfo& curImage = helper->getInfo(*indexPtr); if (!curImage.fCallbackContext->backendTexture().isValid()) { - // We weren't able to make a backend texture for this SkImage - return nullptr; + // We weren't able to make a backend texture for this SkImage. In this case we create + // a separate bitmap-backed image for each thread. + // Note: we would like to share the same bitmap between all the threads but + // SkBitmap is not thread-safe. + return SkImage::MakeRasterCopy(curImage.fBitmap.pixmap()); } SkASSERT(curImage.fIndex == *indexPtr); -- cgit v1.2.3