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:
parent
b6f5378333
commit
6f0e02f5d7
@ -152,7 +152,7 @@ public:
|
|||||||
AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) : fMask(mask), fX(x), fY(y) {}
|
AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) : fMask(mask), fX(x), fY(y) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
|
bool apply(GrRecordingContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
|
||||||
SkRect* bounds) const override {
|
SkRect* bounds) const override {
|
||||||
int w = fMask->width();
|
int w = fMask->width();
|
||||||
int h = fMask->height();
|
int h = fMask->height();
|
||||||
|
@ -53,6 +53,24 @@ protected:
|
|||||||
const SkSurfaceProps* surfaceProps = nullptr,
|
const SkSurfaceProps* surfaceProps = nullptr,
|
||||||
SkBudgeted = SkBudgeted::kYes);
|
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; }
|
GrAuditTrail* auditTrail() { return &fAuditTrail; }
|
||||||
|
|
||||||
GrRecordingContext* asRecordingContext() override { return this; }
|
GrRecordingContext* asRecordingContext() override { return this; }
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
* conservative bounds of the clip. A return value of false indicates that the draw can be
|
* conservative bounds of the clip. A return value of false indicates that the draw can be
|
||||||
* skipped as it is fully clipped out.
|
* 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;
|
bool hasUserStencilSettings, GrAppliedClip*, SkRect* bounds) const = 0;
|
||||||
|
|
||||||
virtual ~GrClip() {}
|
virtual ~GrClip() {}
|
||||||
@ -147,8 +147,8 @@ public:
|
|||||||
virtual bool apply(int rtWidth, int rtHeight, GrAppliedHardClip* out, SkRect* bounds) const = 0;
|
virtual bool apply(int rtWidth, int rtHeight, GrAppliedHardClip* out, SkRect* bounds) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool apply(GrContext*, GrRenderTargetContext* rtc, bool useHWAA, bool hasUserStencilSettings,
|
bool apply(GrRecordingContext*, GrRenderTargetContext* rtc, bool useHWAA,
|
||||||
GrAppliedClip* out, SkRect* bounds) const final {
|
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const final {
|
||||||
return this->apply(rtc->width(), rtc->height(), &out->hardClip(), bounds);
|
return this->apply(rtc->width(), rtc->height(), &out->hardClip(), bounds);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
#include "GrClipStackClip.h"
|
#include "GrClipStackClip.h"
|
||||||
#include "GrAppliedClip.h"
|
#include "GrAppliedClip.h"
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrDeferredProxyUploader.h"
|
#include "GrDeferredProxyUploader.h"
|
||||||
#include "GrDrawingManager.h"
|
#include "GrDrawingManager.h"
|
||||||
#include "GrFixedClip.h"
|
#include "GrFixedClip.h"
|
||||||
#include "GrGpuResourcePriv.h"
|
#include "GrGpuResourcePriv.h"
|
||||||
#include "GrProxyProvider.h"
|
#include "GrProxyProvider.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrRenderTargetContextPriv.h"
|
#include "GrRenderTargetContextPriv.h"
|
||||||
#include "GrSWMaskHelper.h"
|
#include "GrSWMaskHelper.h"
|
||||||
#include "GrShape.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,
|
// 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
|
// optionally, set 'prOut' to NULL. If not, return false (and, optionally, set
|
||||||
// 'prOut' to the non-SW path renderer that will do the job).
|
// '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,
|
const SkIRect& scissorRect,
|
||||||
bool hasUserStencilSettings,
|
bool hasUserStencilSettings,
|
||||||
const GrRenderTargetContext* renderTargetContext,
|
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
|
* 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.
|
* 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,
|
bool hasUserStencilSettings,
|
||||||
const GrRenderTargetContext* renderTargetContext,
|
const GrRenderTargetContext* renderTargetContext,
|
||||||
const GrReducedClip& reducedClip) {
|
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,
|
// sort out what kind of clip mask needs to be created: alpha, stencil,
|
||||||
// scissor, or entirely software
|
// scissor, or entirely software
|
||||||
bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTargetContext,
|
bool GrClipStackClip::apply(GrRecordingContext* context, GrRenderTargetContext* renderTargetContext,
|
||||||
bool useHWAA, bool hasUserStencilSettings, GrAppliedClip* out,
|
bool useHWAA, bool hasUserStencilSettings, GrAppliedClip* out,
|
||||||
SkRect* bounds) const {
|
SkRect* bounds) const {
|
||||||
SkRect devBounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
|
SkRect devBounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
|
||||||
@ -249,7 +249,8 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrClipStackClip::applyClipMask(GrContext* context, GrRenderTargetContext* renderTargetContext,
|
bool GrClipStackClip::applyClipMask(GrRecordingContext* context,
|
||||||
|
GrRenderTargetContext* renderTargetContext,
|
||||||
const GrReducedClip& reducedClip, bool hasUserStencilSettings,
|
const GrReducedClip& reducedClip, bool hasUserStencilSettings,
|
||||||
GrAppliedClip* out) const {
|
GrAppliedClip* out) const {
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
@ -322,7 +323,7 @@ static void create_clip_mask_key(uint32_t clipGenID, const SkIRect& bounds, int
|
|||||||
builder[3] = numAnalyticFPs;
|
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 SkClipStack& stack, uint32_t clipGenID,
|
||||||
const GrUniqueKey& clipMaskKey) {
|
const GrUniqueKey& clipMaskKey) {
|
||||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
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.");
|
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 {
|
const GrReducedClip& reducedClip) const {
|
||||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
@ -457,7 +458,7 @@ static void draw_clip_elements_to_mask_helper(GrSWMaskHelper& helper, const Elem
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
|
sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
|
||||||
GrContext* context, const GrReducedClip& reducedClip,
|
GrRecordingContext* context, const GrReducedClip& reducedClip,
|
||||||
GrRenderTargetContext* renderTargetContext) const {
|
GrRenderTargetContext* renderTargetContext) const {
|
||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
create_clip_mask_key(reducedClip.maskGenID(), reducedClip.scissor(),
|
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.
|
// left corner of the resulting rect to the top left of the texture.
|
||||||
SkIRect maskSpaceIBounds = SkIRect::MakeWH(reducedClip.width(), reducedClip.height());
|
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) {
|
if (taskGroup && renderTargetContext) {
|
||||||
// Create our texture proxy
|
// Create our texture proxy
|
||||||
GrSurfaceDesc desc;
|
GrSurfaceDesc desc;
|
||||||
|
@ -28,8 +28,8 @@ public:
|
|||||||
bool quickContains(const SkRRect&) const final;
|
bool quickContains(const SkRRect&) const final;
|
||||||
void getConservativeBounds(int width, int height, SkIRect* devResult,
|
void getConservativeBounds(int width, int height, SkIRect* devResult,
|
||||||
bool* isIntersectionOfRects) const final;
|
bool* isIntersectionOfRects) const final;
|
||||||
bool apply(GrContext*, GrRenderTargetContext*, bool useHWAA, bool hasUserStencilSettings,
|
bool apply(GrRecordingContext*, GrRenderTargetContext*, bool useHWAA,
|
||||||
GrAppliedClip* out, SkRect* bounds) const final;
|
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const final;
|
||||||
|
|
||||||
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA* aa) const override;
|
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA* aa) const override;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public:
|
|||||||
static const char kMaskTestTag[];
|
static const char kMaskTestTag[];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool PathNeedsSWRenderer(GrContext* context,
|
static bool PathNeedsSWRenderer(GrRecordingContext* context,
|
||||||
const SkIRect& scissorRect,
|
const SkIRect& scissorRect,
|
||||||
bool hasUserStencilSettings,
|
bool hasUserStencilSettings,
|
||||||
const GrRenderTargetContext*,
|
const GrRenderTargetContext*,
|
||||||
@ -46,18 +46,18 @@ private:
|
|||||||
GrPathRenderer** prOut,
|
GrPathRenderer** prOut,
|
||||||
bool needsStencil);
|
bool needsStencil);
|
||||||
|
|
||||||
bool applyClipMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&,
|
bool applyClipMask(GrRecordingContext*, GrRenderTargetContext*, const GrReducedClip&,
|
||||||
bool hasUserStencilSettings, GrAppliedClip*) const;
|
bool hasUserStencilSettings, GrAppliedClip*) const;
|
||||||
|
|
||||||
// Creates an alpha mask of the clip. The mask is a rasterization of elements through the
|
// Creates an alpha mask of the clip. The mask is a rasterization of elements through the
|
||||||
// rect specified by clipSpaceIBounds.
|
// 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.
|
// 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;
|
GrRenderTargetContext*) const;
|
||||||
|
|
||||||
static bool UseSWOnlyPath(GrContext*,
|
static bool UseSWOnlyPath(GrRecordingContext*,
|
||||||
bool hasUserStencilSettings,
|
bool hasUserStencilSettings,
|
||||||
const GrRenderTargetContext*,
|
const GrRenderTargetContext*,
|
||||||
const GrReducedClip&);
|
const GrReducedClip&);
|
||||||
|
@ -44,21 +44,38 @@ sk_sp<GrOpMemoryPool> GrContextPriv::refOpMemoryPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext(
|
sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext(
|
||||||
const GrBackendFormat& format,
|
const GrBackendFormat& format,
|
||||||
SkBackingFit fit,
|
SkBackingFit fit,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
GrPixelConfig config,
|
GrPixelConfig config,
|
||||||
sk_sp<SkColorSpace> colorSpace,
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
int sampleCnt,
|
int sampleCnt,
|
||||||
GrMipMapped mipMapped,
|
GrMipMapped mipMapped,
|
||||||
GrSurfaceOrigin origin,
|
GrSurfaceOrigin origin,
|
||||||
const SkSurfaceProps* surfaceProps,
|
const SkSurfaceProps* surfaceProps,
|
||||||
SkBudgeted budgeted) {
|
SkBudgeted budgeted) {
|
||||||
return fContext->makeDeferredRenderTargetContext(format, fit, width, height, config,
|
return fContext->makeDeferredRenderTargetContext(format, fit, width, height, config,
|
||||||
std::move(colorSpace), sampleCnt, mipMapped,
|
std::move(colorSpace), sampleCnt, mipMapped,
|
||||||
origin, surfaceProps, budgeted);
|
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<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy> proxy,
|
||||||
sk_sp<SkColorSpace> colorSpace,
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* props) {
|
const SkSurfaceProps* props) {
|
||||||
@ -685,62 +702,6 @@ void GrContextPriv::copyOpListsFromDDL(const SkDeferredDisplayList* ddl,
|
|||||||
fContext->fDrawingManager->copyOpListsFromDDL(ddl, newDest);
|
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
|
#ifdef SK_ENABLE_DUMP_GPU
|
||||||
#include "SkJSONWriter.h"
|
#include "SkJSONWriter.h"
|
||||||
|
@ -53,6 +53,10 @@ public:
|
|||||||
SkDEBUGCODE(GrSingleOwner* singleOwner() const { return fContext->singleOwner(); } )
|
SkDEBUGCODE(GrSingleOwner* singleOwner() const { return fContext->singleOwner(); } )
|
||||||
|
|
||||||
// from GrRecordingContext
|
// from GrRecordingContext
|
||||||
|
|
||||||
|
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
|
||||||
|
GrDrawingManager* drawingManager() { return fContext->drawingManager(); }
|
||||||
|
|
||||||
sk_sp<GrOpMemoryPool> refOpMemoryPool();
|
sk_sp<GrOpMemoryPool> refOpMemoryPool();
|
||||||
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
|
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
|
||||||
|
|
||||||
@ -73,6 +77,24 @@ public:
|
|||||||
const SkSurfaceProps* surfaceProps = nullptr,
|
const SkSurfaceProps* surfaceProps = nullptr,
|
||||||
SkBudgeted = SkBudgeted::kYes);
|
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(); }
|
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,8 +102,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&);
|
static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&);
|
||||||
|
|
||||||
GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); }
|
|
||||||
|
|
||||||
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
|
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
|
||||||
sk_sp<SkColorSpace> = nullptr,
|
sk_sp<SkColorSpace> = nullptr,
|
||||||
const SkSurfaceProps* = nullptr);
|
const SkSurfaceProps* = nullptr);
|
||||||
@ -248,24 +268,6 @@ public:
|
|||||||
void moveOpListsToDDL(SkDeferredDisplayList*);
|
void moveOpListsToDDL(SkDeferredDisplayList*);
|
||||||
void copyOpListsFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest);
|
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; }
|
GrContextOptions::PersistentCache* getPersistentCache() { return fContext->fPersistentCache; }
|
||||||
|
|
||||||
#ifdef SK_ENABLE_DUMP_GPU
|
#ifdef SK_ENABLE_DUMP_GPU
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include "GrPathRenderer.h"
|
#include "GrPathRenderer.h"
|
||||||
#include "GrCaps.h"
|
#include "GrCaps.h"
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrPaint.h"
|
#include "GrPaint.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrRenderTargetContext.h"
|
#include "GrRenderTargetContext.h"
|
||||||
#include "GrShape.h"
|
#include "GrShape.h"
|
||||||
#include "GrUserStencilSettings.h"
|
#include "GrUserStencilSettings.h"
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
class GrCaps;
|
class GrCaps;
|
||||||
class GrClip;
|
class GrClip;
|
||||||
class GrContext;
|
|
||||||
class GrFixedClip;
|
class GrFixedClip;
|
||||||
class GrHardClip;
|
class GrHardClip;
|
||||||
class GrPaint;
|
class GrPaint;
|
||||||
|
class GrRecordingContext;
|
||||||
class GrRenderTargetContext;
|
class GrRenderTargetContext;
|
||||||
class GrShape;
|
class GrShape;
|
||||||
class GrStyle;
|
class GrStyle;
|
||||||
@ -106,7 +106,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct DrawPathArgs {
|
struct DrawPathArgs {
|
||||||
GrContext* fContext;
|
GrRecordingContext* fContext;
|
||||||
GrPaint&& fPaint;
|
GrPaint&& fPaint;
|
||||||
const GrUserStencilSettings* fUserStencilSettings;
|
const GrUserStencilSettings* fUserStencilSettings;
|
||||||
GrRenderTargetContext* fRenderTargetContext;
|
GrRenderTargetContext* fRenderTargetContext;
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
struct StencilPathArgs {
|
struct StencilPathArgs {
|
||||||
SkDEBUGCODE(StencilPathArgs() { memset(this, 0, sizeof(*this)); }) // For validation.
|
SkDEBUGCODE(StencilPathArgs() { memset(this, 0, sizeof(*this)); }) // For validation.
|
||||||
|
|
||||||
GrContext* fContext;
|
GrRecordingContext* fContext;
|
||||||
GrRenderTargetContext* fRenderTargetContext;
|
GrRenderTargetContext* fRenderTargetContext;
|
||||||
const GrHardClip* fClip;
|
const GrHardClip* fClip;
|
||||||
const SkIRect* fClipConservativeBounds;
|
const SkIRect* fClipConservativeBounds;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "GrRecordingContextPriv.h"
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrRenderTargetContext.h"
|
#include "GrRenderTargetContext.h"
|
||||||
#include "GrSkSLFPFactoryCache.h"
|
#include "GrSkSLFPFactoryCache.h"
|
||||||
|
#include "SkGr.h"
|
||||||
|
|
||||||
GrRecordingContext::GrRecordingContext(GrBackendApi backend,
|
GrRecordingContext::GrRecordingContext(GrBackendApi backend,
|
||||||
const GrContextOptions& options,
|
const GrContextOptions& options,
|
||||||
@ -91,6 +92,62 @@ sk_sp<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContext
|
|||||||
return renderTargetContext;
|
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 {
|
sk_sp<const GrCaps> GrRecordingContextPriv::refCaps() const {
|
||||||
return fContext->refCaps();
|
return fContext->refCaps();
|
||||||
@ -119,3 +176,20 @@ sk_sp<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetCon
|
|||||||
std::move(colorSpace), sampleCnt, mipMapped,
|
std::move(colorSpace), sampleCnt, mipMapped,
|
||||||
origin, surfaceProps, budgeted);
|
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);
|
||||||
|
}
|
||||||
|
@ -41,6 +41,10 @@ public:
|
|||||||
SkDEBUGCODE(GrSingleOwner* singleOwner() const { return fContext->singleOwner(); } )
|
SkDEBUGCODE(GrSingleOwner* singleOwner() const { return fContext->singleOwner(); } )
|
||||||
|
|
||||||
// from GrRecordingContext
|
// from GrRecordingContext
|
||||||
|
|
||||||
|
// CONTEXT TODO: move GrDrawingManager to GrRecordingContext for real
|
||||||
|
GrDrawingManager* drawingManager() { return fContext->drawingManager(); }
|
||||||
|
|
||||||
sk_sp<GrOpMemoryPool> refOpMemoryPool();
|
sk_sp<GrOpMemoryPool> refOpMemoryPool();
|
||||||
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
|
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
|
||||||
|
|
||||||
@ -61,6 +65,24 @@ public:
|
|||||||
const SkSurfaceProps* surfaceProps = nullptr,
|
const SkSurfaceProps* surfaceProps = nullptr,
|
||||||
SkBudgeted = SkBudgeted::kYes);
|
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(); }
|
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
#include "GrAppliedClip.h"
|
#include "GrAppliedClip.h"
|
||||||
#include "GrClip.h"
|
#include "GrClip.h"
|
||||||
#include "GrColor.h"
|
#include "GrColor.h"
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrDrawingManager.h"
|
#include "GrDrawingManager.h"
|
||||||
#include "GrFixedClip.h"
|
#include "GrFixedClip.h"
|
||||||
#include "GrPathRenderer.h"
|
#include "GrPathRenderer.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrRenderTargetContext.h"
|
#include "GrRenderTargetContext.h"
|
||||||
#include "GrRenderTargetContextPriv.h"
|
#include "GrRenderTargetContextPriv.h"
|
||||||
#include "GrShape.h"
|
#include "GrShape.h"
|
||||||
@ -809,7 +809,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Create a 1-bit clip mask in the stencil buffer.
|
// Create a 1-bit clip mask in the stencil buffer.
|
||||||
|
|
||||||
bool GrReducedClip::drawStencilClipMask(GrContext* context,
|
bool GrReducedClip::drawStencilClipMask(GrRecordingContext* context,
|
||||||
GrRenderTargetContext* renderTargetContext) const {
|
GrRenderTargetContext* renderTargetContext) const {
|
||||||
// We set the current clip to the bounds so that our recursive draws are scissored to them.
|
// We set the current clip to the bounds so that our recursive draws are scissored to them.
|
||||||
GrStencilClip stencilClip(fScissor, this->maskGenID());
|
GrStencilClip stencilClip(fScissor, this->maskGenID());
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#include "SkClipStack.h"
|
#include "SkClipStack.h"
|
||||||
#include "SkTLList.h"
|
#include "SkTLList.h"
|
||||||
|
|
||||||
class GrContext;
|
|
||||||
class GrCoverageCountingPathRenderer;
|
class GrCoverageCountingPathRenderer;
|
||||||
|
class GrRecordingContext;
|
||||||
class GrRenderTargetContext;
|
class GrRenderTargetContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
bool maskRequiresAA() const { SkASSERT(!fMaskElements.isEmpty()); return fMaskRequiresAA; }
|
bool maskRequiresAA() const { SkASSERT(!fMaskElements.isEmpty()); return fMaskRequiresAA; }
|
||||||
|
|
||||||
bool drawAlphaClipMask(GrRenderTargetContext*) const;
|
bool drawAlphaClipMask(GrRenderTargetContext*) const;
|
||||||
bool drawStencilClipMask(GrContext*, GrRenderTargetContext*) const;
|
bool drawStencilClipMask(GrRecordingContext*, GrRenderTargetContext*) const;
|
||||||
|
|
||||||
int numAnalyticFPs() const { return fAnalyticFPs.count() + fCCPRClipPaths.count(); }
|
int numAnalyticFPs() const { return fAnalyticFPs.count() + fCCPRClipPaths.count(); }
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
#include "GrSWMaskHelper.h"
|
#include "GrSWMaskHelper.h"
|
||||||
|
|
||||||
#include "GrContext.h"
|
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrProxyProvider.h"
|
#include "GrProxyProvider.h"
|
||||||
|
#include "GrRecordingContext.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrShape.h"
|
#include "GrShape.h"
|
||||||
#include "GrSurfaceContext.h"
|
#include "GrSurfaceContext.h"
|
||||||
#include "GrTextureProxy.h"
|
#include "GrTextureProxy.h"
|
||||||
@ -91,7 +91,8 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds) {
|
|||||||
return true;
|
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());
|
SkImageInfo ii = SkImageInfo::MakeA8(fPixels->width(), fPixels->height());
|
||||||
size_t rowBytes = fPixels->rowBytes();
|
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
|
// 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.
|
// should just participate in the normal allocation process and not need the pending IO flag.
|
||||||
auto surfaceFlags = GrInternalSurfaceFlags::kNone;
|
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
|
// In DDL mode, this texture proxy will be instantiated at flush time, therfore it cannot
|
||||||
// have pending IO.
|
// have pending IO.
|
||||||
surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;
|
surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "SkTypes.h"
|
#include "SkTypes.h"
|
||||||
|
|
||||||
class GrShape;
|
class GrShape;
|
||||||
|
class GrRecordingContext;
|
||||||
class GrTextureProxy;
|
class GrTextureProxy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +51,7 @@ public:
|
|||||||
// Draw a single path into the accumuation bitmap using the specified op
|
// 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);
|
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
|
// Reset the internal bitmap
|
||||||
void clear(uint8_t alpha) {
|
void clear(uint8_t alpha) {
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
#include "GrSoftwarePathRenderer.h"
|
#include "GrSoftwarePathRenderer.h"
|
||||||
#include "GrAuditTrail.h"
|
#include "GrAuditTrail.h"
|
||||||
#include "GrClip.h"
|
#include "GrClip.h"
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrDeferredProxyUploader.h"
|
#include "GrDeferredProxyUploader.h"
|
||||||
#include "GrGpuResourcePriv.h"
|
#include "GrGpuResourcePriv.h"
|
||||||
#include "GrOpFlushState.h"
|
#include "GrOpFlushState.h"
|
||||||
#include "GrOpList.h"
|
#include "GrOpList.h"
|
||||||
#include "GrProxyProvider.h"
|
#include "GrProxyProvider.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrSWMaskHelper.h"
|
#include "GrSWMaskHelper.h"
|
||||||
#include "GrShape.h"
|
#include "GrShape.h"
|
||||||
#include "GrSurfaceContextPriv.h"
|
#include "GrSurfaceContextPriv.h"
|
||||||
@ -172,7 +172,8 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask(
|
|||||||
dstRect, invert);
|
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) {
|
int width, int height) {
|
||||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||||
|
|
||||||
@ -331,7 +332,11 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
|||||||
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
|
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
|
||||||
GrAA aa = GrAAType::kCoverage == args.fAAType ? GrAA::kYes : GrAA::kNo;
|
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) {
|
if (taskGroup) {
|
||||||
proxy = make_deferred_mask_texture_proxy(args.fContext, fit,
|
proxy = make_deferred_mask_texture_proxy(args.fContext, fit,
|
||||||
boundsForMask->width(),
|
boundsForMask->width(),
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include "GrCCDrawPathsOp.h"
|
#include "GrCCDrawPathsOp.h"
|
||||||
|
|
||||||
#include "GrContext.h"
|
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrMemoryPool.h"
|
#include "GrMemoryPool.h"
|
||||||
#include "GrOpFlushState.h"
|
#include "GrOpFlushState.h"
|
||||||
|
#include "GrRecordingContext.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "ccpr/GrCCPathCache.h"
|
#include "ccpr/GrCCPathCache.h"
|
||||||
#include "ccpr/GrCCPerFlushResources.h"
|
#include "ccpr/GrCCPerFlushResources.h"
|
||||||
#include "ccpr/GrCoverageCountingPathRenderer.h"
|
#include "ccpr/GrCoverageCountingPathRenderer.h"
|
||||||
@ -26,8 +26,8 @@ static bool has_coord_transforms(const GrPaint& paint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(
|
std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(
|
||||||
GrContext* context, const SkIRect& clipIBounds, const SkMatrix& m, const GrShape& shape,
|
GrRecordingContext* context, const SkIRect& clipIBounds, const SkMatrix& m,
|
||||||
GrPaint&& paint) {
|
const GrShape& shape, GrPaint&& paint) {
|
||||||
SkRect conservativeDevBounds;
|
SkRect conservativeDevBounds;
|
||||||
m.mapRect(&conservativeDevBounds, shape.bounds());
|
m.mapRect(&conservativeDevBounds, shape.bounds());
|
||||||
|
|
||||||
@ -75,8 +75,9 @@ std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::InternalMake(
|
std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::InternalMake(
|
||||||
GrContext* context, const SkIRect& clipIBounds, const SkMatrix& m, const GrShape& shape,
|
GrRecordingContext* context, const SkIRect& clipIBounds, const SkMatrix& m,
|
||||||
float strokeDevWidth, const SkRect& conservativeDevBounds, GrPaint&& paint) {
|
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
|
// The path itself should have been cropped if larger than kPathCropThreshold. If it had a
|
||||||
// stroke, that would have further inflated its draw bounds.
|
// stroke, that would have further inflated its draw bounds.
|
||||||
SkASSERT(SkTMax(conservativeDevBounds.height(), conservativeDevBounds.width()) <
|
SkASSERT(SkTMax(conservativeDevBounds.height(), conservativeDevBounds.width()) <
|
||||||
|
@ -14,11 +14,12 @@
|
|||||||
#include "ccpr/GrCCPathCache.h"
|
#include "ccpr/GrCCPathCache.h"
|
||||||
#include "ops/GrDrawOp.h"
|
#include "ops/GrDrawOp.h"
|
||||||
|
|
||||||
|
class GrCCAtlas;
|
||||||
|
class GrCCPerFlushResources;
|
||||||
struct GrCCPerFlushResourceSpecs;
|
struct GrCCPerFlushResourceSpecs;
|
||||||
struct GrCCPerOpListPaths;
|
struct GrCCPerOpListPaths;
|
||||||
class GrCCAtlas;
|
|
||||||
class GrOnFlushResourceProvider;
|
class GrOnFlushResourceProvider;
|
||||||
class GrCCPerFlushResources;
|
class GrRecordingContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the Op that draws paths to the actual canvas, using atlases generated by CCPR.
|
* 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
|
DEFINE_OP_CLASS_ID
|
||||||
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrCCDrawPathsOp);
|
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&&);
|
const SkMatrix&, const GrShape&, GrPaint&&);
|
||||||
~GrCCDrawPathsOp() override;
|
~GrCCDrawPathsOp() override;
|
||||||
|
|
||||||
@ -68,7 +69,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend class GrOpMemoryPool;
|
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&,
|
const SkMatrix&, const GrShape&,
|
||||||
float strokeDevWidth,
|
float strokeDevWidth,
|
||||||
const SkRect& conservativeDevBounds,
|
const SkRect& conservativeDevBounds,
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
#include "SkTypes.h"
|
#include "SkTypes.h"
|
||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
|
|
||||||
#include "GrContext.h"
|
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrClip.h"
|
#include "GrClip.h"
|
||||||
#include "GrDrawingManager.h"
|
#include "GrDrawingManager.h"
|
||||||
#include "GrPathRenderer.h"
|
#include "GrPathRenderer.h"
|
||||||
#include "GrPaint.h"
|
#include "GrPaint.h"
|
||||||
|
#include "GrRecordingContext.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrRenderTargetContext.h"
|
#include "GrRenderTargetContext.h"
|
||||||
#include "GrRenderTargetContextPriv.h"
|
#include "GrRenderTargetContextPriv.h"
|
||||||
#include "GrShape.h"
|
#include "GrShape.h"
|
||||||
@ -36,8 +36,8 @@ public:
|
|||||||
CCPRClip(GrCoverageCountingPathRenderer* ccpr, const SkPath& path) : fCCPR(ccpr), fPath(path) {}
|
CCPRClip(GrCoverageCountingPathRenderer* ccpr, const SkPath& path) : fCCPR(ccpr), fPath(path) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool apply(GrContext* context, GrRenderTargetContext* rtc, bool, bool, GrAppliedClip* out,
|
bool apply(GrRecordingContext* context, GrRenderTargetContext* rtc, bool useHWAA,
|
||||||
SkRect* bounds) const override {
|
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const override {
|
||||||
out->addCoverageFP(fCCPR->makeClipProcessor(rtc->priv().testingOnly_getOpListID(), fPath,
|
out->addCoverageFP(fCCPR->makeClipProcessor(rtc->priv().testingOnly_getOpListID(), fPath,
|
||||||
SkIRect::MakeWH(rtc->width(), rtc->height()),
|
SkIRect::MakeWH(rtc->width(), rtc->height()),
|
||||||
rtc->width(), rtc->height(),
|
rtc->width(), rtc->height(),
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
|
|
||||||
#include "GrClip.h"
|
#include "GrClip.h"
|
||||||
#include "GrContextPriv.h"
|
|
||||||
#include "GrMemoryPool.h"
|
#include "GrMemoryPool.h"
|
||||||
#include "GrOnFlushResourceProvider.h"
|
#include "GrOnFlushResourceProvider.h"
|
||||||
#include "GrProxyProvider.h"
|
#include "GrProxyProvider.h"
|
||||||
|
#include "GrRecordingContextPriv.h"
|
||||||
#include "GrRenderTargetContext.h"
|
#include "GrRenderTargetContext.h"
|
||||||
#include "GrRenderTargetContextPriv.h"
|
#include "GrRenderTargetContextPriv.h"
|
||||||
#include "GrSurfaceProxy.h"
|
#include "GrSurfaceProxy.h"
|
||||||
@ -55,7 +55,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
DEFINE_OP_CLASS_ID
|
DEFINE_OP_CLASS_ID
|
||||||
|
|
||||||
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
|
static std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
|
||||||
GrProxyProvider* proxyProvider,
|
GrProxyProvider* proxyProvider,
|
||||||
LazyProxyTest* test,
|
LazyProxyTest* test,
|
||||||
bool nullTexture) {
|
bool nullTexture) {
|
||||||
@ -76,7 +76,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend class GrOpMemoryPool; // for ctor
|
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) {
|
: GrDrawOp(ClassID()), fTest(test) {
|
||||||
const GrBackendFormat format =
|
const GrBackendFormat format =
|
||||||
ctx->priv().caps()->getBackendFormatFromColorType(kRGB_565_SkColorType);
|
ctx->priv().caps()->getBackendFormatFromColorType(kRGB_565_SkColorType);
|
||||||
@ -119,7 +120,7 @@ public:
|
|||||||
|
|
||||||
class ClipFP : public GrFragmentProcessor {
|
class ClipFP : public GrFragmentProcessor {
|
||||||
public:
|
public:
|
||||||
ClipFP(GrContext* ctx, GrProxyProvider* proxyProvider, LazyProxyTest* test,
|
ClipFP(GrRecordingContext* ctx, GrProxyProvider* proxyProvider, LazyProxyTest* test,
|
||||||
GrTextureProxy* atlas)
|
GrTextureProxy* atlas)
|
||||||
: GrFragmentProcessor(kTestFP_ClassID, kNone_OptimizationFlags)
|
: GrFragmentProcessor(kTestFP_ClassID, kNone_OptimizationFlags)
|
||||||
, fContext(ctx)
|
, fContext(ctx)
|
||||||
@ -158,7 +159,7 @@ public:
|
|||||||
bool onIsEqual(const GrFragmentProcessor&) const override { return false; }
|
bool onIsEqual(const GrFragmentProcessor&) const override { return false; }
|
||||||
const TextureSampler& onTextureSampler(int) const override { return fAccess; }
|
const TextureSampler& onTextureSampler(int) const override { return fAccess; }
|
||||||
|
|
||||||
GrContext* const fContext;
|
GrRecordingContext* const fContext;
|
||||||
GrProxyProvider* const fProxyProvider;
|
GrProxyProvider* const fProxyProvider;
|
||||||
LazyProxyTest* const fTest;
|
LazyProxyTest* const fTest;
|
||||||
GrTextureProxy* const fAtlas;
|
GrTextureProxy* const fAtlas;
|
||||||
@ -174,8 +175,8 @@ public:
|
|||||||
, fAtlas(atlas) {}
|
, fAtlas(atlas) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool apply(GrContext* context, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
|
bool apply(GrRecordingContext* context, GrRenderTargetContext*, bool useHWAA,
|
||||||
SkRect* bounds) const override {
|
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const override {
|
||||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||||
out->addCoverageFP(skstd::make_unique<ClipFP>(context, proxyProvider, fTest, fAtlas));
|
out->addCoverageFP(skstd::make_unique<ClipFP>(context, proxyProvider, fTest, fAtlas));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user