Switch path renderers over to using GrRecordingContext

The path renderers convert paths into Ganesh ops when recording so should also be able to make due with only the GrRecordingContext.

Change-Id: Ie796af73ca5aa2a074ebd037d6d558ec85ff5928
Reviewed-on: https://skia-review.googlesource.com/c/191568
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Robert Phillips 2019-02-13 11:02:28 -05:00 committed by Skia Commit-Bot
parent b6f5378333
commit 6f0e02f5d7
20 changed files with 236 additions and 143 deletions

View File

@ -152,7 +152,7 @@ public:
AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) : fMask(mask), fX(x), fY(y) {}
private:
bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
bool apply(GrRecordingContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
SkRect* bounds) const override {
int w = fMask->width();
int h = fMask->height();

View File

@ -53,6 +53,24 @@ protected:
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted = SkBudgeted::kYes);
/*
* This method will attempt to create a renderTargetContext that has, at least, the number of
* channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
* converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
* SRGB-ness will be preserved.
*/
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt = 1,
GrMipMapped = GrMipMapped::kNo,
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted budgeted = SkBudgeted::kYes);
GrAuditTrail* auditTrail() { return &fAuditTrail; }
GrRecordingContext* asRecordingContext() override { return this; }

View File

@ -35,7 +35,7 @@ public:
* conservative bounds of the clip. A return value of false indicates that the draw can be
* skipped as it is fully clipped out.
*/
virtual bool apply(GrContext*, GrRenderTargetContext*, bool useHWAA,
virtual bool apply(GrRecordingContext*, GrRenderTargetContext*, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip*, SkRect* bounds) const = 0;
virtual ~GrClip() {}
@ -147,8 +147,8 @@ public:
virtual bool apply(int rtWidth, int rtHeight, GrAppliedHardClip* out, SkRect* bounds) const = 0;
private:
bool apply(GrContext*, GrRenderTargetContext* rtc, bool useHWAA, bool hasUserStencilSettings,
GrAppliedClip* out, SkRect* bounds) const final {
bool apply(GrRecordingContext*, GrRenderTargetContext* rtc, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const final {
return this->apply(rtc->width(), rtc->height(), &out->hardClip(), bounds);
}
};

View File

@ -7,12 +7,12 @@
#include "GrClipStackClip.h"
#include "GrAppliedClip.h"
#include "GrContextPriv.h"
#include "GrDeferredProxyUploader.h"
#include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
#include "GrProxyProvider.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContextPriv.h"
#include "GrSWMaskHelper.h"
#include "GrShape.h"
@ -87,7 +87,7 @@ static std::unique_ptr<GrFragmentProcessor> create_fp_for_mask(sk_sp<GrTexturePr
// Does the path in 'element' require SW rendering? If so, return true (and,
// optionally, set 'prOut' to NULL. If not, return false (and, optionally, set
// 'prOut' to the non-SW path renderer that will do the job).
bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
bool GrClipStackClip::PathNeedsSWRenderer(GrRecordingContext* context,
const SkIRect& scissorRect,
bool hasUserStencilSettings,
const GrRenderTargetContext* renderTargetContext,
@ -146,7 +146,7 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
* will be used on any element. If so, it returns true to indicate that the
* entire clip should be rendered in SW and then uploaded en masse to the gpu.
*/
bool GrClipStackClip::UseSWOnlyPath(GrContext* context,
bool GrClipStackClip::UseSWOnlyPath(GrRecordingContext* context,
bool hasUserStencilSettings,
const GrRenderTargetContext* renderTargetContext,
const GrReducedClip& reducedClip) {
@ -189,7 +189,7 @@ bool GrClipStackClip::UseSWOnlyPath(GrContext* context,
////////////////////////////////////////////////////////////////////////////////
// sort out what kind of clip mask needs to be created: alpha, stencil,
// scissor, or entirely software
bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTargetContext,
bool GrClipStackClip::apply(GrRecordingContext* context, GrRenderTargetContext* renderTargetContext,
bool useHWAA, bool hasUserStencilSettings, GrAppliedClip* out,
SkRect* bounds) const {
SkRect devBounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
@ -249,7 +249,8 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar
return true;
}
bool GrClipStackClip::applyClipMask(GrContext* context, GrRenderTargetContext* renderTargetContext,
bool GrClipStackClip::applyClipMask(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrReducedClip& reducedClip, bool hasUserStencilSettings,
GrAppliedClip* out) const {
#ifdef SK_DEBUG
@ -322,7 +323,7 @@ static void create_clip_mask_key(uint32_t clipGenID, const SkIRect& bounds, int
builder[3] = numAnalyticFPs;
}
static void add_invalidate_on_pop_message(GrContext* context,
static void add_invalidate_on_pop_message(GrRecordingContext* context,
const SkClipStack& stack, uint32_t clipGenID,
const GrUniqueKey& clipMaskKey) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
@ -337,7 +338,7 @@ static void add_invalidate_on_pop_message(GrContext* context,
SkDEBUGFAIL("Gen ID was not found in stack.");
}
sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrRecordingContext* context,
const GrReducedClip& reducedClip) const {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
GrUniqueKey key;
@ -457,7 +458,7 @@ static void draw_clip_elements_to_mask_helper(GrSWMaskHelper& helper, const Elem
}
sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
GrContext* context, const GrReducedClip& reducedClip,
GrRecordingContext* context, const GrReducedClip& reducedClip,
GrRenderTargetContext* renderTargetContext) const {
GrUniqueKey key;
create_clip_mask_key(reducedClip.maskGenID(), reducedClip.scissor(),
@ -475,7 +476,11 @@ sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
// left corner of the resulting rect to the top left of the texture.
SkIRect maskSpaceIBounds = SkIRect::MakeWH(reducedClip.width(), reducedClip.height());
SkTaskGroup* taskGroup = context->priv().getTaskGroup();
SkTaskGroup* taskGroup = nullptr;
if (auto direct = context->priv().asDirectContext()) {
taskGroup = direct->priv().getTaskGroup();
}
if (taskGroup && renderTargetContext) {
// Create our texture proxy
GrSurfaceDesc desc;

View File

@ -28,8 +28,8 @@ public:
bool quickContains(const SkRRect&) const final;
void getConservativeBounds(int width, int height, SkIRect* devResult,
bool* isIntersectionOfRects) const final;
bool apply(GrContext*, GrRenderTargetContext*, bool useHWAA, bool hasUserStencilSettings,
GrAppliedClip* out, SkRect* bounds) const final;
bool apply(GrRecordingContext*, GrRenderTargetContext*, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const final;
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA* aa) const override;
@ -37,7 +37,7 @@ public:
static const char kMaskTestTag[];
private:
static bool PathNeedsSWRenderer(GrContext* context,
static bool PathNeedsSWRenderer(GrRecordingContext* context,
const SkIRect& scissorRect,
bool hasUserStencilSettings,
const GrRenderTargetContext*,
@ -46,18 +46,18 @@ private:
GrPathRenderer** prOut,
bool needsStencil);
bool applyClipMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&,
bool applyClipMask(GrRecordingContext*, GrRenderTargetContext*, const GrReducedClip&,
bool hasUserStencilSettings, GrAppliedClip*) const;
// Creates an alpha mask of the clip. The mask is a rasterization of elements through the
// rect specified by clipSpaceIBounds.
sk_sp<GrTextureProxy> createAlphaClipMask(GrContext*, const GrReducedClip&) const;
sk_sp<GrTextureProxy> createAlphaClipMask(GrRecordingContext*, const GrReducedClip&) const;
// Similar to createAlphaClipMask but it rasterizes in SW and uploads to the result texture.
sk_sp<GrTextureProxy> createSoftwareClipMask(GrContext*, const GrReducedClip&,
sk_sp<GrTextureProxy> createSoftwareClipMask(GrRecordingContext*, const GrReducedClip&,
GrRenderTargetContext*) const;
static bool UseSWOnlyPath(GrContext*,
static bool UseSWOnlyPath(GrRecordingContext*,
bool hasUserStencilSettings,
const GrRenderTargetContext*,
const GrReducedClip&);

View File

@ -44,21 +44,38 @@ sk_sp<GrOpMemoryPool> GrContextPriv::refOpMemoryPool() {
}
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrMipMapped mipMapped,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrMipMapped mipMapped,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
return fContext->makeDeferredRenderTargetContext(format, fit, width, height, config,
std::move(colorSpace), sampleCnt, mipMapped,
origin, surfaceProps, budgeted);
}
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrMipMapped mipMapped,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
return fContext->makeDeferredRenderTargetContextWithFallback(format, fit, width, height, config,
std::move(colorSpace), sampleCnt,
mipMapped, origin, surfaceProps,
budgeted);
}
sk_sp<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy> proxy,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props) {
@ -685,62 +702,6 @@ void GrContextPriv::copyOpListsFromDDL(const SkDeferredDisplayList* ddl,
fContext->fDrawingManager->copyOpListsFromDDL(ddl, newDest);
}
static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
switch (config) {
case kAlpha_8_GrPixelConfig:
case kAlpha_8_as_Alpha_GrPixelConfig:
case kAlpha_8_as_Red_GrPixelConfig:
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
case kBGRA_8888_GrPixelConfig:
case kRGBA_1010102_GrPixelConfig:
case kRGBA_half_GrPixelConfig:
return kRGBA_8888_GrPixelConfig;
case kSBGRA_8888_GrPixelConfig:
return kSRGBA_8888_GrPixelConfig;
case kAlpha_half_GrPixelConfig:
case kAlpha_half_as_Red_GrPixelConfig:
return kRGBA_half_GrPixelConfig;
case kGray_8_GrPixelConfig:
case kGray_8_as_Lum_GrPixelConfig:
case kGray_8_as_Red_GrPixelConfig:
return kRGB_888_GrPixelConfig;
default:
return kUnknown_GrPixelConfig;
}
}
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrMipMapped mipMapped,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
GrBackendFormat localFormat = format;
SkASSERT(sampleCnt > 0);
if (0 == fContext->priv().caps()->getRenderTargetSampleCount(sampleCnt, config)) {
config = GrPixelConfigFallback(config);
// TODO: First we should be checking the getRenderTargetSampleCount from the GrBackendFormat
// and not GrPixelConfig. Besides that, we should implement the fallback in the caps, but
// for now we just convert the fallback pixel config to an SkColorType and then get the
// GrBackendFormat from that.
SkColorType colorType;
if (!GrPixelConfigToColorType(config, &colorType)) {
return nullptr;
}
localFormat = fContext->caps()->getBackendFormatFromColorType(colorType);
}
return this->makeDeferredRenderTargetContext(localFormat, fit, width, height, config,
std::move(colorSpace), sampleCnt, mipMapped,
origin, surfaceProps, budgeted);
}
//////////////////////////////////////////////////////////////////////////////
#ifdef SK_ENABLE_DUMP_GPU
#include "SkJSONWriter.h"

View File

@ -53,6 +53,10 @@ 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();
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
@ -73,6 +77,24 @@ public:
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted = SkBudgeted::kYes);
/*
* This method will attempt to create a renderTargetContext that has, at least, the number of
* channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
* converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
* SRGB-ness will be preserved.
*/
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt = 1,
GrMipMapped = GrMipMapped::kNo,
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted budgeted = SkBudgeted::kYes);
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
/**
@ -80,8 +102,6 @@ public:
*/
static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&);
GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); }
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
sk_sp<SkColorSpace> = nullptr,
const SkSurfaceProps* = nullptr);
@ -248,24 +268,6 @@ public:
void moveOpListsToDDL(SkDeferredDisplayList*);
void copyOpListsFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest);
/*
* This method will attempt to create a renderTargetContext that has, at least, the number of
* channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
* converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
* SRGB-ness will be preserved.
*/
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt = 1,
GrMipMapped = GrMipMapped::kNo,
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted budgeted = SkBudgeted::kYes);
GrContextOptions::PersistentCache* getPersistentCache() { return fContext->fPersistentCache; }
#ifdef SK_ENABLE_DUMP_GPU

View File

@ -7,8 +7,8 @@
#include "GrPathRenderer.h"
#include "GrCaps.h"
#include "GrContextPriv.h"
#include "GrPaint.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrShape.h"
#include "GrUserStencilSettings.h"

View File

@ -14,10 +14,10 @@
class GrCaps;
class GrClip;
class GrContext;
class GrFixedClip;
class GrHardClip;
class GrPaint;
class GrRecordingContext;
class GrRenderTargetContext;
class GrShape;
class GrStyle;
@ -106,7 +106,7 @@ public:
}
struct DrawPathArgs {
GrContext* fContext;
GrRecordingContext* fContext;
GrPaint&& fPaint;
const GrUserStencilSettings* fUserStencilSettings;
GrRenderTargetContext* fRenderTargetContext;
@ -140,7 +140,7 @@ public:
struct StencilPathArgs {
SkDEBUGCODE(StencilPathArgs() { memset(this, 0, sizeof(*this)); }) // For validation.
GrContext* fContext;
GrRecordingContext* fContext;
GrRenderTargetContext* fRenderTargetContext;
const GrHardClip* fClip;
const SkIRect* fClipConservativeBounds;

View File

@ -14,6 +14,7 @@
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrSkSLFPFactoryCache.h"
#include "SkGr.h"
GrRecordingContext::GrRecordingContext(GrBackendApi backend,
const GrContextOptions& options,
@ -91,6 +92,62 @@ sk_sp<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContext
return renderTargetContext;
}
static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
switch (config) {
case kAlpha_8_GrPixelConfig:
case kAlpha_8_as_Alpha_GrPixelConfig:
case kAlpha_8_as_Red_GrPixelConfig:
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
case kBGRA_8888_GrPixelConfig:
case kRGBA_1010102_GrPixelConfig:
case kRGBA_half_GrPixelConfig:
return kRGBA_8888_GrPixelConfig;
case kSBGRA_8888_GrPixelConfig:
return kSRGBA_8888_GrPixelConfig;
case kAlpha_half_GrPixelConfig:
case kAlpha_half_as_Red_GrPixelConfig:
return kRGBA_half_GrPixelConfig;
case kGray_8_GrPixelConfig:
case kGray_8_as_Lum_GrPixelConfig:
case kGray_8_as_Red_GrPixelConfig:
return kRGB_888_GrPixelConfig;
default:
return kUnknown_GrPixelConfig;
}
}
sk_sp<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrMipMapped mipMapped,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
GrBackendFormat localFormat = format;
SkASSERT(sampleCnt > 0);
if (0 == this->caps()->getRenderTargetSampleCount(sampleCnt, config)) {
config = GrPixelConfigFallback(config);
// TODO: First we should be checking the getRenderTargetSampleCount from the GrBackendFormat
// and not GrPixelConfig. Besides that, we should implement the fallback in the caps, but
// for now we just convert the fallback pixel config to an SkColorType and then get the
// GrBackendFormat from that.
SkColorType colorType;
if (!GrPixelConfigToColorType(config, &colorType)) {
return nullptr;
}
localFormat = this->caps()->getBackendFormatFromColorType(colorType);
}
return this->makeDeferredRenderTargetContext(localFormat, fit, width, height, config,
std::move(colorSpace), sampleCnt, mipMapped,
origin, surfaceProps, budgeted);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<const GrCaps> GrRecordingContextPriv::refCaps() const {
return fContext->refCaps();
@ -119,3 +176,20 @@ sk_sp<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetCon
std::move(colorSpace), sampleCnt, mipMapped,
origin, surfaceProps, budgeted);
}
sk_sp<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrMipMapped mipMapped,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
return fContext->makeDeferredRenderTargetContextWithFallback(format, fit, width, height, config,
std::move(colorSpace), sampleCnt,
mipMapped, origin, surfaceProps,
budgeted);
}

View File

@ -41,6 +41,10 @@ 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();
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
@ -61,6 +65,24 @@ public:
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted = SkBudgeted::kYes);
/*
* This method will attempt to create a renderTargetContext that has, at least, the number of
* channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
* converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
* SRGB-ness will be preserved.
*/
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
const GrBackendFormat& format,
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
sk_sp<SkColorSpace> colorSpace,
int sampleCnt = 1,
GrMipMapped = GrMipMapped::kNo,
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
const SkSurfaceProps* surfaceProps = nullptr,
SkBudgeted budgeted = SkBudgeted::kYes);
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
private:

View File

@ -9,10 +9,10 @@
#include "GrAppliedClip.h"
#include "GrClip.h"
#include "GrColor.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrPathRenderer.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrShape.h"
@ -809,7 +809,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
////////////////////////////////////////////////////////////////////////////////
// Create a 1-bit clip mask in the stencil buffer.
bool GrReducedClip::drawStencilClipMask(GrContext* context,
bool GrReducedClip::drawStencilClipMask(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext) const {
// We set the current clip to the bounds so that our recursive draws are scissored to them.
GrStencilClip stencilClip(fScissor, this->maskGenID());

View File

@ -13,8 +13,8 @@
#include "SkClipStack.h"
#include "SkTLList.h"
class GrContext;
class GrCoverageCountingPathRenderer;
class GrRecordingContext;
class GrRenderTargetContext;
/**
@ -83,7 +83,7 @@ public:
bool maskRequiresAA() const { SkASSERT(!fMaskElements.isEmpty()); return fMaskRequiresAA; }
bool drawAlphaClipMask(GrRenderTargetContext*) const;
bool drawStencilClipMask(GrContext*, GrRenderTargetContext*) const;
bool drawStencilClipMask(GrRecordingContext*, GrRenderTargetContext*) const;
int numAnalyticFPs() const { return fAnalyticFPs.count() + fCCPRClipPaths.count(); }

View File

@ -7,9 +7,9 @@
#include "GrSWMaskHelper.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrProxyProvider.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrShape.h"
#include "GrSurfaceContext.h"
#include "GrTextureProxy.h"
@ -91,7 +91,8 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds) {
return true;
}
sk_sp<GrTextureProxy> GrSWMaskHelper::toTextureProxy(GrContext* context, SkBackingFit fit) {
sk_sp<GrTextureProxy> GrSWMaskHelper::toTextureProxy(GrRecordingContext* context,
SkBackingFit fit) {
SkImageInfo ii = SkImageInfo::MakeA8(fPixels->width(), fPixels->height());
size_t rowBytes = fPixels->rowBytes();
@ -108,7 +109,7 @@ sk_sp<GrTextureProxy> GrSWMaskHelper::toTextureProxy(GrContext* context, SkBacki
// TODO: http://skbug.com/8422: Although this fixes http://skbug.com/8351, it seems like these
// should just participate in the normal allocation process and not need the pending IO flag.
auto surfaceFlags = GrInternalSurfaceFlags::kNone;
if (!context->priv().resourceProvider()) {
if (!context->priv().proxyProvider()->renderingDirectly()) {
// In DDL mode, this texture proxy will be instantiated at flush time, therfore it cannot
// have pending IO.
surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;

View File

@ -17,6 +17,7 @@
#include "SkTypes.h"
class GrShape;
class GrRecordingContext;
class GrTextureProxy;
/**
@ -50,7 +51,7 @@ public:
// Draw a single path into the accumuation bitmap using the specified op
void drawShape(const GrShape&, const SkMatrix& matrix, SkRegion::Op op, GrAA, uint8_t alpha);
sk_sp<GrTextureProxy> toTextureProxy(GrContext*, SkBackingFit fit);
sk_sp<GrTextureProxy> toTextureProxy(GrRecordingContext*, SkBackingFit fit);
// Reset the internal bitmap
void clear(uint8_t alpha) {

View File

@ -8,12 +8,12 @@
#include "GrSoftwarePathRenderer.h"
#include "GrAuditTrail.h"
#include "GrClip.h"
#include "GrContextPriv.h"
#include "GrDeferredProxyUploader.h"
#include "GrGpuResourcePriv.h"
#include "GrOpFlushState.h"
#include "GrOpList.h"
#include "GrProxyProvider.h"
#include "GrRecordingContextPriv.h"
#include "GrSWMaskHelper.h"
#include "GrShape.h"
#include "GrSurfaceContextPriv.h"
@ -172,7 +172,8 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask(
dstRect, invert);
}
static sk_sp<GrTextureProxy> make_deferred_mask_texture_proxy(GrContext* context, SkBackingFit fit,
static sk_sp<GrTextureProxy> make_deferred_mask_texture_proxy(GrRecordingContext* context,
SkBackingFit fit,
int width, int height) {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
@ -331,7 +332,11 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
GrAA aa = GrAAType::kCoverage == args.fAAType ? GrAA::kYes : GrAA::kNo;
SkTaskGroup* taskGroup = args.fContext->priv().getTaskGroup();
SkTaskGroup* taskGroup = nullptr;
if (auto direct = args.fContext->priv().asDirectContext()) {
taskGroup = direct->priv().getTaskGroup();
}
if (taskGroup) {
proxy = make_deferred_mask_texture_proxy(args.fContext, fit,
boundsForMask->width(),

View File

@ -7,10 +7,10 @@
#include "GrCCDrawPathsOp.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrMemoryPool.h"
#include "GrOpFlushState.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "ccpr/GrCCPathCache.h"
#include "ccpr/GrCCPerFlushResources.h"
#include "ccpr/GrCoverageCountingPathRenderer.h"
@ -26,8 +26,8 @@ static bool has_coord_transforms(const GrPaint& paint) {
}
std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(
GrContext* context, const SkIRect& clipIBounds, const SkMatrix& m, const GrShape& shape,
GrPaint&& paint) {
GrRecordingContext* context, const SkIRect& clipIBounds, const SkMatrix& m,
const GrShape& shape, GrPaint&& paint) {
SkRect conservativeDevBounds;
m.mapRect(&conservativeDevBounds, shape.bounds());
@ -75,8 +75,9 @@ std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(
}
std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::InternalMake(
GrContext* context, const SkIRect& clipIBounds, const SkMatrix& m, const GrShape& shape,
float strokeDevWidth, const SkRect& conservativeDevBounds, GrPaint&& paint) {
GrRecordingContext* context, const SkIRect& clipIBounds, const SkMatrix& m,
const GrShape& shape, float strokeDevWidth, const SkRect& conservativeDevBounds,
GrPaint&& paint) {
// The path itself should have been cropped if larger than kPathCropThreshold. If it had a
// stroke, that would have further inflated its draw bounds.
SkASSERT(SkTMax(conservativeDevBounds.height(), conservativeDevBounds.width()) <

View File

@ -14,11 +14,12 @@
#include "ccpr/GrCCPathCache.h"
#include "ops/GrDrawOp.h"
class GrCCAtlas;
class GrCCPerFlushResources;
struct GrCCPerFlushResourceSpecs;
struct GrCCPerOpListPaths;
class GrCCAtlas;
class GrOnFlushResourceProvider;
class GrCCPerFlushResources;
class GrRecordingContext;
/**
* This is the Op that draws paths to the actual canvas, using atlases generated by CCPR.
@ -28,7 +29,7 @@ public:
DEFINE_OP_CLASS_ID
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrCCDrawPathsOp);
static std::unique_ptr<GrCCDrawPathsOp> Make(GrContext*, const SkIRect& clipIBounds,
static std::unique_ptr<GrCCDrawPathsOp> Make(GrRecordingContext*, const SkIRect& clipIBounds,
const SkMatrix&, const GrShape&, GrPaint&&);
~GrCCDrawPathsOp() override;
@ -68,7 +69,8 @@ public:
private:
friend class GrOpMemoryPool;
static std::unique_ptr<GrCCDrawPathsOp> InternalMake(GrContext*, const SkIRect& clipIBounds,
static std::unique_ptr<GrCCDrawPathsOp> InternalMake(GrRecordingContext*,
const SkIRect& clipIBounds,
const SkMatrix&, const GrShape&,
float strokeDevWidth,
const SkRect& conservativeDevBounds,

View File

@ -8,12 +8,12 @@
#include "SkTypes.h"
#include "Test.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrClip.h"
#include "GrDrawingManager.h"
#include "GrPathRenderer.h"
#include "GrPaint.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrShape.h"
@ -36,8 +36,8 @@ public:
CCPRClip(GrCoverageCountingPathRenderer* ccpr, const SkPath& path) : fCCPR(ccpr), fPath(path) {}
private:
bool apply(GrContext* context, GrRenderTargetContext* rtc, bool, bool, GrAppliedClip* out,
SkRect* bounds) const override {
bool apply(GrRecordingContext* context, GrRenderTargetContext* rtc, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const override {
out->addCoverageFP(fCCPR->makeClipProcessor(rtc->priv().testingOnly_getOpListID(), fPath,
SkIRect::MakeWH(rtc->width(), rtc->height()),
rtc->width(), rtc->height(),

View File

@ -8,10 +8,10 @@
#include "Test.h"
#include "GrClip.h"
#include "GrContextPriv.h"
#include "GrMemoryPool.h"
#include "GrOnFlushResourceProvider.h"
#include "GrProxyProvider.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrSurfaceProxy.h"
@ -55,7 +55,7 @@ public:
public:
DEFINE_OP_CLASS_ID
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
static std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
GrProxyProvider* proxyProvider,
LazyProxyTest* test,
bool nullTexture) {
@ -76,7 +76,8 @@ public:
private:
friend class GrOpMemoryPool; // for ctor
Op(GrContext* ctx, GrProxyProvider* proxyProvider, LazyProxyTest* test, bool nullTexture)
Op(GrRecordingContext* ctx, GrProxyProvider* proxyProvider,
LazyProxyTest* test, bool nullTexture)
: GrDrawOp(ClassID()), fTest(test) {
const GrBackendFormat format =
ctx->priv().caps()->getBackendFormatFromColorType(kRGB_565_SkColorType);
@ -119,7 +120,7 @@ public:
class ClipFP : public GrFragmentProcessor {
public:
ClipFP(GrContext* ctx, GrProxyProvider* proxyProvider, LazyProxyTest* test,
ClipFP(GrRecordingContext* ctx, GrProxyProvider* proxyProvider, LazyProxyTest* test,
GrTextureProxy* atlas)
: GrFragmentProcessor(kTestFP_ClassID, kNone_OptimizationFlags)
, fContext(ctx)
@ -158,7 +159,7 @@ public:
bool onIsEqual(const GrFragmentProcessor&) const override { return false; }
const TextureSampler& onTextureSampler(int) const override { return fAccess; }
GrContext* const fContext;
GrRecordingContext* const fContext;
GrProxyProvider* const fProxyProvider;
LazyProxyTest* const fTest;
GrTextureProxy* const fAtlas;
@ -174,8 +175,8 @@ public:
, fAtlas(atlas) {}
private:
bool apply(GrContext* context, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
SkRect* bounds) const override {
bool apply(GrRecordingContext* context, GrRenderTargetContext*, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const override {
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
out->addCoverageFP(skstd::make_unique<ClipFP>(context, proxyProvider, fTest, fAtlas));
return true;