Move DrawingManager to RecordingContext

This CL does make use of a new GrRecordingContextPriv backdoor to break CL deadlocks. This occurs when this CL tries to create GrContext-dependent objects outside its scope.

Change-Id: I278fe9d321f8e0a4f5e9b489b1a5cc01b8974521
Reviewed-on: https://skia-review.googlesource.com/c/191287
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2019-02-22 11:16:30 -05:00 committed by Skia Commit-Bot
parent 54b57e9bad
commit 6989370877
30 changed files with 121 additions and 107 deletions

View File

@ -23,7 +23,6 @@ class GrBackendSemaphore;
class GrCaps;
class GrContextPriv;
class GrContextThreadSafeProxy;
class GrDrawingManager;
class GrFragmentProcessor;
struct GrGLInterface;
class GrGpu;
@ -293,9 +292,6 @@ protected:
virtual GrAtlasManager* onGetAtlasManager() = 0;
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
GrDrawingManager* drawingManager() override;
sk_sp<GrContextThreadSafeProxy> fThreadSafeProxy;
private:
@ -312,8 +308,6 @@ private:
// true if the PM/UPM conversion succeeded; false otherwise
bool fPMUPMConversionsRoundTrip;
std::unique_ptr<GrDrawingManager> fDrawingManager;
GrContextOptions::PersistentCache* fPersistentCache;
// TODO: have the GrClipStackClip use renderTargetContexts and rm this friending

View File

@ -10,6 +10,7 @@
#include "GrAuditTrail.h"
#include "GrImageContext.h"
#include "SkRefCnt.h"
class GrDrawingManager;
class GrOnFlushCallbackObject;
@ -34,8 +35,7 @@ protected:
void abandonContext() override;
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
virtual GrDrawingManager* drawingManager() = 0;
GrDrawingManager* drawingManager();
sk_sp<GrOpMemoryPool> refOpMemoryPool();
GrOpMemoryPool* opMemoryPool();
@ -105,6 +105,7 @@ protected:
GrRecordingContext* asRecordingContext() override { return this; }
private:
std::unique_ptr<GrDrawingManager> fDrawingManager;
// All the GrOp-derived classes use this pool.
sk_sp<GrOpMemoryPool> fOpMemoryPool;

View File

@ -154,7 +154,7 @@ void SkInternalAtlasTextTarget::drawText(const SkGlyphID glyphs[], const SkPoint
fColor = color;
SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, kUnknown_SkPixelGeometry);
auto* grContext = this->context()->internal().grContext();
auto grContext = this->context()->internal().grContext();
auto atlasTextContext = grContext->priv().drawingManager()->getTextContext();
SkGlyphRunBuilder builder;
builder.drawGlyphsWithPositions(paint, font.makeFont(),

View File

@ -8,8 +8,11 @@
#include "SkGlyphRunPainter.h"
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrColorSpaceInfo.h"
#include "GrContextPriv.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "SkGr.h"
#include "text/GrTextBlobCache.h"
@ -516,7 +519,7 @@ SkPMColor4f generate_filtered_color(const SkPaint& paint, const GrColorSpaceInfo
}
void GrTextContext::drawGlyphRunList(
GrContext* context, GrTextTarget* target, const GrClip& clip,
GrRecordingContext* context, GrTextTarget* target, const GrClip& clip,
const SkMatrix& viewMatrix, const SkSurfaceProps& props,
const SkGlyphRunList& glyphRunList) {
SkPoint origin = glyphRunList.origin();
@ -528,7 +531,7 @@ void GrTextContext::drawGlyphRunList(
GrColor color = generate_filtered_color(listPaint, target->colorSpaceInfo()).toBytes_RGBA();
// If we have been abandoned, then don't draw
if (context->abandoned()) {
if (context->priv().abandoned()) {
return;
}

View File

@ -8,7 +8,6 @@
#include "GrBlurUtils.h"
#include "GrCaps.h"
#include "GrContextPriv.h"
#include "GrFixedClip.h"
#include "GrProxyProvider.h"
#include "GrRecordingContext.h"
@ -442,7 +441,7 @@ void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
viewMatrix, as_MFB(mf), shape);
}
void GrBlurUtils::drawShapeWithMaskFilter(GrContext* context,
void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkPaint& paint,

View File

@ -33,7 +33,7 @@ namespace GrBlurUtils {
/**
* Draw a shape handling the mask filter if present.
*/
void drawShapeWithMaskFilter(GrContext*,
void drawShapeWithMaskFilter(GrRecordingContext*,
GrRenderTargetContext*,
const GrClip&,
const SkPaint&,

View File

@ -70,6 +70,7 @@ bool GrContext::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFac
return false;
}
SkASSERT(this->drawingManager());
SkASSERT(this->caps());
SkASSERT(this->getGlyphCache());
SkASSERT(this->getTextBlobCache());
@ -86,41 +87,6 @@ bool GrContext::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFac
fDidTestPMConversions = false;
GrPathRendererChain::Options prcOptions;
prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching;
#if GR_TEST_UTILS
prcOptions.fGpuPathRenderers = this->options().fGpuPathRenderers;
#endif
if (this->options().fDisableCoverageCountingPaths) {
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kCoverageCounting;
}
if (this->options().fDisableDistanceFieldPaths) {
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall;
}
if (!fResourceCache) {
// DDL TODO: remove this crippling of the path renderer chain
// Disable the small path renderer bc of the proxies in the atlas. They need to be
// unified when the opLists are added back to the destination drawing manager.
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall;
}
GrTextContext::Options textContextOptions;
textContextOptions.fMaxDistanceFieldFontSize = this->options().fGlyphsAsPathsFontSize;
textContextOptions.fMinDistanceFieldFontSize = this->options().fMinDistanceFieldFontSize;
textContextOptions.fDistanceFieldVerticesAlwaysHaveW = false;
#if SK_SUPPORT_ATLAS_TEXT
if (GrContextOptions::Enable::kYes == this->options().fDistanceFieldGlyphVerticesAlwaysHaveW) {
textContextOptions.fDistanceFieldVerticesAlwaysHaveW = true;
}
#endif
fDrawingManager.reset(new GrDrawingManager(this, prcOptions, textContextOptions,
this->singleOwner(),
this->explicitlyAllocateGPUResources(),
this->options().fSortRenderTargets,
this->options().fReduceOpListSplitting));
// DDL TODO: we need to think through how the task group & persistent cache
// get passed on to/shared between all the DDLRecorders created with this context.
if (this->options().fExecutor) {
@ -136,10 +102,6 @@ sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() {
return fThreadSafeProxy;
}
GrDrawingManager* GrContext::drawingManager() {
return fDrawingManager.get();
}
//////////////////////////////////////////////////////////////////////////////
void GrContext::abandonContext() {

View File

@ -61,8 +61,6 @@ public:
SkDEBUGCODE(GrSingleOwner* singleOwner() const { return fContext->singleOwner(); } )
// from GrRecordingContext
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
GrDrawingManager* drawingManager() { return fContext->drawingManager(); }
sk_sp<GrOpMemoryPool> refOpMemoryPool();

View File

@ -6,13 +6,15 @@
*/
#include "GrDrawingManager.h"
#include "GrBackendSemaphore.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
#include "GrMemoryPool.h"
#include "GrOnFlushResourceProvider.h"
#include "GrOpList.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetProxy.h"
#include "GrResourceAllocator.h"
@ -145,7 +147,7 @@ void GrDrawingManager::OpListDAG::cleanup(const GrCaps* caps) {
}
///////////////////////////////////////////////////////////////////////////////////////////////////
GrDrawingManager::GrDrawingManager(GrContext* context,
GrDrawingManager::GrDrawingManager(GrRecordingContext* context,
const GrPathRendererChain::Options& optionsForPathRendererChain,
const GrTextContext::Options& optionsForTextContext,
GrSingleOwner* singleOwner,
@ -290,8 +292,7 @@ GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy*,
bool flushed = false;
{
GrResourceAllocator alloc(fContext->priv().resourceProvider(),
flushState.deinstantiateProxyTracker());
GrResourceAllocator alloc(resourceProvider, flushState.deinstantiateProxyTracker());
for (int i = 0; i < fDAG.numOpLists(); ++i) {
if (fDAG.opList(i)) {
fDAG.opList(i)->gatherProxyIntervals(&alloc);
@ -376,7 +377,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
return false;
}
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
auto resourceProvider = direct->priv().resourceProvider();
bool anyOpListsExecuted = false;
for (int i = startIndex; i < stopIndex; ++i) {

View File

@ -16,10 +16,10 @@
#include "SkTArray.h"
#include "text/GrTextContext.h"
class GrContext;
class GrCoverageCountingPathRenderer;
class GrOnFlushCallbackObject;
class GrOpFlushState;
class GrRecordingContext;
class GrRenderTargetContext;
class GrRenderTargetProxy;
class GrSingleOWner;
@ -53,7 +53,7 @@ public:
sk_sp<GrRenderTargetOpList> newRTOpList(GrRenderTargetProxy* rtp, bool managedOpList);
sk_sp<GrTextureOpList> newTextureOpList(GrTextureProxy* textureProxy);
GrContext* getContext() { return fContext; }
GrRecordingContext* getContext() { return fContext; }
GrTextContext* getTextContext();
@ -134,7 +134,7 @@ private:
bool fSortOpLists;
};
GrDrawingManager(GrContext*, const GrPathRendererChain::Options&,
GrDrawingManager(GrRecordingContext*, const GrPathRendererChain::Options&,
const GrTextContext::Options&, GrSingleOwner*,
bool explicitlyAllocating, GrContextOptions::Enable sortRenderTargets,
GrContextOptions::Enable reduceOpListSplitting);
@ -152,14 +152,15 @@ private:
SkDEBUGCODE(void validate() const);
friend class GrContext; // for access to: ctor, abandon, reset & flush
friend class GrContext; // access to: flush & cleanup
friend class GrContextPriv; // access to: flush
friend class GrOnFlushResourceProvider; // this is just a shallow wrapper around this class
friend class GrRecordingContext; // access to: ctor
static const int kNumPixelGeometries = 5; // The different pixel geometries
static const int kNumDFTOptions = 2; // DFT or no DFT
GrContext* fContext;
GrRecordingContext* fContext;
GrPathRendererChain::Options fOptionsForPathRendererChain;
GrTextContext::Options fOptionsForTextContext;
// This cache is used by both the vertex and index pools. It reuses memory across multiple

View File

@ -6,10 +6,12 @@
*/
#include "GrOnFlushResourceProvider.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
#include "GrProxyProvider.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrSurfaceProxy.h"

View File

@ -7,11 +7,14 @@
#include "GrPathRendererChain.h"
#include "GrCaps.h"
#include "GrShaderCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrShaderCaps.h"
#include "ccpr/GrCoverageCountingPathRenderer.h"
#include "ops/GrAAConvexPathRenderer.h"
#include "ops/GrAAHairLinePathRenderer.h"
@ -22,7 +25,7 @@
#include "ops/GrStencilAndCoverPathRenderer.h"
#include "ops/GrTessellatingPathRenderer.h"
GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& options) {
GrPathRendererChain::GrPathRendererChain(GrRecordingContext* context, const Options& options) {
const GrCaps& caps = *context->priv().caps();
if (options.fGpuPathRenderers & GpuPathRenderers::kDashLine) {
fChain.push_back(sk_make_sp<GrDashLinePathRenderer>());

View File

@ -30,7 +30,7 @@ public:
bool fAllowPathMaskCaching = false;
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll;
};
GrPathRendererChain(GrContext* context, const Options&);
GrPathRendererChain(GrRecordingContext* context, const Options&);
/** Documents how the caller plans to use a GrPathRenderer to draw a path. It affects the PR
returned by getPathRenderer */

View File

@ -60,6 +60,42 @@ bool GrRecordingContext::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCac
fTextBlobCache.reset(new GrTextBlobCache(textblobcache_overbudget_CB, this,
this->contextID()));
GrPathRendererChain::Options prcOptions;
prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching;
#if GR_TEST_UTILS
prcOptions.fGpuPathRenderers = this->options().fGpuPathRenderers;
#endif
if (this->options().fDisableCoverageCountingPaths) {
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kCoverageCounting;
}
if (this->options().fDisableDistanceFieldPaths) {
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall;
}
if (!this->proxyProvider()->renderingDirectly()) {
// DDL TODO: remove this crippling of the path renderer chain
// Disable the small path renderer bc of the proxies in the atlas. They need to be
// unified when the opLists are added back to the destination drawing manager.
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall;
}
GrTextContext::Options textContextOptions;
textContextOptions.fMaxDistanceFieldFontSize = this->options().fGlyphsAsPathsFontSize;
textContextOptions.fMinDistanceFieldFontSize = this->options().fMinDistanceFieldFontSize;
textContextOptions.fDistanceFieldVerticesAlwaysHaveW = false;
#if SK_SUPPORT_ATLAS_TEXT
if (GrContextOptions::Enable::kYes == this->options().fDistanceFieldGlyphVerticesAlwaysHaveW) {
textContextOptions.fDistanceFieldVerticesAlwaysHaveW = true;
}
#endif
fDrawingManager.reset(new GrDrawingManager(this,
prcOptions,
textContextOptions,
this->singleOwner(),
this->explicitlyAllocateGPUResources(),
this->options().fSortRenderTargets,
this->options().fReduceOpListSplitting));
return true;
}
@ -70,6 +106,10 @@ void GrRecordingContext::abandonContext() {
fTextBlobCache->freeAll();
}
GrDrawingManager* GrRecordingContext::drawingManager() {
return fDrawingManager.get();
}
sk_sp<GrOpMemoryPool> GrRecordingContext::refOpMemoryPool() {
if (!fOpMemoryPool) {
// DDL TODO: should the size of the memory pool be decreased in DDL mode? CPU-side memory
@ -177,7 +217,6 @@ sk_sp<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContext
return nullptr;
}
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
auto drawingManager = this->drawingManager();
sk_sp<GrRenderTargetContext> renderTargetContext =

View File

@ -45,8 +45,6 @@ public:
SkDEBUGCODE(GrSingleOwner* singleOwner() const { return fContext->singleOwner(); } )
// from GrRecordingContext
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
GrDrawingManager* drawingManager() { return fContext->drawingManager(); }
sk_sp<GrOpMemoryPool> refOpMemoryPool();

View File

@ -11,6 +11,7 @@
#include "GrAppliedClip.h"
#include "GrBackendSemaphore.h"
#include "GrBlurUtils.h"
#include "GrCaps.h"
#include "GrColor.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
@ -20,6 +21,8 @@
#include "GrOpList.h"
#include "GrPathRenderer.h"
#include "GrQuad.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetContextPriv.h"
#include "GrResourceProvider.h"
@ -80,7 +83,7 @@ public:
void makeGrPaint(GrMaskFormat maskFormat, const SkPaint& skPaint, const SkMatrix& viewMatrix,
GrPaint* grPaint) override {
GrContext* context = fRenderTargetContext->fContext;
auto context = fRenderTargetContext->fContext;
const GrColorSpaceInfo& colorSpaceInfo = fRenderTargetContext->colorSpaceInfo();
if (kARGB_GrMaskFormat == maskFormat) {
SkPaintToGrPaintWithPrimitiveColor(context, colorSpaceInfo, skPaint, grPaint);
@ -89,7 +92,7 @@ public:
}
}
GrContext* getContext() override {
GrRecordingContext* getContext() override {
return fRenderTargetContext->fContext;
}
@ -108,11 +111,11 @@ private:
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
#define ASSERT_SINGLE_OWNER_PRIV \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->singleOwner());)
#define RETURN_IF_ABANDONED if (fContext->abandoned()) { return; }
#define RETURN_IF_ABANDONED_PRIV if (fRenderTargetContext->fContext->abandoned()) { return; }
#define RETURN_FALSE_IF_ABANDONED if (fContext->abandoned()) { return false; }
#define RETURN_FALSE_IF_ABANDONED_PRIV if (fRenderTargetContext->fContext->abandoned()) { return false; }
#define RETURN_NULL_IF_ABANDONED if (fContext->abandoned()) { return nullptr; }
#define RETURN_IF_ABANDONED if (fContext->priv().abandoned()) { return; }
#define RETURN_IF_ABANDONED_PRIV if (fRenderTargetContext->fContext->priv().abandoned()) { return; }
#define RETURN_FALSE_IF_ABANDONED if (fContext->priv().abandoned()) { return false; }
#define RETURN_FALSE_IF_ABANDONED_PRIV if (fRenderTargetContext->fContext->priv().abandoned()) { return false; }
#define RETURN_NULL_IF_ABANDONED if (fContext->priv().abandoned()) { return nullptr; }
//////////////////////////////////////////////////////////////////////////////
@ -156,7 +159,7 @@ private:
// GrOpLists to be picked up and added to by renderTargetContexts lower in the call
// stack. When this occurs with a closed GrOpList, a new one will be allocated
// when the renderTargetContext attempts to use it (via getOpList).
GrRenderTargetContext::GrRenderTargetContext(GrContext* context,
GrRenderTargetContext::GrRenderTargetContext(GrRecordingContext* context,
GrDrawingManager* drawingMgr,
sk_sp<GrRenderTargetProxy> rtp,
sk_sp<SkColorSpace> colorSpace,
@ -2030,7 +2033,7 @@ static void op_bounds(SkRect* bounds, const GrOp* op) {
void GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<GrDrawOp> op,
const std::function<WillAddOpFn>& willAddFn) {
ASSERT_SINGLE_OWNER
if (fContext->abandoned()) {
if (fContext->priv().abandoned()) {
fContext->priv().opMemoryPool()->release(std::move(op));
return;
}

View File

@ -454,7 +454,7 @@ public:
bool isWrapped_ForTesting() const;
protected:
GrRenderTargetContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTargetProxy>,
GrRenderTargetContext(GrRecordingContext*, GrDrawingManager*, sk_sp<GrRenderTargetProxy>,
sk_sp<SkColorSpace>, const SkSurfaceProps*, GrAuditTrail*,
GrSingleOwner*, bool managedOpList = true);

View File

@ -9,18 +9,20 @@
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
#include "GrOpList.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "SkGr.h"
#include "../private/GrAuditTrail.h"
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
#define RETURN_FALSE_IF_ABANDONED if (this->fContext->abandoned()) { return false; }
#define RETURN_FALSE_IF_ABANDONED if (this->fContext->priv().abandoned()) { return false; }
// In MDB mode the reffing of the 'getLastOpList' call's result allows in-progress
// GrOpLists to be picked up and added to by renderTargetContexts lower in the call
// stack. When this occurs with a closed GrOpList, a new one will be allocated
// when the renderTargetContext attempts to use it (via getOpList).
GrSurfaceContext::GrSurfaceContext(GrContext* context,
GrSurfaceContext::GrSurfaceContext(GrRecordingContext* context,
GrDrawingManager* drawingMgr,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,

View File

@ -16,6 +16,7 @@ class GrAuditTrail;
class GrContext;
class GrDrawingManager;
class GrOpList;
class GrRecordingContext;
class GrRenderTargetContext;
class GrRenderTargetProxy;
class GrSingleOwner;
@ -111,7 +112,7 @@ public:
protected:
friend class GrSurfaceContextPriv;
GrSurfaceContext(GrContext*, GrDrawingManager*, GrPixelConfig, sk_sp<SkColorSpace>,
GrSurfaceContext(GrRecordingContext*, GrDrawingManager*, GrPixelConfig, sk_sp<SkColorSpace>,
GrAuditTrail*, GrSingleOwner*);
GrDrawingManager* drawingManager() { return fDrawingManager; }
@ -122,13 +123,13 @@ protected:
SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; })
GrContext* fContext;
GrAuditTrail* fAuditTrail;
GrRecordingContext* fContext;
GrAuditTrail* fAuditTrail;
private:
GrColorSpaceInfo fColorSpaceInfo;
GrColorSpaceInfo fColorSpaceInfo;
GrDrawingManager* fDrawingManager;
GrDrawingManager* fDrawingManager;
// In debug builds we guard against improper thread handling
SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)

View File

@ -15,7 +15,7 @@
additional data members or virtual methods. */
class GrSurfaceContextPriv {
public:
GrContext* getContext() { return fSurfaceContext->fContext; }
GrRecordingContext* getContext() { return fSurfaceContext->fContext; }
private:
explicit GrSurfaceContextPriv(GrSurfaceContext* surfaceContext)

View File

@ -17,7 +17,7 @@
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
#define RETURN_FALSE_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return false; }
GrTextureContext::GrTextureContext(GrContext* context,
GrTextureContext::GrTextureContext(GrRecordingContext* context,
GrDrawingManager* drawingMgr,
sk_sp<GrTextureProxy> textureProxy,
sk_sp<SkColorSpace> colorSpace,

View File

@ -39,7 +39,7 @@ public:
sk_sp<GrRenderTargetProxy> asRenderTargetProxyRef() override;
protected:
GrTextureContext(GrContext*, GrDrawingManager*, sk_sp<GrTextureProxy>,
GrTextureContext(GrRecordingContext*, GrDrawingManager*, sk_sp<GrTextureProxy>,
sk_sp<SkColorSpace>, GrAuditTrail*, GrSingleOwner*);
SkDEBUGCODE(void validate() const override;)

View File

@ -45,7 +45,7 @@ public:
static std::unique_ptr<GrTextContext> Make(const Options& options);
void drawGlyphRunList(GrContext*, GrTextTarget*, const GrClip&,
void drawGlyphRunList(GrRecordingContext*, GrTextTarget*, const GrClip&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkGlyphRunList&);
std::unique_ptr<GrDrawOp> createOp_TestingOnly(GrRecordingContext*,

View File

@ -14,6 +14,7 @@
class GrAtlasTextOp;
class GrClip;
class GrPaint;
class GrRecordingContext;
class GrShape;
class SkGlyphRunListPainter;
class SkMatrix;
@ -37,7 +38,7 @@ public:
virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
GrPaint*) = 0;
virtual GrContext* getContext() = 0;
virtual GrRecordingContext* getContext() = 0;
virtual SkGlyphRunListPainter* glyphPainter() = 0;

View File

@ -165,8 +165,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
test_read_pixels(reporter, rectContext.get(), refPixels, "RectangleTexture-read");
test_copy_to_surface(reporter, context->priv().proxyProvider(),
rectContext.get(), "RectangleTexture-copy-to");
test_copy_to_surface(reporter, context, rectContext.get(), "RectangleTexture-copy-to");
test_write_pixels(reporter, rectContext.get(), true, "RectangleTexture-write");

View File

@ -7,7 +7,7 @@
#include "TestUtils.h"
#include "GrProxyProvider.h"
#include "GrContextPriv.h"
#include "GrSurfaceContext.h"
#include "GrSurfaceContextPriv.h"
#include "GrSurfaceProxy.h"
@ -94,8 +94,10 @@ void test_copy_from_surface(skiatest::Reporter* reporter, GrContext* context,
}
}
void test_copy_to_surface(skiatest::Reporter* reporter, GrProxyProvider* proxyProvider,
GrSurfaceContext* dstContext, const char* testName) {
void test_copy_to_surface(skiatest::Reporter* reporter,
GrContext* context,
GrSurfaceContext* dstContext,
const char* testName) {
int pixelCnt = dstContext->width() * dstContext->height();
SkAutoTMalloc<uint32_t> pixels(pixelCnt);
@ -109,7 +111,7 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrProxyProvider* proxyPr
for (auto isRT : {false, true}) {
for (auto origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
auto src = sk_gpu_test::MakeTextureProxyFromData(
dstContext->surfPriv().getContext(), isRT, dstContext->width(),
context, isRT, dstContext->width(),
dstContext->height(), GrColorType::kRGBA_8888, origin, pixels.get(), 0);
dstContext->copy(src.get());
test_read_pixels(reporter, dstContext, pixels.get(), testName);

View File

@ -29,7 +29,7 @@ void test_copy_from_surface(skiatest::Reporter*, GrContext*,
bool onlyTestRTConfig, const char* testName);
// Ensure that RGBA 8888 pixels can be copied into 'dstContext'
void test_copy_to_surface(skiatest::Reporter*, GrProxyProvider*,
void test_copy_to_surface(skiatest::Reporter*, GrContext*,
GrSurfaceContext* dstContext, const char* testName);
// Fills data with a red-green gradient

View File

@ -14,6 +14,8 @@
#include "GrGpu.h"
#include "GrGpuResourceCacheAccess.h"
#include "GrMemoryPool.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrRenderTargetProxy.h"
@ -188,7 +190,7 @@ DRAW_OP_TEST_EXTERN(TesselatingPathOp);
DRAW_OP_TEST_EXTERN(TextureOp);
void GrDrawRandomOp(SkRandom* random, GrRenderTargetContext* renderTargetContext, GrPaint&& paint) {
GrContext* context = renderTargetContext->surfPriv().getContext();
auto context = renderTargetContext->surfPriv().getContext();
using MakeDrawOpFn = std::unique_ptr<GrDrawOp>(GrPaint&&, SkRandom*,
GrRecordingContext*, GrFSAAType);
static constexpr MakeDrawOpFn* gFactories[] = {

View File

@ -14,11 +14,12 @@
namespace sk_gpu_test {
sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width, int height,
sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT,
int width, int height,
GrColorType colorType, GrSRGBEncoded srgbEncoded,
GrSurfaceOrigin origin, const void* data,
size_t rowBytes) {
if (context->abandoned()) {
if (context->priv().abandoned()) {
return nullptr;
}

View File

@ -14,12 +14,13 @@
namespace sk_gpu_test {
/** Makes a texture proxy containing the passed in color data. */
sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width, int height,
sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext*, bool isRT, int width, int height,
GrColorType, GrSRGBEncoded, GrSurfaceOrigin,
const void* data, size_t rowBytes);
/** Version that assumes GrSRGBEncoded::kNo. */
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width,
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context,
bool isRT, int width,
int height, GrColorType ct,
GrSurfaceOrigin origin, const void* data,
size_t rowBytes) {
@ -28,7 +29,8 @@ inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool i
}
/** Version that takes SkColorType rather than GrColorType and assumes GrSRGBEncoded::kNo. */
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width,
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context,
bool isRT, int width,
int height, SkColorType ct,
GrSurfaceOrigin origin, const void* data,
size_t rowBytes) {