Prevent onFlushCB created opLists from being grouped with the normal ones (new)

Change-Id: I8ee04bb40a51f5b432b4c896a0c3e50559977463
Reviewed-on: https://skia-review.googlesource.com/19902
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Robert Phillips 2017-06-14 16:37:02 -04:00 committed by Skia Commit-Bot
parent 1ec03f33cf
commit 941d1446e0
5 changed files with 22 additions and 12 deletions

View File

@ -224,7 +224,8 @@ void GrDrawingManager::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlush
fOnFlushCBObjects.push_back(onFlushCBObject);
}
sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* rtp) {
sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* rtp,
bool managedOpList) {
SkASSERT(fContext);
// This is a temporary fix for the partial-MDB world. In that world we're not reordering
@ -239,7 +240,9 @@ sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* r
fContext->getAuditTrail()));
SkASSERT(rtp->getLastOpList() == opList.get());
fOpLists.push_back() = opList;
if (managedOpList) {
fOpLists.push_back() = opList;
}
return opList;
}
@ -306,7 +309,8 @@ GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawP
sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
sk_sp<GrSurfaceProxy> sProxy,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
const SkSurfaceProps* surfaceProps,
bool managedOpList) {
if (this->wasAbandoned() || !sProxy->asRenderTargetProxy()) {
return nullptr;
}
@ -347,7 +351,7 @@ sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
std::move(colorSpace),
surfaceProps,
fContext->getAuditTrail(),
fSingleOwner));
fSingleOwner, managedOpList));
}
sk_sp<GrTextureContext> GrDrawingManager::makeTextureContext(sk_sp<GrSurfaceProxy> sProxy,

View File

@ -42,12 +42,15 @@ public:
sk_sp<GrRenderTargetContext> makeRenderTargetContext(sk_sp<GrSurfaceProxy>,
sk_sp<SkColorSpace>,
const SkSurfaceProps*);
const SkSurfaceProps*,
bool managedOpList = true);
sk_sp<GrTextureContext> makeTextureContext(sk_sp<GrSurfaceProxy>, sk_sp<SkColorSpace>);
// The caller automatically gets a ref on the returned opList. It must
// be balanced by an unref call.
sk_sp<GrRenderTargetOpList> newRTOpList(GrRenderTargetProxy* rtp);
// A managed opList is controlled by the drawing manager (i.e., sorted & flushed with the
// other). An unmanaged one is created and used by the onFlushCallback.
sk_sp<GrRenderTargetOpList> newRTOpList(GrRenderTargetProxy* rtp, bool managedOpList);
sk_sp<GrTextureOpList> newTextureOpList(GrTextureProxy* textureProxy);
GrContext* getContext() { return fContext; }

View File

@ -33,7 +33,7 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
sk_sp<GrRenderTargetContext> renderTargetContext(
fDrawingMgr->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace),
props));
props, false));
if (!renderTargetContext) {
return nullptr;
@ -53,7 +53,7 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
sk_sp<GrRenderTargetContext> renderTargetContext(
fDrawingMgr->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace),
props));
props, false));
if (!renderTargetContext) {
return nullptr;

View File

@ -106,13 +106,15 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps,
GrAuditTrail* auditTrail,
GrSingleOwner* singleOwner)
GrSingleOwner* singleOwner,
bool managedOpList)
: GrSurfaceContext(context, drawingMgr, std::move(colorSpace), auditTrail, singleOwner)
, fRenderTargetProxy(std::move(rtp))
, fOpList(sk_ref_sp(fRenderTargetProxy->getLastRenderTargetOpList()))
, fInstancedPipelineInfo(fRenderTargetProxy.get())
, fColorXformFromSRGB(nullptr)
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) {
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
, fManagedOpList(managedOpList) {
if (fColorSpace) {
// sRGB sources are very common (SkColor, etc...), so we cache that gamut transformation
auto srgbColorSpace = SkColorSpace::MakeSRGB();
@ -154,7 +156,7 @@ GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
SkDEBUGCODE(this->validate();)
if (!fOpList || fOpList->isClosed()) {
fOpList = this->drawingManager()->newRTOpList(fRenderTargetProxy.get());
fOpList = this->drawingManager()->newRTOpList(fRenderTargetProxy.get(), fManagedOpList);
}
return fOpList.get();

View File

@ -351,7 +351,7 @@ public:
protected:
GrRenderTargetContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTargetProxy>,
sk_sp<SkColorSpace>, const SkSurfaceProps*, GrAuditTrail*,
GrSingleOwner*);
GrSingleOwner*, bool managedOpList = true);
SkDEBUGCODE(void validate() const;)
@ -431,6 +431,7 @@ private:
sk_sp<GrColorSpaceXform> fColorXformFromSRGB;
SkSurfaceProps fSurfaceProps;
bool fManagedOpList;
typedef GrSurfaceContext INHERITED;
};