Update DDL test harness to use GrDirectContexts
Before I start updating this to support relocatable DDLs I felt I
should clean it up a bit.
Change-Id: I640d15a40164b33c4c2d7378e37d39fe7d3ff313
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300926
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 405c895..3ccc462 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -2271,8 +2271,9 @@
return Result::Fatal("ViaDDL: Couldn't deflate SkPicture");
}
auto draw = [&](SkCanvas* canvas) -> Result {
- GrContext* context = canvas->getGrContext();
- if (!context || !context->priv().getGpu()) {
+ auto direct = canvas->recordingContext() ? canvas->recordingContext()->asDirectContext()
+ : nullptr;
+ if (!direct) {
return Result::Fatal("ViaDDL: DDLs are GPU only");
}
SkSurface* tmp = canvas->getSurface();
@@ -2284,10 +2285,10 @@
SkSurfaceCharacterization dstCharacterization;
SkAssertResult(dstSurface->characterize(&dstCharacterization));
- promiseImageHelper.createCallbackContexts(context);
+ promiseImageHelper.createCallbackContexts(direct);
// This is here bc this is the first point where we have access to the context
- promiseImageHelper.uploadAllToGPU(nullptr, context);
+ promiseImageHelper.uploadAllToGPU(nullptr, direct);
// We draw N times, with a clear between.
for (int replay = 0; replay < fNumReplays; ++replay) {
if (replay > 0) {
@@ -2295,9 +2296,9 @@
canvas->clear(SK_ColorTRANSPARENT);
}
// First, create all the tiles (including their individual dest surfaces)
- DDLTileHelper tiles(context, dstCharacterization, viewport, fNumDivisions);
+ DDLTileHelper tiles(direct, dstCharacterization, viewport, fNumDivisions);
- tiles.createBackendTextures(nullptr, context);
+ tiles.createBackendTextures(nullptr, direct);
// Second, reinflate the compressed picture individually for each thread
// This recreates the promise SkImages on each replay iteration. We are currently
@@ -2320,7 +2321,7 @@
// Fourth, synchronously render the display lists into the dest tiles
// TODO: it would be cool to not wait until all the tiles are drawn to begin
// drawing to the GPU and composing to the final surface
- tiles.precompileAndDrawAllTiles(context);
+ tiles.precompileAndDrawAllTiles(direct);
if (replay == fNumReplays - 1) {
// At this point the compose DDL holds refs to the composition promise images
@@ -2333,8 +2334,8 @@
// We need to ensure all the GPU work is finished so the promise image callback
// contexts will delete all the backend textures.
- context->flush();
- context->submit(true);
+ direct->flush();
+ direct->submit(true);
}
return Result::Ok();
};
diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp
index e17dd1a..8c9ddb1 100644
--- a/tools/DDLPromiseImageHelper.cpp
+++ b/tools/DDLPromiseImageHelper.cpp
@@ -12,7 +12,7 @@
#include "include/core/SkSerialProcs.h"
#include "include/core/SkYUVAIndex.h"
#include "include/core/SkYUVASizeInfo.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkCachedData.h"
#include "src/core/SkMipMap.h"
#include "src/core/SkTaskGroup.h"
@@ -88,6 +88,15 @@
fPromiseImageTexture = SkPromiseImageTexture::Make(backendTexture);
}
+void PromiseImageCallbackContext::destroyBackendTexture() {
+ SkASSERT(!fPromiseImageTexture || fPromiseImageTexture->unique());
+
+ if (fPromiseImageTexture) {
+ fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture());
+ }
+ fPromiseImageTexture = nullptr;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkData> DDLPromiseImageHelper::deflateSKP(const SkPicture* inputPicture) {
@@ -106,7 +115,7 @@
return inputPicture->serialize(&procs);
}
-static GrBackendTexture create_yuva_texture(GrContext* context, const SkPixmap& pm,
+static GrBackendTexture create_yuva_texture(GrDirectContext* direct, const SkPixmap& pm,
const SkYUVAIndex yuvaIndices[4], int texIndex) {
SkASSERT(texIndex >= 0 && texIndex <= 3);
@@ -125,12 +134,12 @@
auto markFinished = [](void* context) {
*(bool*)context = true;
};
- auto beTex = context->createBackendTexture(&pm, 1, GrRenderable::kNo, GrProtected::kNo,
- markFinished, &finishedBECreate);
+ auto beTex = direct->createBackendTexture(&pm, 1, GrRenderable::kNo, GrProtected::kNo,
+ markFinished, &finishedBECreate);
if (beTex.isValid()) {
- context->submit();
+ direct->submit();
while (!finishedBECreate) {
- context->checkAsyncWorkCompletion();
+ direct->checkAsyncWorkCompletion();
}
}
return beTex;
@@ -141,10 +150,8 @@
* a single promise image.
* For YUV textures this will result in up to 4 actual textures.
*/
-void DDLPromiseImageHelper::CreateBETexturesForPromiseImage(GrContext* context,
+void DDLPromiseImageHelper::CreateBETexturesForPromiseImage(GrDirectContext* direct,
PromiseImageInfo* info) {
- SkASSERT(context->asDirectContext());
-
if (info->isYUV()) {
int numPixmaps;
SkAssertResult(SkYUVAIndex::AreValidIndices(info->yuvaIndices(), &numPixmaps));
@@ -155,7 +162,7 @@
SkASSERT(callbackContext);
// DDL TODO: what should we do with mipmapped YUV images
- callbackContext->setBackendTexture(create_yuva_texture(context, yuvPixmap,
+ callbackContext->setBackendTexture(create_yuva_texture(direct, yuvPixmap,
info->yuvaIndices(), j));
SkASSERT(callbackContext->promiseImageTexture());
}
@@ -172,23 +179,21 @@
auto markFinished = [](void* context) {
*(bool*)context = true;
};
- auto backendTex = context->createBackendTexture(mipLevels.get(), info->numMipLevels(),
- GrRenderable::kNo, GrProtected::kNo,
- markFinished, &finishedBECreate);
+ auto backendTex = direct->createBackendTexture(mipLevels.get(), info->numMipLevels(),
+ GrRenderable::kNo, GrProtected::kNo,
+ markFinished, &finishedBECreate);
SkASSERT(backendTex.isValid());
- context->submit();
+ direct->submit();
while (!finishedBECreate) {
- context->checkAsyncWorkCompletion();
+ direct->checkAsyncWorkCompletion();
}
callbackContext->setBackendTexture(backendTex);
}
}
-void DDLPromiseImageHelper::DeleteBETexturesForPromiseImage(GrContext* context,
+void DDLPromiseImageHelper::DeleteBETexturesForPromiseImage(GrDirectContext* direct,
PromiseImageInfo* info) {
- SkASSERT(context->asDirectContext());
-
if (info->isYUV()) {
int numPixmaps;
SkAssertResult(SkYUVAIndex::AreValidIndices(info->yuvaIndices(), &numPixmaps));
@@ -211,8 +216,8 @@
}
}
-void DDLPromiseImageHelper::createCallbackContexts(GrContext* context) {
- const GrCaps* caps = context->priv().caps();
+void DDLPromiseImageHelper::createCallbackContexts(GrDirectContext* direct) {
+ const GrCaps* caps = direct->priv().caps();
const int maxDimension = caps->maxTextureSize();
for (int i = 0; i < fImageInfo.count(); ++i) {
@@ -225,11 +230,11 @@
for (int j = 0; j < numPixmaps; ++j) {
const SkPixmap& yuvPixmap = info.yuvPixmap(j);
- GrBackendFormat backendFormat = context->defaultBackendFormat(yuvPixmap.colorType(),
- GrRenderable::kNo);
+ GrBackendFormat backendFormat = direct->defaultBackendFormat(yuvPixmap.colorType(),
+ GrRenderable::kNo);
sk_sp<PromiseImageCallbackContext> callbackContext(
- new PromiseImageCallbackContext(context, backendFormat));
+ new PromiseImageCallbackContext(direct, backendFormat));
info.setCallbackContext(j, std::move(callbackContext));
}
@@ -242,48 +247,44 @@
continue;
}
- GrBackendFormat backendFormat = context->defaultBackendFormat(baseLevel.colorType(),
- GrRenderable::kNo);
+ GrBackendFormat backendFormat = direct->defaultBackendFormat(baseLevel.colorType(),
+ GrRenderable::kNo);
if (!caps->isFormatTexturable(backendFormat)) {
continue;
}
sk_sp<PromiseImageCallbackContext> callbackContext(
- new PromiseImageCallbackContext(context, backendFormat));
+ new PromiseImageCallbackContext(direct, backendFormat));
info.setCallbackContext(0, std::move(callbackContext));
}
}
}
-void DDLPromiseImageHelper::uploadAllToGPU(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->asDirectContext());
-
+void DDLPromiseImageHelper::uploadAllToGPU(SkTaskGroup* taskGroup, GrDirectContext* direct) {
if (taskGroup) {
for (int i = 0; i < fImageInfo.count(); ++i) {
PromiseImageInfo* info = &fImageInfo[i];
- taskGroup->add([context, info]() { CreateBETexturesForPromiseImage(context, info); });
+ taskGroup->add([direct, info]() { CreateBETexturesForPromiseImage(direct, info); });
}
} else {
for (int i = 0; i < fImageInfo.count(); ++i) {
- CreateBETexturesForPromiseImage(context, &fImageInfo[i]);
+ CreateBETexturesForPromiseImage(direct, &fImageInfo[i]);
}
}
}
-void DDLPromiseImageHelper::deleteAllFromGPU(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->asDirectContext());
-
+void DDLPromiseImageHelper::deleteAllFromGPU(SkTaskGroup* taskGroup, GrDirectContext* direct) {
if (taskGroup) {
for (int i = 0; i < fImageInfo.count(); ++i) {
PromiseImageInfo* info = &fImageInfo[i];
- taskGroup->add([context, info]() { DeleteBETexturesForPromiseImage(context, info); });
+ taskGroup->add([direct, info]() { DeleteBETexturesForPromiseImage(direct, info); });
}
} else {
for (int i = 0; i < fImageInfo.count(); ++i) {
- DeleteBETexturesForPromiseImage(context, &fImageInfo[i]);
+ DeleteBETexturesForPromiseImage(direct, &fImageInfo[i]);
}
}
}
diff --git a/tools/DDLPromiseImageHelper.h b/tools/DDLPromiseImageHelper.h
index 4a5bb23..20d659c 100644
--- a/tools/DDLPromiseImageHelper.h
+++ b/tools/DDLPromiseImageHelper.h
@@ -33,8 +33,8 @@
// it drops all of its refs (via "reset").
class PromiseImageCallbackContext : public SkRefCnt {
public:
- PromiseImageCallbackContext(GrContext* context, GrBackendFormat backendFormat)
- : fContext(context)
+ PromiseImageCallbackContext(GrDirectContext* direct, GrBackendFormat backendFormat)
+ : fContext(direct)
, fBackendFormat(backendFormat) {}
~PromiseImageCallbackContext();
@@ -43,14 +43,7 @@
void setBackendTexture(const GrBackendTexture& backendTexture);
- void destroyBackendTexture() {
- SkASSERT(!fPromiseImageTexture || fPromiseImageTexture->unique());
-
- if (fPromiseImageTexture) {
- fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture());
- }
- fPromiseImageTexture = nullptr;
- }
+ void destroyBackendTexture();
sk_sp<SkPromiseImageTexture> fulfill() {
SkASSERT(fUnreleasedFulfills >= 0);
@@ -93,7 +86,7 @@
}
private:
- GrContext* fContext;
+ GrDirectContext* fContext;
GrBackendFormat fBackendFormat;
sk_sp<SkPromiseImageTexture> fPromiseImageTexture;
int fNumImages = 0;
@@ -135,10 +128,10 @@
// Convert the SkPicture into SkData replacing all the SkImages with an index.
sk_sp<SkData> deflateSKP(const SkPicture* inputPicture);
- void createCallbackContexts(GrContext*);
+ void createCallbackContexts(GrDirectContext*);
- void uploadAllToGPU(SkTaskGroup*, GrContext*);
- void deleteAllFromGPU(SkTaskGroup*, GrContext*);
+ void uploadAllToGPU(SkTaskGroup*, GrDirectContext*);
+ void deleteAllFromGPU(SkTaskGroup*, GrDirectContext*);
// reinflate a deflated SKP, replacing all the indices with promise images.
sk_sp<SkPicture> reinflateSKP(SkDeferredDisplayListRecorder*,
@@ -262,14 +255,14 @@
SkTArray<sk_sp<SkImage>>* fPromiseImages;
};
- static void CreateBETexturesForPromiseImage(GrContext*, PromiseImageInfo*);
- static void DeleteBETexturesForPromiseImage(GrContext*, PromiseImageInfo*);
+ static void CreateBETexturesForPromiseImage(GrDirectContext*, PromiseImageInfo*);
+ static void DeleteBETexturesForPromiseImage(GrDirectContext*, PromiseImageInfo*);
static sk_sp<SkImage> CreatePromiseImages(const void* rawData, size_t length, void* ctxIn);
bool isValidID(int id) const { return id >= 0 && id < fImageInfo.count(); }
const PromiseImageInfo& getInfo(int id) const { return fImageInfo[id]; }
- void uploadImage(GrContext*, PromiseImageInfo*);
+ void uploadImage(GrDirectContext*, PromiseImageInfo*);
// returns -1 if not found
int findImage(SkImage* image) const;
diff --git a/tools/DDLTileHelper.cpp b/tools/DDLTileHelper.cpp
index 16e2595..0553eb0 100644
--- a/tools/DDLTileHelper.cpp
+++ b/tools/DDLTileHelper.cpp
@@ -12,6 +12,7 @@
#include "include/core/SkPicture.h"
#include "include/core/SkSurface.h"
#include "include/core/SkSurfaceCharacterization.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkDeferredDisplayListPriv.h"
#include "src/core/SkTaskGroup.h"
#include "src/gpu/GrContextPriv.h"
@@ -19,7 +20,7 @@
#include "tools/DDLPromiseImageHelper.h"
void DDLTileHelper::TileData::init(int id,
- GrContext* context,
+ GrDirectContext* direct,
const SkSurfaceCharacterization& dstSurfaceCharacterization,
const SkIRect& clip) {
fID = id;
@@ -28,12 +29,12 @@
fCharacterization = dstSurfaceCharacterization.createResized(clip.width(), clip.height());
SkASSERT(fCharacterization.isValid());
- GrBackendFormat backendFormat = context->defaultBackendFormat(fCharacterization.colorType(),
- GrRenderable::kYes);
- SkDEBUGCODE(const GrCaps* caps = context->priv().caps());
+ GrBackendFormat backendFormat = direct->defaultBackendFormat(fCharacterization.colorType(),
+ GrRenderable::kYes);
+ SkDEBUGCODE(const GrCaps* caps = direct->priv().caps());
SkASSERT(caps->isFormatTexturable(backendFormat));
- fCallbackContext.reset(new PromiseImageCallbackContext(context, backendFormat));
+ fCallbackContext.reset(new PromiseImageCallbackContext(direct, backendFormat));
}
DDLTileHelper::TileData::~TileData() {}
@@ -112,10 +113,10 @@
SkASSERT(fComposeDDL);
}
-void DDLTileHelper::TileData::precompile(GrContext* context) {
+void DDLTileHelper::TileData::precompile(GrDirectContext* direct) {
SkASSERT(fDisplayList);
- SkDeferredDisplayList::ProgramIterator iter(context, fDisplayList.get());
+ SkDeferredDisplayList::ProgramIterator iter(direct, fDisplayList.get());
for (; !iter.done(); iter.next()) {
iter.compile();
}
@@ -158,14 +159,14 @@
}
}
-void DDLTileHelper::TileData::draw(GrContext* context) {
+void DDLTileHelper::TileData::draw(GrDirectContext* direct) {
SkASSERT(fDisplayList && !fTileSurface);
// The tile's surface needs to be held until after the DDL is flushed bc the DDL doesn't take
// a ref on its destination proxy.
// TODO: make the DDL (or probably the drawing manager) take a ref on the destination proxy
// (maybe in GrDrawingManager::addDDLTarget).
- fTileSurface = this->makeWrappedTileDest(context);
+ fTileSurface = this->makeWrappedTileDest(direct);
if (fTileSurface) {
fTileSurface->draw(fDisplayList);
@@ -204,16 +205,14 @@
return promiseImage;
}
-void DDLTileHelper::TileData::CreateBackendTexture(GrContext* context, TileData* tile) {
- SkASSERT(context->asDirectContext());
+void DDLTileHelper::TileData::CreateBackendTexture(GrDirectContext* direct, TileData* tile) {
SkASSERT(tile->fCallbackContext && !tile->fCallbackContext->promiseImageTexture());
- GrBackendTexture beTex = context->createBackendTexture(tile->fCharacterization);
+ GrBackendTexture beTex = direct->createBackendTexture(tile->fCharacterization);
tile->fCallbackContext->setBackendTexture(beTex);
}
-void DDLTileHelper::TileData::DeleteBackendTexture(GrContext* context, TileData* tile) {
- SkASSERT(context->asDirectContext());
+void DDLTileHelper::TileData::DeleteBackendTexture(GrDirectContext*, TileData* tile) {
SkASSERT(tile->fCallbackContext);
// TODO: it seems that, on the Linux bots, backend texture creation is failing
@@ -229,7 +228,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-DDLTileHelper::DDLTileHelper(GrContext* context,
+DDLTileHelper::DDLTileHelper(GrDirectContext* direct,
const SkSurfaceCharacterization& dstChar,
const SkIRect& viewport,
int numDivisions)
@@ -252,7 +251,7 @@
SkASSERT(viewport.contains(clip));
- fTiles[y*fNumDivisions+x].init(y*fNumDivisions+x, context, dstChar, clip);
+ fTiles[y*fNumDivisions+x].init(y*fNumDivisions+x, direct, dstChar, clip);
}
}
}
@@ -282,12 +281,12 @@
// precompile any programs
// replay the DDL into a surface to make the tile image
// compose the tile image into the main canvas
-static void do_gpu_stuff(GrContext* context, DDLTileHelper::TileData* tile) {
+static void do_gpu_stuff(GrDirectContext* direct, DDLTileHelper::TileData* tile) {
// TODO: schedule program compilation as their own tasks
- tile->precompile(context);
+ tile->precompile(direct);
- tile->draw(context);
+ tile->draw(direct);
tile->dropDDL();
}
@@ -295,8 +294,8 @@
// We expect to have more than one recording thread but just one gpu thread
void DDLTileHelper::kickOffThreadedWork(SkTaskGroup* recordingTaskGroup,
SkTaskGroup* gpuTaskGroup,
- GrContext* gpuThreadContext) {
- SkASSERT(recordingTaskGroup && gpuTaskGroup && gpuThreadContext);
+ GrDirectContext* direct) {
+ SkASSERT(recordingTaskGroup && gpuTaskGroup && direct);
for (int i = 0; i < this->numTiles(); ++i) {
TileData* tile = &fTiles[i];
@@ -306,11 +305,11 @@
// schedule gpu-thread processing of the DDL
// Note: a finer grained approach would be add a scheduling task which would evaluate
// which DDLs were ready to be rendered based on their prerequisites
- recordingTaskGroup->add([tile, gpuTaskGroup, gpuThreadContext]() {
+ recordingTaskGroup->add([tile, gpuTaskGroup, direct]() {
tile->createDDL();
- gpuTaskGroup->add([gpuThreadContext, tile]() {
- do_gpu_stuff(gpuThreadContext, tile);
+ gpuTaskGroup->add([direct, tile]() {
+ do_gpu_stuff(direct, tile);
});
});
}
@@ -319,18 +318,18 @@
}
// Only called from ViaDDL
-void DDLTileHelper::precompileAndDrawAllTiles(GrContext* context) {
+void DDLTileHelper::precompileAndDrawAllTiles(GrDirectContext* direct) {
for (int i = 0; i < this->numTiles(); ++i) {
- fTiles[i].precompile(context);
- fTiles[i].draw(context);
+ fTiles[i].precompile(direct);
+ fTiles[i].draw(direct);
}
}
// Only called from skpbench
-void DDLTileHelper::interleaveDDLCreationAndDraw(GrContext* context) {
+void DDLTileHelper::interleaveDDLCreationAndDraw(GrDirectContext* direct) {
for (int i = 0; i < this->numTiles(); ++i) {
fTiles[i].createDDL();
- fTiles[i].draw(context);
+ fTiles[i].draw(direct);
}
}
@@ -354,34 +353,31 @@
fComposeDDL.reset();
}
-void DDLTileHelper::createBackendTextures(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->asDirectContext());
+void DDLTileHelper::createBackendTextures(SkTaskGroup* taskGroup, GrDirectContext* direct) {
if (taskGroup) {
for (int i = 0; i < this->numTiles(); ++i) {
TileData* tile = &fTiles[i];
- taskGroup->add([context, tile]() { TileData::CreateBackendTexture(context, tile); });
+ taskGroup->add([direct, tile]() { TileData::CreateBackendTexture(direct, tile); });
}
} else {
for (int i = 0; i < this->numTiles(); ++i) {
- TileData::CreateBackendTexture(context, &fTiles[i]);
+ TileData::CreateBackendTexture(direct, &fTiles[i]);
}
}
}
-void DDLTileHelper::deleteBackendTextures(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->asDirectContext());
-
+void DDLTileHelper::deleteBackendTextures(SkTaskGroup* taskGroup, GrDirectContext* direct) {
if (taskGroup) {
for (int i = 0; i < this->numTiles(); ++i) {
TileData* tile = &fTiles[i];
- taskGroup->add([context, tile]() { TileData::DeleteBackendTexture(context, tile); });
+ taskGroup->add([direct, tile]() { TileData::DeleteBackendTexture(direct, tile); });
}
} else {
for (int i = 0; i < this->numTiles(); ++i) {
- TileData::DeleteBackendTexture(context, &fTiles[i]);
+ TileData::DeleteBackendTexture(direct, &fTiles[i]);
}
}
}
diff --git a/tools/DDLTileHelper.h b/tools/DDLTileHelper.h
index 3956306..6e38c82 100644
--- a/tools/DDLTileHelper.h
+++ b/tools/DDLTileHelper.h
@@ -32,7 +32,7 @@
~TileData();
void init(int id,
- GrContext* context,
+ GrDirectContext*,
const SkSurfaceCharacterization& dstChar,
const SkIRect& clip);
@@ -47,7 +47,7 @@
void dropDDL() { fDisplayList.reset(); }
// Precompile all the programs required to draw this tile's DDL
- void precompile(GrContext*);
+ void precompile(GrDirectContext*);
// Just draw the re-inflated per-tile SKP directly into this tile w/o going through a DDL
// first. This is used for determining the overhead of using DDLs (i.e., it replaces
@@ -55,7 +55,7 @@
void drawSKPDirectly(GrContext*);
// Replay the recorded DDL into the tile surface - filling in 'fBackendTexture'.
- void draw(GrContext*);
+ void draw(GrDirectContext*);
void reset();
@@ -67,8 +67,8 @@
sk_sp<SkImage> makePromiseImage(SkDeferredDisplayListRecorder*);
void dropCallbackContext() { fCallbackContext.reset(); }
- static void CreateBackendTexture(GrContext*, TileData*);
- static void DeleteBackendTexture(GrContext*, TileData*);
+ static void CreateBackendTexture(GrDirectContext*, TileData*);
+ static void DeleteBackendTexture(GrDirectContext*, TileData*);
private:
sk_sp<SkSurface> makeWrappedTileDest(GrContext* context);
@@ -95,7 +95,7 @@
sk_sp<SkDeferredDisplayList> fDisplayList;
};
- DDLTileHelper(GrContext* context,
+ DDLTileHelper(GrDirectContext*,
const SkSurfaceCharacterization& dstChar,
const SkIRect& viewport,
int numDivisions);
@@ -104,7 +104,7 @@
void kickOffThreadedWork(SkTaskGroup* recordingTaskGroup,
SkTaskGroup* gpuTaskGroup,
- GrContext*);
+ GrDirectContext*);
void createDDLsInParallel();
@@ -112,14 +112,14 @@
void createComposeDDL();
const sk_sp<SkDeferredDisplayList>& composeDDL() const { return fComposeDDL; }
- void precompileAndDrawAllTiles(GrContext*);
+ void precompileAndDrawAllTiles(GrDirectContext*);
// For each tile, create its DDL and then draw it - all on a single thread. This is to allow
// comparison w/ just drawing the SKP directly (i.e., drawAllTilesDirectly). The
// DDL creations and draws are interleaved to prevent starvation of the GPU.
// Note: this is somewhat of a misuse/pessimistic-use of DDLs since they are supposed to
// be created on a separate thread.
- void interleaveDDLCreationAndDraw(GrContext*);
+ void interleaveDDLCreationAndDraw(GrDirectContext*);
// This draws all the per-tile SKPs directly into all of the tiles w/o converting them to
// DDLs first - all on a single thread.
@@ -130,8 +130,8 @@
int numTiles() const { return fNumDivisions * fNumDivisions; }
- void createBackendTextures(SkTaskGroup*, GrContext*);
- void deleteBackendTextures(SkTaskGroup*, GrContext*);
+ void createBackendTextures(SkTaskGroup*, GrDirectContext*);
+ void deleteBackendTextures(SkTaskGroup*, GrDirectContext*);
private:
int fNumDivisions; // number of tiles along a side