From 1265894423f394f7ca60e660168414cfb8fe66b3 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Thu, 5 Oct 2017 19:45:25 -0600 Subject: Don't execute onFlush op lists until after GPU data is uploaded Bug: skia: Change-Id: Ide85e802fd6e6a19412457dbaded3545b962c240 Reviewed-on: https://skia-review.googlesource.com/55562 Reviewed-by: Robert Phillips Commit-Queue: Chris Dalton --- tests/OnFlushCallbackTest.cpp | 45 +++++++------------------------------------ 1 file changed, 7 insertions(+), 38 deletions(-) (limited to 'tests/OnFlushCallbackTest.cpp') diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index e47a76bb52..370165121d 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -166,16 +166,6 @@ private: } // anonymous namespace -#ifdef SK_DEBUG -#include "SkImageEncoder.h" -#include "sk_tool_utils.h" - -static void save_bm(const SkBitmap& bm, const char name[]) { - bool result = sk_tool_utils::EncodeImageToFile(name, bm, SkEncodedImageFormat::kPNG, 100); - SkASSERT(result); -} -#endif - static constexpr SkRect kEmptyRect = SkRect::MakeEmpty(); namespace { @@ -294,23 +284,6 @@ public: fAtlasDest = atlasDest; } - void saveRTC(sk_sp rtc) { - SkASSERT(!fRTC); - fRTC = rtc; - } - -#ifdef SK_DEBUG - void saveAtlasToDisk() { - SkBitmap readBack; - readBack.allocN32Pixels(fRTC->width(), fRTC->height()); - - bool result = fRTC->readPixels(readBack.info(), - readBack.getPixels(), readBack.rowBytes(), 0, 0); - SkASSERT(result); - save_bm(readBack, "atlas-real.png"); - } -#endif - /* * This callback back creates the atlas and updates the AtlasedRectOps to read from it */ @@ -389,9 +362,6 @@ public: this->clearOpsFor(lists[i]); } - // Hide a ref to the RTC in AtlasData so we can check on it later - this->saveRTC(rtc); - results->push_back(std::move(rtc)); } @@ -420,9 +390,6 @@ private: // Each opList containing AtlasedRectOps gets its own internal singly-linked list SkTDArray fOps; - // The RTC used to create the atlas - sk_sp fRTC; - // For the time being we need to pre-allocate the atlas bc the TextureSamplers require // a GrTexture sk_sp fAtlasDest; @@ -467,7 +434,14 @@ static sk_sp make_upstream_image(GrContext* context, AtlasObject // Enable this if you want to debug the final draws w/o having the atlasCallback create the // atlas #if 0 +#include "SkImageEncoder.h" #include "SkGrPriv.h" +#include "sk_tool_utils.h" + +static void save_bm(const SkBitmap& bm, const char name[]) { + bool result = sk_tool_utils::EncodeImageToFile(name, bm, SkEncodedImageFormat::kPNG, 100); + SkASSERT(result); +} sk_sp pre_create_atlas(GrContext* context) { SkBitmap bm; @@ -601,11 +575,6 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) { object.markAsDone(); -#if 0 - save_bm(readBack, "atlas-final-image.png"); - data.saveAtlasToDisk(); -#endif - int x = kDrawnTileSize/2; test_color(reporter, readBack, x, SK_ColorRED); x += kDrawnTileSize; -- cgit v1.2.3