Finish the DDL sk_sp migration
This will not be landed until chrome CL 2269958 lands. Bug: skia:10425 Change-Id: I2a5081201ca3faed5232e8540086bd4c6f865767 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299292 Commit-Queue: Adlai Holler <adlai@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
0851459813
commit
f19bbb52b2
@ -81,7 +81,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SkDeferredDisplayListRecorder> fRecorder = nullptr;
|
std::unique_ptr<SkDeferredDisplayListRecorder> fRecorder = nullptr;
|
||||||
std::vector<SkDDLPointer> fDDLs;
|
std::vector<sk_sp<SkDeferredDisplayList>> fDDLs;
|
||||||
|
|
||||||
typedef Benchmark INHERITED;
|
typedef Benchmark INHERITED;
|
||||||
};
|
};
|
||||||
|
@ -1721,14 +1721,7 @@ Result GPUOOPRSink::ooprDraw(const Src& src,
|
|||||||
iter.compile();
|
iter.compile();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkAssertResult(dstSurface->draw(ddl));
|
SkAssertResult(dstSurface->draw(std::move(ddl)));
|
||||||
|
|
||||||
#ifdef SK_SP_IS_UNIQUE_POINTER
|
|
||||||
// TODO: remove this flush once DDLs are reffed by the drawing manager
|
|
||||||
context->flushAndSubmit();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ddl.reset();
|
|
||||||
|
|
||||||
return Result::Ok();
|
return Result::Ok();
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ void draw(SkCanvas* canvas) {
|
|||||||
SkDeferredDisplayListRecorder recorder(characterization);
|
SkDeferredDisplayListRecorder recorder(characterization);
|
||||||
SkCanvas* subCanvas = recorder.getCanvas();
|
SkCanvas* subCanvas = recorder.getCanvas();
|
||||||
subCanvas->clear(SK_ColorGREEN);
|
subCanvas->clear(SK_ColorGREEN);
|
||||||
std::unique_ptr<SkDeferredDisplayList> displayList = recorder.detach();
|
sk_sp<SkDeferredDisplayList> displayList = recorder.detach();
|
||||||
// end of threadable work
|
// end of threadable work
|
||||||
gpuSurface->draw(displayList.get());
|
gpuSurface->draw(displayList);
|
||||||
sk_sp<SkImage> img = gpuSurface->makeImageSnapshot();
|
sk_sp<SkImage> img = gpuSurface->makeImageSnapshot();
|
||||||
canvas->drawImage(std::move(img), 0, 0);
|
canvas->drawImage(std::move(img), 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,9 @@ void draw(SkCanvas* canvas) {
|
|||||||
SkDeferredDisplayListRecorder recorder(characterization);
|
SkDeferredDisplayListRecorder recorder(characterization);
|
||||||
SkCanvas* subCanvas = recorder.getCanvas();
|
SkCanvas* subCanvas = recorder.getCanvas();
|
||||||
subCanvas->clear(SK_ColorGREEN);
|
subCanvas->clear(SK_ColorGREEN);
|
||||||
std::unique_ptr<SkDeferredDisplayList> displayList = recorder.detach();
|
sk_sp<SkDeferredDisplayList> displayList = recorder.detach();
|
||||||
// end of threadable work
|
// end of threadable work
|
||||||
gpuSurface->draw(displayList.get());
|
gpuSurface->draw(displayList);
|
||||||
sk_sp<SkImage> img = gpuSurface->makeImageSnapshot();
|
sk_sp<SkImage> img = gpuSurface->makeImageSnapshot();
|
||||||
canvas->drawImage(std::move(img), 0, 0);
|
canvas->drawImage(std::move(img), 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -25,26 +25,11 @@ struct GrCCPerOpsTaskPaths;
|
|||||||
using GrRenderTargetProxy = SkRefCnt;
|
using GrRenderTargetProxy = SkRefCnt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class SkDeferredDisplayList;
|
|
||||||
|
|
||||||
// We are in the process of migrating DDL from unique_ptr to sk_sp. This macro can be defined
|
|
||||||
// by the user to keep the old API until they've migrated. It will be removed soon.
|
|
||||||
// This typedef is here temporarily and should not be used by the public.
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
typedef sk_sp<SkDeferredDisplayList> SkDDLPointer;
|
|
||||||
#else
|
|
||||||
typedef std::unique_ptr<SkDeferredDisplayList> SkDDLPointer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class contains pre-processed gpu operations that can be replayed into
|
* This class contains pre-processed gpu operations that can be replayed into
|
||||||
* an SkSurface via SkSurface::draw(SkDeferredDisplayList*).
|
* an SkSurface via SkSurface::draw(SkDeferredDisplayList*).
|
||||||
*/
|
*/
|
||||||
class SkDeferredDisplayList
|
class SkDeferredDisplayList : public SkNVRefCnt<SkDeferredDisplayList> {
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
: public SkNVRefCnt<SkDeferredDisplayList>
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
SK_API ~SkDeferredDisplayList();
|
SK_API ~SkDeferredDisplayList();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
// Note: ownership of the SkCanvas is not transferred via this call.
|
// Note: ownership of the SkCanvas is not transferred via this call.
|
||||||
SkCanvas* getCanvas();
|
SkCanvas* getCanvas();
|
||||||
|
|
||||||
SkDDLPointer detach();
|
sk_sp<SkDeferredDisplayList> detach();
|
||||||
|
|
||||||
using PromiseImageTextureContext = void*;
|
using PromiseImageTextureContext = void*;
|
||||||
using PromiseImageTextureFulfillProc =
|
using PromiseImageTextureFulfillProc =
|
||||||
|
@ -1046,12 +1046,7 @@ public:
|
|||||||
|
|
||||||
example: https://fiddle.skia.org/c/@Surface_draw_2
|
example: https://fiddle.skia.org/c/@Surface_draw_2
|
||||||
*/
|
*/
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
bool draw(sk_sp<const SkDeferredDisplayList> deferredDisplayList);
|
bool draw(sk_sp<const SkDeferredDisplayList> deferredDisplayList);
|
||||||
#else
|
|
||||||
bool draw(const SkDeferredDisplayList* deferredDisplayList);
|
|
||||||
bool draw(const std::unique_ptr<const SkDeferredDisplayList>& deferredDisplayList);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SkSurface(int width, int height, const SkSurfaceProps* surfaceProps);
|
SkSurface(int width, int height, const SkSurfaceProps* surfaceProps);
|
||||||
|
@ -21,7 +21,7 @@ bool SkDeferredDisplayListRecorder::init() { return false; }
|
|||||||
|
|
||||||
SkCanvas* SkDeferredDisplayListRecorder::getCanvas() { return nullptr; }
|
SkCanvas* SkDeferredDisplayListRecorder::getCanvas() { return nullptr; }
|
||||||
|
|
||||||
SkDDLPointer SkDeferredDisplayListRecorder::detach() { return nullptr; }
|
sk_sp<SkDeferredDisplayList> SkDeferredDisplayListRecorder::detach() { return nullptr; }
|
||||||
|
|
||||||
sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
|
sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
|
||||||
const GrBackendFormat& backendFormat,
|
const GrBackendFormat& backendFormat,
|
||||||
@ -207,7 +207,7 @@ SkCanvas* SkDeferredDisplayListRecorder::getCanvas() {
|
|||||||
return fSurface->getCanvas();
|
return fSurface->getCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkDDLPointer SkDeferredDisplayListRecorder::detach() {
|
sk_sp<SkDeferredDisplayList> SkDeferredDisplayListRecorder::detach() {
|
||||||
if (!fContext) {
|
if (!fContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -217,16 +217,17 @@ SkDDLPointer SkDeferredDisplayListRecorder::detach() {
|
|||||||
|
|
||||||
canvas->restoreToCount(0);
|
canvas->restoreToCount(0);
|
||||||
}
|
}
|
||||||
SkDeferredDisplayList* ddl = new SkDeferredDisplayList(fCharacterization,
|
|
||||||
std::move(fTargetProxy),
|
|
||||||
std::move(fLazyProxyData));
|
|
||||||
|
|
||||||
fContext->priv().moveRenderTasksToDDL(ddl);
|
auto ddl = sk_sp<SkDeferredDisplayList>(new SkDeferredDisplayList(fCharacterization,
|
||||||
|
std::move(fTargetProxy),
|
||||||
|
std::move(fLazyProxyData)));
|
||||||
|
|
||||||
|
fContext->priv().moveRenderTasksToDDL(ddl.get());
|
||||||
|
|
||||||
// We want a new lazy proxy target for each recorded DDL so force the (lazy proxy-backed)
|
// We want a new lazy proxy target for each recorded DDL so force the (lazy proxy-backed)
|
||||||
// SkSurface to be regenerated for each DDL.
|
// SkSurface to be regenerated for each DDL.
|
||||||
fSurface = nullptr;
|
fSurface = nullptr;
|
||||||
return SkDDLPointer(ddl);
|
return ddl;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
|
sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
|
||||||
|
@ -63,17 +63,10 @@ void GrContextPriv::moveRenderTasksToDDL(SkDeferredDisplayList* ddl) {
|
|||||||
fContext->drawingManager()->moveRenderTasksToDDL(ddl);
|
fContext->drawingManager()->moveRenderTasksToDDL(ddl);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
void GrContextPriv::copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList> ddl,
|
void GrContextPriv::copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList> ddl,
|
||||||
GrRenderTargetProxy* newDest) {
|
GrRenderTargetProxy* newDest) {
|
||||||
fContext->drawingManager()->copyRenderTasksFromDDL(std::move(ddl), newDest);
|
fContext->drawingManager()->copyRenderTasksFromDDL(std::move(ddl), newDest);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void GrContextPriv::copyRenderTasksFromDDL(const SkDeferredDisplayList* ddl,
|
|
||||||
GrRenderTargetProxy* newDest) {
|
|
||||||
fContext->drawingManager()->copyRenderTasksFromDDL(ddl, newDest);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool GrContextPriv::compile(const GrProgramDesc& desc, const GrProgramInfo& info) {
|
bool GrContextPriv::compile(const GrProgramDesc& desc, const GrProgramInfo& info) {
|
||||||
GrGpu* gpu = this->getGpu();
|
GrGpu* gpu = this->getGpu();
|
||||||
|
@ -121,11 +121,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void moveRenderTasksToDDL(SkDeferredDisplayList*);
|
void moveRenderTasksToDDL(SkDeferredDisplayList*);
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
void copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList>, GrRenderTargetProxy* newDest);
|
void copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList>, GrRenderTargetProxy* newDest);
|
||||||
#else
|
|
||||||
void copyRenderTasksFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool compile(const GrProgramDesc&, const GrProgramInfo&);
|
bool compile(const GrProgramDesc&, const GrProgramInfo&);
|
||||||
|
|
||||||
|
@ -648,13 +648,8 @@ void GrDrawingManager::moveRenderTasksToDDL(SkDeferredDisplayList* ddl) {
|
|||||||
SkDEBUGCODE(this->validate());
|
SkDEBUGCODE(this->validate());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
void GrDrawingManager::copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList> ddl,
|
void GrDrawingManager::copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList> ddl,
|
||||||
GrRenderTargetProxy* newDest) {
|
GrRenderTargetProxy* newDest) {
|
||||||
#else
|
|
||||||
void GrDrawingManager::copyRenderTasksFromDDL(const SkDeferredDisplayList* ddl,
|
|
||||||
GrRenderTargetProxy* newDest) {
|
|
||||||
#endif
|
|
||||||
SkDEBUGCODE(this->validate());
|
SkDEBUGCODE(this->validate());
|
||||||
|
|
||||||
if (fActiveOpsTask) {
|
if (fActiveOpsTask) {
|
||||||
@ -690,11 +685,9 @@ void GrDrawingManager::copyRenderTasksFromDDL(const SkDeferredDisplayList* ddl,
|
|||||||
|
|
||||||
fDAG.add(ddl->fRenderTasks);
|
fDAG.add(ddl->fRenderTasks);
|
||||||
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
// Add a task to unref the DDL after flush.
|
// Add a task to unref the DDL after flush.
|
||||||
GrRenderTask* unrefTask = fDAG.add(sk_make_sp<GrUnrefDDLTask>(std::move(ddl)));
|
GrRenderTask* unrefTask = fDAG.add(sk_make_sp<GrUnrefDDLTask>(std::move(ddl)));
|
||||||
unrefTask->makeClosed(*fContext->priv().caps());
|
unrefTask->makeClosed(*fContext->priv().caps());
|
||||||
#endif
|
|
||||||
|
|
||||||
SkDEBUGCODE(this->validate());
|
SkDEBUGCODE(this->validate());
|
||||||
}
|
}
|
||||||
|
@ -119,11 +119,7 @@ public:
|
|||||||
void setLastRenderTask(const GrSurfaceProxy*, GrRenderTask*);
|
void setLastRenderTask(const GrSurfaceProxy*, GrRenderTask*);
|
||||||
|
|
||||||
void moveRenderTasksToDDL(SkDeferredDisplayList* ddl);
|
void moveRenderTasksToDDL(SkDeferredDisplayList* ddl);
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
void copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList>, GrRenderTargetProxy* newDest);
|
void copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList>, GrRenderTargetProxy* newDest);
|
||||||
#else
|
|
||||||
void copyRenderTasksFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This class encapsulates maintenance and manipulation of the drawing manager's DAG of
|
// This class encapsulates maintenance and manipulation of the drawing manager's DAG of
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
#ifndef GrUnrefDDLTask_DEFINED
|
#ifndef GrUnrefDDLTask_DEFINED
|
||||||
#define GrUnrefDDLTask_DEFINED
|
#define GrUnrefDDLTask_DEFINED
|
||||||
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
|
|
||||||
#include "src/gpu/GrRenderTask.h"
|
#include "src/gpu/GrRenderTask.h"
|
||||||
|
|
||||||
/** When a DDL is played back, the drawing manager refs the DDL and adds one
|
/** When a DDL is played back, the drawing manager refs the DDL and adds one
|
||||||
@ -53,5 +51,4 @@ private:
|
|||||||
sk_sp<const SkDeferredDisplayList> fDDL;
|
sk_sp<const SkDeferredDisplayList> fDDL;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -377,18 +377,9 @@ bool SkSurface::isCompatible(const SkSurfaceCharacterization& characterization)
|
|||||||
return asConstSB(this)->onIsCompatible(characterization);
|
return asConstSB(this)->onIsCompatible(characterization);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
bool SkSurface::draw(sk_sp<const SkDeferredDisplayList> ddl) {
|
bool SkSurface::draw(sk_sp<const SkDeferredDisplayList> ddl) {
|
||||||
return asSB(this)->onDraw(ddl);
|
return asSB(this)->onDraw(std::move(ddl));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bool SkSurface::draw(const SkDeferredDisplayList* ddl) {
|
|
||||||
return asSB(this)->onDraw(ddl);
|
|
||||||
}
|
|
||||||
bool SkSurface::draw(const std::unique_ptr<const SkDeferredDisplayList>& ddl) {
|
|
||||||
return asSB(this)->onDraw(ddl.get());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
#include "include/utils/SkNoDrawCanvas.h"
|
#include "include/utils/SkNoDrawCanvas.h"
|
||||||
|
@ -125,11 +125,7 @@ public:
|
|||||||
|
|
||||||
virtual bool onCharacterize(SkSurfaceCharacterization*) const { return false; }
|
virtual bool onCharacterize(SkSurfaceCharacterization*) const { return false; }
|
||||||
virtual bool onIsCompatible(const SkSurfaceCharacterization&) const { return false; }
|
virtual bool onIsCompatible(const SkSurfaceCharacterization&) const { return false; }
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
virtual bool onDraw(sk_sp<const SkDeferredDisplayList>) { return false; }
|
virtual bool onDraw(sk_sp<const SkDeferredDisplayList>) { return false; }
|
||||||
#else
|
|
||||||
virtual bool onDraw(const SkDeferredDisplayList*) { return false; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline SkCanvas* getCachedCanvas();
|
inline SkCanvas* getCachedCanvas();
|
||||||
inline sk_sp<SkImage> refCachedImage();
|
inline sk_sp<SkImage> refCachedImage();
|
||||||
|
@ -333,7 +333,6 @@ bool SkSurface_Gpu::onIsCompatible(const SkSurfaceCharacterization& characteriza
|
|||||||
characterization.surfaceProps() == rtc->surfaceProps();
|
characterization.surfaceProps() == rtc->surfaceProps();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
bool SkSurface_Gpu::onDraw(sk_sp<const SkDeferredDisplayList> ddl) {
|
bool SkSurface_Gpu::onDraw(sk_sp<const SkDeferredDisplayList> ddl) {
|
||||||
if (!ddl || !this->isCompatible(ddl->characterization())) {
|
if (!ddl || !this->isCompatible(ddl->characterization())) {
|
||||||
return false;
|
return false;
|
||||||
@ -345,19 +344,6 @@ bool SkSurface_Gpu::onDraw(sk_sp<const SkDeferredDisplayList> ddl) {
|
|||||||
ctx->priv().copyRenderTasksFromDDL(std::move(ddl), rtc->asRenderTargetProxy());
|
ctx->priv().copyRenderTasksFromDDL(std::move(ddl), rtc->asRenderTargetProxy());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bool SkSurface_Gpu::onDraw(const SkDeferredDisplayList* ddl) {
|
|
||||||
if (!ddl || !this->isCompatible(ddl->characterization())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GrRenderTargetContext* rtc = fDevice->accessRenderTargetContext();
|
|
||||||
GrContext* ctx = fDevice->context();
|
|
||||||
|
|
||||||
ctx->priv().copyRenderTasksFromDDL(ddl, rtc->asRenderTargetProxy());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -58,11 +58,7 @@ public:
|
|||||||
bool onCharacterize(SkSurfaceCharacterization*) const override;
|
bool onCharacterize(SkSurfaceCharacterization*) const override;
|
||||||
bool onIsCompatible(const SkSurfaceCharacterization&) const override;
|
bool onIsCompatible(const SkSurfaceCharacterization&) const override;
|
||||||
void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) override;
|
void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) override;
|
||||||
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
||||||
bool onDraw(sk_sp<const SkDeferredDisplayList>) override;
|
bool onDraw(sk_sp<const SkDeferredDisplayList>) override;
|
||||||
#else
|
|
||||||
bool onDraw(const SkDeferredDisplayList*) override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SkGpuDevice* getDevice() { return fDevice.get(); }
|
SkGpuDevice* getDevice() { return fDevice.get(); }
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a DDL whose characterization captures the current settings
|
// Create a DDL whose characterization captures the current settings
|
||||||
SkDDLPointer createDDL(GrContext* context) const {
|
sk_sp<SkDeferredDisplayList> createDDL(GrContext* context) const {
|
||||||
SkSurfaceCharacterization c = this->createCharacterization(context);
|
SkSurfaceCharacterization c = this->createCharacterization(context);
|
||||||
SkAssertResult(c.isValid());
|
SkAssertResult(c.isValid());
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ void DDLSurfaceCharacterizationTestImpl(GrContext* context, skiatest::Reporter*
|
|||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
bitmap.allocPixels(imageInfo);
|
bitmap.allocPixels(imageInfo);
|
||||||
|
|
||||||
SkDDLPointer ddl;
|
sk_sp<SkDeferredDisplayList> ddl;
|
||||||
|
|
||||||
// First, create a DDL using the stock SkSurface parameters
|
// First, create a DDL using the stock SkSurface parameters
|
||||||
{
|
{
|
||||||
@ -726,7 +726,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLNonTextureabilityTest, reporter, ctxInfo)
|
|||||||
bitmap.allocPixels(imageInfo);
|
bitmap.allocPixels(imageInfo);
|
||||||
|
|
||||||
for (bool textureability : { true, false }) {
|
for (bool textureability : { true, false }) {
|
||||||
SkDDLPointer ddl;
|
sk_sp<SkDeferredDisplayList> ddl;
|
||||||
|
|
||||||
// First, create a DDL w/o textureability (and thus no mipmaps). TODO: once we have
|
// First, create a DDL w/o textureability (and thus no mipmaps). TODO: once we have
|
||||||
// reusable DDLs, move this outside of the loop.
|
// reusable DDLs, move this outside of the loop.
|
||||||
@ -1047,7 +1047,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSkSurfaceFlush, reporter, ctxInfo) {
|
|||||||
FulfillInfo fulfillInfo;
|
FulfillInfo fulfillInfo;
|
||||||
fulfillInfo.fTex = SkPromiseImageTexture::Make(backendTexture);
|
fulfillInfo.fTex = SkPromiseImageTexture::Make(backendTexture);
|
||||||
|
|
||||||
SkDDLPointer ddl;
|
sk_sp<SkDeferredDisplayList> ddl;
|
||||||
|
|
||||||
{
|
{
|
||||||
SkDeferredDisplayListRecorder recorder(characterization);
|
SkDeferredDisplayListRecorder recorder(characterization);
|
||||||
@ -1126,7 +1126,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMultipleDDLs, reporter, ctxInfo) {
|
|||||||
canvas1->save();
|
canvas1->save();
|
||||||
canvas1->clipRect(SkRect::MakeXYWH(8, 8, 16, 16));
|
canvas1->clipRect(SkRect::MakeXYWH(8, 8, 16, 16));
|
||||||
|
|
||||||
SkDDLPointer ddl1 = recorder.detach();
|
sk_sp<SkDeferredDisplayList> ddl1 = recorder.detach();
|
||||||
|
|
||||||
SkCanvas* canvas2 = recorder.getCanvas();
|
SkCanvas* canvas2 = recorder.getCanvas();
|
||||||
|
|
||||||
@ -1134,7 +1134,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMultipleDDLs, reporter, ctxInfo) {
|
|||||||
p.setColor(SK_ColorGREEN);
|
p.setColor(SK_ColorGREEN);
|
||||||
canvas2->drawRect(SkRect::MakeWH(32, 32), p);
|
canvas2->drawRect(SkRect::MakeWH(32, 32), p);
|
||||||
|
|
||||||
SkDDLPointer ddl2 = recorder.detach();
|
sk_sp<SkDeferredDisplayList> ddl2 = recorder.detach();
|
||||||
|
|
||||||
REPORTER_ASSERT(reporter, ddl1->priv().lazyProxyData());
|
REPORTER_ASSERT(reporter, ddl1->priv().lazyProxyData());
|
||||||
REPORTER_ASSERT(reporter, ddl2->priv().lazyProxyData());
|
REPORTER_ASSERT(reporter, ddl2->priv().lazyProxyData());
|
||||||
|
@ -289,11 +289,6 @@ static void do_gpu_stuff(GrContext* context, DDLTileHelper::TileData* tile) {
|
|||||||
|
|
||||||
tile->draw(context);
|
tile->draw(context);
|
||||||
|
|
||||||
#ifdef SK_SP_IS_UNIQUE_POINTER
|
|
||||||
// TODO: remove this flush once DDLs are reffed by the drawing manager
|
|
||||||
context->flushAndSubmit();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tile->dropDDL();
|
tile->dropDDL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,12 +87,12 @@ public:
|
|||||||
// after 'fDisplayList' has been flushed (bc it owns the proxy the DDL's destination
|
// after 'fDisplayList' has been flushed (bc it owns the proxy the DDL's destination
|
||||||
// trampoline points at).
|
// trampoline points at).
|
||||||
// TODO: fix the ref-order so we don't need 'fTileSurface' here
|
// TODO: fix the ref-order so we don't need 'fTileSurface' here
|
||||||
sk_sp<SkSurface> fTileSurface;
|
sk_sp<SkSurface> fTileSurface;
|
||||||
|
|
||||||
sk_sp<SkPicture> fReconstitutedPicture;
|
sk_sp<SkPicture> fReconstitutedPicture;
|
||||||
SkTArray<sk_sp<SkImage>> fPromiseImages; // All the promise images in the
|
SkTArray<sk_sp<SkImage>> fPromiseImages; // All the promise images in the
|
||||||
// reconstituted picture
|
// reconstituted picture
|
||||||
SkDDLPointer fDisplayList;
|
sk_sp<SkDeferredDisplayList> fDisplayList;
|
||||||
};
|
};
|
||||||
|
|
||||||
DDLTileHelper(GrContext* context,
|
DDLTileHelper(GrContext* context,
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
|
|
||||||
// Create the DDL that will compose all the tile images into a final result.
|
// Create the DDL that will compose all the tile images into a final result.
|
||||||
void createComposeDDL();
|
void createComposeDDL();
|
||||||
const SkDDLPointer& composeDDL() const { return fComposeDDL; }
|
const sk_sp<SkDeferredDisplayList>& composeDDL() const { return fComposeDDL; }
|
||||||
|
|
||||||
void precompileAndDrawAllTiles(GrContext*);
|
void precompileAndDrawAllTiles(GrContext*);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ private:
|
|||||||
int fNumDivisions; // number of tiles along a side
|
int fNumDivisions; // number of tiles along a side
|
||||||
SkAutoTArray<TileData> fTiles; // 'fNumDivisions' x 'fNumDivisions'
|
SkAutoTArray<TileData> fTiles; // 'fNumDivisions' x 'fNumDivisions'
|
||||||
|
|
||||||
SkDDLPointer fComposeDDL;
|
sk_sp<SkDeferredDisplayList> fComposeDDL;
|
||||||
|
|
||||||
const SkSurfaceCharacterization fDstCharacterization;
|
const SkSurfaceCharacterization fDstCharacterization;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user