Remove SK_RASTER_RECORDER_IMPLEMENTATION

TBR=bsalomon@google.com
Change-Id: I9608ce5ce2b9d38c5e356d8428a8ff05df6ccda7
Reviewed-on: https://skia-review.googlesource.com/114490
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Robert Phillips 2018-03-15 08:01:22 -04:00 committed by Skia Commit-Bot
parent 0fe4ed8598
commit 38eb740b94
7 changed files with 2 additions and 73 deletions

View File

@ -111,12 +111,10 @@ private:
const SkSurfaceCharacterization fCharacterization;
#ifndef SK_RASTER_RECORDER_IMPLEMENTATION
#if SK_SUPPORT_GPU
sk_sp<GrContext> fContext;
#endif
sk_sp<SkDeferredDisplayList::LazyProxyData> fLazyProxyData;
#endif
sk_sp<SkSurface> fSurface;
};

View File

@ -16,10 +16,6 @@
class SkColorSpace;
// This define can be used to swap between the default (raster) DDL implementation and the
// gpu implementation.
//#define SK_RASTER_RECORDER_IMPLEMENTATION 1
#if SK_SUPPORT_GPU
#include "GrContext.h"

View File

@ -14,10 +14,6 @@
#include "GrOpList.h"
#endif
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
class SkImage; // DDL TODO: rm this since it is just for the temporary placeholder implementation
#endif
class SkSurface;
/*
@ -29,16 +25,6 @@ class SkSurface;
class SkDeferredDisplayList {
public:
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
SkDeferredDisplayList(const SkSurfaceCharacterization& characterization, sk_sp<SkImage> image)
: fCharacterization(characterization)
, fImage(std::move(image)) {
}
// DDL TODO: remove this. It is just scaffolding to get something up & running
bool draw(SkSurface*) const;
#endif
#if SK_SUPPORT_GPU
// This object is the source from which the lazy proxy backing the DDL will pull its backing
// texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy
@ -67,16 +53,10 @@ private:
const SkSurfaceCharacterization fCharacterization;
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
sk_sp<SkImage> fImage;
#else
#if SK_SUPPORT_GPU
SkTArray<sk_sp<GrOpList>> fOpLists;
#endif
sk_sp<LazyProxyData> fLazyProxyData;
#endif
};
#endif

View File

@ -10,19 +10,8 @@
#include "SkCanvas.h"
#include "SkSurface.h"
#ifndef SK_RASTER_RECORDER_IMPLEMENTATION
SkDeferredDisplayList::SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
sk_sp<LazyProxyData> lazyProxyData)
: fCharacterization(characterization)
, fLazyProxyData(std::move(lazyProxyData)) {
}
#endif
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
// Placeholder. Ultimately, the SkSurface_Gpu will pass the wrapped opLists to its
// renderTargetContext.
bool SkDeferredDisplayList::draw(SkSurface* surface) const {
surface->getCanvas()->drawImage(fImage.get(), 0, 0);
return true;
}
#endif

View File

@ -30,7 +30,7 @@ SkDeferredDisplayListRecorder::SkDeferredDisplayListRecorder(
}
SkDeferredDisplayListRecorder::~SkDeferredDisplayListRecorder() {
#if SK_SUPPORT_GPU && !defined(SK_RASTER_RECORDER_IMPLEMENTATION)
#if SK_SUPPORT_GPU
auto proxyProvider = fContext->contextPriv().proxyProvider();
// DDL TODO: Remove this. DDL contexts should allow for deletion while still having live
@ -47,15 +47,6 @@ bool SkDeferredDisplayListRecorder::init() {
return false;
}
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
// Use raster right now to allow threading
const SkImageInfo ii = SkImageInfo::Make(fCharacterization.width(), fCharacterization.height(),
kN32_SkColorType, kOpaque_SkAlphaType,
fCharacterization.refColorSpace());
fSurface = SkSurface::MakeRaster(ii, &fCharacterization.surfaceProps());
return SkToBool(fSurface.get());
#else
SkASSERT(!fLazyProxyData);
#if SK_SUPPORT_GPU
@ -113,8 +104,6 @@ bool SkDeferredDisplayListRecorder::init() {
#else
return false;
#endif
#endif
}
SkCanvas* SkDeferredDisplayListRecorder::getCanvas() {
@ -128,16 +117,6 @@ SkCanvas* SkDeferredDisplayListRecorder::getCanvas() {
}
std::unique_ptr<SkDeferredDisplayList> SkDeferredDisplayListRecorder::detach() {
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
sk_sp<SkImage> img = fSurface->makeImageSnapshot();
fSurface.reset();
// TODO: need to wrap the opLists associated with the deferred draws
// in the SkDeferredDisplayList.
return std::unique_ptr<SkDeferredDisplayList>(
new SkDeferredDisplayList(fCharacterization, std::move(img)));
#else
#if SK_SUPPORT_GPU
auto ddl = std::unique_ptr<SkDeferredDisplayList>(
new SkDeferredDisplayList(fCharacterization, std::move(fLazyProxyData)));
@ -147,9 +126,6 @@ std::unique_ptr<SkDeferredDisplayList> SkDeferredDisplayListRecorder::detach() {
#else
return nullptr;
#endif
#endif // SK_RASTER_RECORDER_IMPLEMENTATION
}
sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
@ -164,7 +140,7 @@ sk_sp<SkImage> SkDeferredDisplayListRecorder::makePromiseTexture(
TextureFulfillProc textureFulfillProc,
TextureReleaseProc textureReleaseProc,
TextureContext textureContext) {
#if !defined(SK_RASTER_RECORDER_IMPLEMENTATION) && SK_SUPPORT_GPU
#if SK_SUPPORT_GPU
return SkImage_Gpu::MakePromiseTexture(fContext.get(),
backendFormat,
width,

View File

@ -356,24 +356,20 @@ void GrDrawingManager::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlush
}
void GrDrawingManager::moveOpListsToDDL(SkDeferredDisplayList* ddl) {
#ifndef SK_RASTER_RECORDER_IMPLEMENTATION
for (int i = 0; i < fOpLists.count(); ++i) {
// no opList should receive a new command after this
fOpLists[i]->makeClosed(*fContext->caps());
}
ddl->fOpLists = std::move(fOpLists);
#endif
}
void GrDrawingManager::copyOpListsFromDDL(const SkDeferredDisplayList* ddl,
GrRenderTargetProxy* newDest) {
#ifndef SK_RASTER_RECORDER_IMPLEMENTATION
// Here we jam the proxy that backs the current replay SkSurface into the LazyProxyData.
// The lazy proxy that references it (in the copied opLists) will steal its GrTexture.
ddl->fLazyProxyData->fReplayDest = newDest;
fOpLists.push_back_n(ddl->fOpLists.count(), ddl->fOpLists.begin());
#endif
}
sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* rtp,

View File

@ -228,17 +228,11 @@ bool SkSurface_Gpu::onDraw(const SkDeferredDisplayList* ddl) {
return false;
}
#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
// Ultimately need to pass opLists from the DeferredDisplayList on to the
// SkGpuDevice's renderTargetContext.
return ddl->draw(this);
#else
GrRenderTargetContext* rtc = fDevice->accessRenderTargetContext();
GrContext* ctx = fDevice->context();
ctx->contextPriv().copyOpListsFromDDL(ddl, rtc->asRenderTargetProxy());
return true;
#endif
}