Remove GrRenderTargetContextPriv and GrSurfaceContextPriv

I think this is vestigial from some time in the past where RTC was
public.

Also just expose the methods that add ops rather than have so many
friends + testingOnly versions.

Change-Id: I60d9fdff23b2d67039a7b37815da7ff9e73d8999
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339158
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2020-11-30 14:33:58 -05:00 committed by Skia Commit-Bot
parent 6affa2c2e3
commit 70fe17e12f
59 changed files with 261 additions and 501 deletions

View File

@ -16,7 +16,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
@ -331,7 +330,7 @@ public:
op = GrOp::Make<Op>(rContext, c4f, fMode);
}
}
rtc->priv().testingOnly_addDrawOp(std::move(op));
rtc->addDrawOp(std::move(op));
}
context->flushAndSubmit();

View File

@ -39,7 +39,6 @@
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrUserStencilSettings.h"
#include "src/gpu/effects/GrBezierEffect.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
@ -298,7 +297,7 @@ protected:
GrOp::Owner op = BezierConicTestOp::Make(context, bounds,
kOpaqueBlack, klm);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
}
}
@ -491,7 +490,7 @@ protected:
GrOp::Owner op = BezierQuadTestOp::Make(context, bounds,
kOpaqueBlack, DevToUV);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
}
}

View File

@ -23,7 +23,6 @@
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/effects/GrRRectEffect.h"
#include "src/gpu/ops/GrDrawOp.h"
@ -103,9 +102,8 @@ protected:
SkRect bounds = testBounds;
bounds.offset(SkIntToScalar(x), SkIntToScalar(y));
renderTargetContext->priv().testingOnly_addDrawOp(
GrFillRectOp::MakeNonAARect(context, std::move(grPaint),
SkMatrix::I(), bounds));
renderTargetContext->addDrawOp(GrFillRectOp::MakeNonAARect(
context, std::move(grPaint), SkMatrix::I(), bounds));
}
canvas->restore();
x = x + fTestOffsetX;

View File

@ -36,7 +36,6 @@
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSamplerState.h"
#include "src/gpu/GrShaderCaps.h"
@ -249,8 +248,8 @@ void ClockwiseGM::onDraw(GrRecordingContext* ctx, GrRenderTargetContext* rtc, Sk
rtc->clear(SK_PMColor4fBLACK);
// Draw the test directly to the frame buffer.
rtc->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
rtc->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, true, 100));
rtc->addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
rtc->addDrawOp(ClockwiseTestOp::Make(ctx, true, 100));
// Draw the test to an off-screen, top-down render target.
GrColorType rtcColorType = rtc->colorInfo().colorType();
@ -259,8 +258,8 @@ void ClockwiseGM::onDraw(GrRecordingContext* ctx, GrRenderTargetContext* rtc, Sk
GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes,
nullptr)) {
topLeftRTC->clear(SK_PMColor4fTRANSPARENT);
topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, true, 100));
topLeftRTC->addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
topLeftRTC->addDrawOp(ClockwiseTestOp::Make(ctx, true, 100));
rtc->drawTexture(nullptr,
topLeftRTC->readSurfaceView(),
rtc->colorInfo().alphaType(),
@ -283,8 +282,8 @@ void ClockwiseGM::onDraw(GrRecordingContext* ctx, GrRenderTargetContext* rtc, Sk
GrMipmapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin, SkBudgeted::kYes,
nullptr)) {
topLeftRTC->clear(SK_PMColor4fTRANSPARENT);
topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, true, 100));
topLeftRTC->addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
topLeftRTC->addDrawOp(ClockwiseTestOp::Make(ctx, true, 100));
rtc->drawTexture(nullptr,
topLeftRTC->readSurfaceView(),
rtc->colorInfo().alphaType(),

View File

@ -33,7 +33,6 @@
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
#include "src/gpu/ops/GrDrawOp.h"
@ -145,7 +144,7 @@ protected:
renderRect.makeOffset(x, y),
renderRect,
SkMatrix::I())) {
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
// Draw labels for the input to the processor and the processor to the right of

View File

@ -24,7 +24,6 @@
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/effects/GrConvexPolyEffect.h"
#include "tools/gpu/TestOps.h"
@ -137,7 +136,7 @@ protected:
auto rect = p.getBounds().makeOutset(kOutset, kOutset);
auto op = sk_gpu_test::test_ops::MakeRect(context, std::move(grPaint), rect);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
x += SkScalarCeilToScalar(path->getBounds().width() + kDX);
}
@ -177,7 +176,7 @@ protected:
auto drawRect = rect.makeOutset(kOutset, kOutset);
auto op = sk_gpu_test::test_ops::MakeRect(context, std::move(grPaint), drawRect);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
x += SkScalarCeilToScalar(rect.width() + kDX);
}

View File

@ -10,7 +10,6 @@
#include "include/effects/SkRuntimeEffect.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ops/GrFillRectOp.h"
#include "tools/ToolUtils.h"

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/effects/GrRRectEffect.h"
#include "src/gpu/effects/GrSkSLFP.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
@ -91,8 +90,5 @@ DEF_SIMPLE_GPU_GM_BG(fpcoordinateoverride, ctx, rtCtx, canvas, 512, 512,
GrPaint grPaint;
grPaint.setCoverageFragmentProcessor(std::move(fp));
rtCtx->priv().testingOnly_addDrawOp(GrFillRectOp::MakeNonAARect(ctx,
std::move(grPaint),
SkMatrix::I(),
bounds));
rtCtx->addDrawOp(GrFillRectOp::MakeNonAARect(ctx, std::move(grPaint), SkMatrix::I(), bounds));
}

View File

@ -31,7 +31,6 @@
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrShaderVar.h"
@ -266,7 +265,7 @@ DEF_SIMPLE_GPU_GM_CAN_FAIL(fwidth_squircle, ctx, rtc, canvas, errorMsg, 200, 200
// Draw the test directly to the frame buffer.
canvas->clear(SK_ColorWHITE);
rtc->priv().testingOnly_addDrawOp(FwidthSquircleTestOp::Make(ctx, canvas->getTotalMatrix()));
rtc->addDrawOp(FwidthSquircleTestOp::Make(ctx, canvas->getTotalMatrix()));
return skiagm::DrawResult::kOk;
}

View File

@ -23,7 +23,6 @@
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/effects/GrRRectEffect.h"
#include "src/gpu/ops/GrDrawOp.h"
@ -130,9 +129,8 @@ protected:
SkRect bounds = rrect.getBounds();
bounds.outset(2.f, 2.f);
renderTargetContext->priv().testingOnly_addDrawOp(
GrFillRectOp::MakeNonAARect(context, std::move(grPaint),
SkMatrix::I(), bounds));
renderTargetContext->addDrawOp(GrFillRectOp::MakeNonAARect(
context, std::move(grPaint), SkMatrix::I(), bounds));
} else {
drew = false;
}

View File

@ -10,7 +10,6 @@
#include "src/core/SkMatrixProvider.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ops/GrFillRectOp.h"
#include "tools/Resources.h"

View File

@ -10,7 +10,6 @@
#include "src/core/SkMatrixProvider.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ops/GrFillRectOp.h"
#include "tools/Resources.h"

View File

@ -34,7 +34,6 @@
#include "src/gpu/GrProcessorSet.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSamplerState.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrShaderVar.h"
@ -362,15 +361,14 @@ DrawResult SampleLocationsGM::onDraw(GrRecordingContext* ctx, GrRenderTargetCont
offscreenRTC->clear({0,1,0,1});
// Stencil.
offscreenRTC->priv().testingOnly_addDrawOp(
SampleLocationsTestOp::Make(ctx, canvas->getTotalMatrix(), fGradType));
offscreenRTC->addDrawOp(SampleLocationsTestOp::Make(ctx, canvas->getTotalMatrix(), fGradType));
// Cover.
GrPaint coverPaint;
coverPaint.setColor4f({1,0,0,1});
coverPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver));
rtc->priv().stencilRect(nullptr, &kStencilCover, std::move(coverPaint), GrAA::kNo,
SkMatrix::I(), SkRect::MakeWH(200, 200));
rtc->stencilRect(nullptr, &kStencilCover, std::move(coverPaint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeWH(200, 200));
// Copy offscreen texture to canvas.
rtc->drawTexture(nullptr,

View File

@ -15,7 +15,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/ops/GrFillRectOp.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
@ -37,6 +36,5 @@ DEF_SIMPLE_GPU_GM(swizzle, ctx, rtCtx, canvas, 512, 512) {
GrPaint grPaint;
grPaint.setColorFragmentProcessor(std::move(fp));
rtCtx->priv().testingOnly_addDrawOp(
GrFillRectOp::MakeNonAARect(ctx, std::move(grPaint), SkMatrix(), bounds));
rtCtx->addDrawOp(GrFillRectOp::MakeNonAARect(ctx, std::move(grPaint), SkMatrix(), bounds));
}

View File

@ -17,7 +17,6 @@
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrShaderVar.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
@ -402,12 +401,9 @@ DrawResult TessellationGM::onDraw(GrRecordingContext* ctx, GrRenderTargetContext
borderPaint.setColor4f({1,0,1,1});
canvas->drawRect(kRect.makeOutset(1.5f, 1.5f), borderPaint);
rtc->priv().testingOnly_addDrawOp(
GrOp::Make<TessellationTestOp>(ctx, canvas->getTotalMatrix(), kTri1));
rtc->priv().testingOnly_addDrawOp(
GrOp::Make<TessellationTestOp>(ctx, canvas->getTotalMatrix(), kTri2));
rtc->priv().testingOnly_addDrawOp(
GrOp::Make<TessellationTestOp>(ctx, canvas->getTotalMatrix(), nullptr));
rtc->addDrawOp(GrOp::Make<TessellationTestOp>(ctx, canvas->getTotalMatrix(), kTri1));
rtc->addDrawOp(GrOp::Make<TessellationTestOp>(ctx, canvas->getTotalMatrix(), kTri2));
rtc->addDrawOp(GrOp::Make<TessellationTestOp>(ctx, canvas->getTotalMatrix(), nullptr));
return skiagm::DrawResult::kOk;
}

View File

@ -23,7 +23,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSamplerState.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
@ -169,7 +168,7 @@ protected:
drawRect,
localRect.makeOffset(kT),
SkMatrix::Translate(-kT))) {
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
x += localRect.width() + kTestPad;
@ -187,7 +186,7 @@ protected:
caps);
if (auto op = sk_gpu_test::test_ops::MakeRect(context, std::move(fp2), drawRect,
localRect)) {
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
if (mx < GrSamplerState::kWrapModeCount - 1) {

View File

@ -34,7 +34,6 @@
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrReducedClip.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrStencilClip.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrUserStencilSettings.h"
@ -202,7 +201,7 @@ DrawResult WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, Sk
*errorMsg = kErrorMsg_DrawSkippedGpuOnly;
return DrawResult::kSkip;
}
if (rtc->priv().maxWindowRectangles() < kNumWindows) {
if (rtc->maxWindowRectangles() < kNumWindows) {
*errorMsg = "Requires at least 8 window rectangles. "
"(Are you off FBO 0? Use sRGB to force offscreen rendering.)";
return DrawResult::kSkip;
@ -239,9 +238,8 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrRecordingContext* ctx, GrRende
GrPaint stencilPaint;
stencilPaint.setCoverageSetOpXPFactory(SkRegion::kDifference_Op, false);
GrStencilClip stencilClip = make_stencil_only_clip(maskRTC.get());
maskRTC->priv().stencilRect(&stencilClip, &GrUserStencilSettings::kUnused,
std::move(stencilPaint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(maskRTC->dimensions()));
maskRTC->stencilRect(&stencilClip, &GrUserStencilSettings::kUnused, std::move(stencilPaint),
GrAA::kNo, SkMatrix::I(), SkRect::Make(maskRTC->dimensions()));
reducedClip.drawAlphaClipMask(maskRTC.get());
int x = kCoverRect.x() - kDeviceRect.x(),
@ -288,7 +286,7 @@ void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, boo
0>()
);
rtc->priv().clearStencilClip(SkIRect::MakeSize(rtc->dimensions()), false);
rtc->clearStencilClip(SkIRect::MakeSize(rtc->dimensions()), false);
for (int y = 0; y < kDeviceRect.height(); y += kMaskCheckerSize) {
for (int x = (y & 1) == flip ? 0 : kMaskCheckerSize;
@ -296,8 +294,8 @@ void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, boo
SkIRect checker = SkIRect::MakeXYWH(x, y, kMaskCheckerSize, kMaskCheckerSize);
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
rtc->priv().stencilRect(nullptr, &kSetClip, std::move(paint), GrAA::kNo,
SkMatrix::I(), SkRect::Make(checker));
rtc->stencilRect(nullptr, &kSetClip, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(checker));
}
}
}

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSamplerState.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/GrYUVtoRGBEffect.h"

View File

@ -175,7 +175,6 @@ skia_gpu_sources = [
"$_src/gpu/GrRenderTarget.h",
"$_src/gpu/GrRenderTargetContext.cpp",
"$_src/gpu/GrRenderTargetContext.h",
"$_src/gpu/GrRenderTargetContextPriv.h",
"$_src/gpu/GrRenderTargetProxy.cpp",
"$_src/gpu/GrRenderTargetProxy.h",
"$_src/gpu/GrRenderTask.cpp",
@ -224,7 +223,6 @@ skia_gpu_sources = [
"$_src/gpu/GrSurface.h",
"$_src/gpu/GrSurfaceContext.cpp",
"$_src/gpu/GrSurfaceContext.h",
"$_src/gpu/GrSurfaceContextPriv.h",
"$_src/gpu/GrSurfaceProxy.cpp",
"$_src/gpu/GrSurfaceProxy.h",
"$_src/gpu/GrSurfaceProxyPriv.h",

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/ccpr/GrCCCoverageProcessor.h"
#include "src/gpu/ccpr/GrCCFillGeometry.h"
@ -206,7 +205,7 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) {
ctx, GrColorType::kAlpha_F16, nullptr, SkBackingFit::kApprox, {width, height});
SkASSERT(ccbuff);
ccbuff->clear(SK_PMColor4fTRANSPARENT);
ccbuff->priv().testingOnly_addDrawOp(GrOp::Make<DrawCoverageCountOp>(ctx, this));
ccbuff->addDrawOp(GrOp::Make<DrawCoverageCountOp>(ctx, this));
// Visualize coverage count in main canvas.
GrPaint paint;

View File

@ -18,7 +18,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/tessellate/GrPathTessellateOp.h"
#include "src/gpu/tessellate/GrWangsFormula.h"
@ -94,8 +93,8 @@ void TessellatedWedge::onDrawContent(SkCanvas* canvas) {
aa = GrAAType::kNone;
}
rtc->priv().testingOnly_addDrawOp(GrOp::Make<GrPathTessellateOp>(
ctx, canvas->getTotalMatrix(), fPath, std::move(paint), aa, fOpFlags));
rtc->addDrawOp(GrOp::Make<GrPathTessellateOp>(ctx, canvas->getTotalMatrix(), fPath,
std::move(paint), aa, fOpFlags));
// Draw the path points.
SkPaint pointsPaint;

View File

@ -13,7 +13,6 @@
#include "include/gpu/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h"
#include "src/gpu/effects/GrMatrixConvolutionEffect.h"
@ -236,7 +235,7 @@ static std::unique_ptr<GrRenderTargetContext> convolve_gaussian(GrRecordingConte
auto clear = [&](SkIRect rect) {
// Transform rect into the render target's coord system.
rect.offset(-rtcToSrcOffset);
dstRenderTargetContext->priv().clearAtLeast(rect, SK_PMColor4fTRANSPARENT);
dstRenderTargetContext->clearAtLeast(rect, SK_PMColor4fTRANSPARENT);
};
// Doing mid separately will cause two draws to occur (left and right batch together). At

View File

@ -16,7 +16,6 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrTextureProxy.h"

View File

@ -16,7 +16,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSWMaskHelper.h"
#include "src/gpu/GrStencilMaskHelper.h"
#include "src/gpu/ccpr/GrCoverageCountingPathRenderer.h"
@ -1352,7 +1351,7 @@ GrClip::Effect GrClipStack::apply(GrRecordingContext* context, GrRenderTargetCon
}
// If window rectangles are supported, we can use them to exclude inner bounds of difference ops
int maxWindowRectangles = rtc->priv().maxWindowRectangles();
int maxWindowRectangles = rtc->maxWindowRectangles();
GrWindowRectangles windowRects;
// Elements not represented as an analytic FP or skipped will be collected here and later

View File

@ -20,7 +20,6 @@
#include "src/gpu/GrGpuResourcePriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSWMaskHelper.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrTextureProxy.h"
@ -209,7 +208,7 @@ GrClip::Effect GrClipStackClip::apply(GrRecordingContext* context,
// when drawing rounded div borders.
constexpr int kMaxAnalyticElements = 4;
int maxWindowRectangles = renderTargetContext->priv().maxWindowRectangles();
int maxWindowRectangles = renderTargetContext->maxWindowRectangles();
int maxAnalyticElements = kMaxAnalyticElements;
if (renderTargetContext->numSamples() > 1 || aa == GrAAType::kMSAA || hasUserStencilSettings) {
// Disable analytic clips when we have MSAA. In MSAA we never conflate coverage and opacity.

View File

@ -16,7 +16,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrSkSLFP.h"

View File

@ -13,7 +13,7 @@
#include "src/gpu/GrRectanizerPow2.h"
#include "src/gpu/GrRectanizerSkyline.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
// Each Node covers a sub-rectangle of the final atlas. When a GrDynamicAtlas runs out of room, we
// create a new Node the same size as all combined nodes in the atlas as-is, and then place the new
@ -199,6 +199,6 @@ std::unique_ptr<GrRenderTargetContext> GrDynamicAtlas::instantiate(
}
SkIRect clearRect = SkIRect::MakeSize(fDrawBounds);
rtc->priv().clearAtLeast(clearRect, SK_PMColor4fTRANSPARENT);
rtc->clearAtLeast(clearRect, SK_PMColor4fTRANSPARENT);
return rtc;
}

View File

@ -241,7 +241,6 @@ private:
ExpectedOutcome onMakeClosed(const GrCaps& caps, SkIRect* targetUpdateBounds) override;
friend class OpsTaskTestingAccess;
friend class GrRenderTargetContextPriv; // for stencil clip state. TODO: this is invasive
// The RTC and OpsTask have to work together to handle buffer clears. In most cases, buffer
// clearing can be done natively, in which case the op list's load ops are sufficient. In other

View File

@ -15,7 +15,6 @@
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrReducedClip.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrStencilClip.h"
#include "src/gpu/GrStencilMaskHelper.h"
#include "src/gpu/GrStencilSettings.h"
@ -739,8 +738,8 @@ static bool stencil_element(GrRenderTargetContext* rtc,
GrPaint paint;
paint.setCoverageSetOpXPFactory((SkRegion::Op)element->getOp(),
element->isInverseFilled());
rtc->priv().stencilRect(&clip, ss, std::move(paint), aa, viewMatrix,
element->getDeviceSpaceRect());
rtc->stencilRect(&clip, ss, std::move(paint), aa, viewMatrix,
element->getDeviceSpaceRect());
return true;
}
default: {
@ -750,8 +749,8 @@ static bool stencil_element(GrRenderTargetContext* rtc,
path.toggleInverseFillType();
}
return rtc->priv().drawAndStencilPath(&clip, ss, (SkRegion::Op)element->getOp(),
element->isInverseFilled(), aa, viewMatrix, path);
return rtc->drawAndStencilPath(&clip, ss, (SkRegion::Op)element->getOp(),
element->isInverseFilled(), aa, viewMatrix, path);
}
}
@ -806,7 +805,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
rtc->drawRect(&clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(clip.scissorRect()));
} else {
rtc->priv().clearAtLeast(clip.scissorRect(), initialCoverage);
rtc->clearAtLeast(clip.scissorRect(), initialCoverage);
}
// Set the matrix so that rendered clip elements are transformed to mask space from clip space.
@ -848,8 +847,8 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
GrPaint paint;
paint.setCoverageSetOpXPFactory(op, !invert);
rtc->priv().stencilRect(&clip, &kDrawOutsideElement, std::move(paint), GrAA::kNo,
translate, SkRect::Make(fScissor));
rtc->stencilRect(&clip, &kDrawOutsideElement, std::move(paint), GrAA::kNo, translate,
SkRect::Make(fScissor));
} else {
// all the remaining ops can just be directly draw into the accumulation buffer
GrPaint paint;

View File

@ -41,7 +41,6 @@
#include "src/gpu/GrPathRenderer.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrTracing.h"
@ -72,11 +71,8 @@
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this->drawingManager()->getContext())
#define ASSERT_SINGLE_OWNER GR_ASSERT_SINGLE_OWNER(this->singleOwner())
#define ASSERT_SINGLE_OWNER_PRIV GR_ASSERT_SINGLE_OWNER(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; }
//////////////////////////////////////////////////////////////////////////////
@ -870,9 +866,8 @@ void GrRenderTargetContext::drawQuadSet(const GrClip* clip, GrPaint&& paint, GrA
quads, cnt);
}
int GrRenderTargetContextPriv::maxWindowRectangles() const {
return fRenderTargetContext->asRenderTargetProxy()->maxWindowRectangles(
*fRenderTargetContext->caps());
int GrRenderTargetContext::maxWindowRectangles() const {
return this->asRenderTargetProxy()->maxWindowRectangles(*this->caps());
}
GrOpsTask::CanDiscardPreviousOps GrRenderTargetContext::canDiscardPreviousOpsOnFullClear() const {
@ -945,29 +940,28 @@ void GrRenderTargetContext::internalStencilClear(const SkIRect* scissor, bool in
}
}
void GrRenderTargetContextPriv::stencilPath(const GrHardClip* clip,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
sk_sp<const GrPath> path) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_IF_ABANDONED_PRIV
SkDEBUGCODE(fRenderTargetContext->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContextPriv", "stencilPath",
fRenderTargetContext->fContext);
void GrRenderTargetContext::stencilPath(const GrHardClip* clip,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
sk_sp<const GrPath> path) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "stencilPath", fContext);
// TODO: extract portions of checkDraw that are relevant to path stenciling.
SkASSERT(path);
SkASSERT(fRenderTargetContext->caps()->shaderCaps()->pathRenderingSupport());
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
// FIXME: Use path bounds instead of this WAR once
// https://bugs.chromium.org/p/skia/issues/detail?id=5640 is resolved.
SkIRect bounds = SkIRect::MakeSize(fRenderTargetContext->dimensions());
SkIRect bounds = SkIRect::MakeSize(this->dimensions());
// Setup clip and reject offscreen paths; we do this explicitly instead of relying on addDrawOp
// because GrStencilPathOp is not a draw op as its state depends directly on the choices made
// during this clip application.
GrAppliedHardClip appliedClip(fRenderTargetContext->dimensions(),
fRenderTargetContext->asSurfaceProxy()->backingStoreDimensions());
GrAppliedHardClip appliedClip(this->dimensions(),
this->asSurfaceProxy()->backingStoreDimensions());
if (clip && GrClip::Effect::kClippedOut == clip->apply(&appliedClip, &bounds)) {
return;
@ -976,9 +970,9 @@ void GrRenderTargetContextPriv::stencilPath(const GrHardClip* clip,
// but as it is, we're just using the full render target so intersecting the two bounds would
// do nothing.
GrOp::Owner op = GrStencilPathOp::Make(fRenderTargetContext->fContext,
GrOp::Owner op = GrStencilPathOp::Make(fContext,
viewMatrix,
GrAA::kYes == doStencilMSAA,
doStencilMSAA == GrAA::kYes,
appliedClip.hasStencilClip(),
appliedClip.scissorState(),
std::move(path));
@ -987,8 +981,8 @@ void GrRenderTargetContextPriv::stencilPath(const GrHardClip* clip,
}
op->setClippedBounds(SkRect::Make(bounds));
fRenderTargetContext->setNeedsStencil(GrAA::kYes == doStencilMSAA);
fRenderTargetContext->addOp(std::move(op));
this->setNeedsStencil(GrAA::kYes == doStencilMSAA);
this->addOp(std::move(op));
}
void GrRenderTargetContext::drawTextureSet(const GrClip* clip,
@ -1755,86 +1749,84 @@ static SkIRect get_clip_bounds(const GrRenderTargetContext* rtc, const GrClip* c
return clip ? clip->getConservativeBounds() : SkIRect::MakeWH(rtc->width(), rtc->height());
}
bool GrRenderTargetContextPriv::drawAndStencilPath(const GrHardClip* clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,
GrAA aa,
const SkMatrix& viewMatrix,
const SkPath& path) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_FALSE_IF_ABANDONED_PRIV
SkDEBUGCODE(fRenderTargetContext->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContextPriv", "drawAndStencilPath",
fRenderTargetContext->fContext);
bool GrRenderTargetContext::drawAndStencilPath(const GrHardClip* clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,
GrAA aa,
const SkMatrix& viewMatrix,
const SkPath& path) {
ASSERT_SINGLE_OWNER
RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawAndStencilPath", fContext);
if (path.isEmpty() && path.isInverseFillType()) {
GrPaint paint;
paint.setCoverageSetOpXPFactory(op, invert);
this->stencilRect(clip, ss, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeIWH(fRenderTargetContext->width(),
fRenderTargetContext->height()));
SkRect::Make(this->dimensions()));
return true;
}
AutoCheckFlush acf(fRenderTargetContext->drawingManager());
AutoCheckFlush acf(this->drawingManager());
// An Assumption here is that path renderer would use some form of tweaking
// the src color (either the input alpha or in the frag shader) to implement
// aa. If we have some future driver-mojo path AA that can do the right
// thing WRT to the blend then we'll need some query on the PR.
GrAAType aaType = fRenderTargetContext->chooseAAType(aa);
GrAAType aaType = this->chooseAAType(aa);
bool hasUserStencilSettings = !ss->isUnused();
SkIRect clipConservativeBounds = get_clip_bounds(fRenderTargetContext, clip);
SkIRect clipConservativeBounds = get_clip_bounds(this, clip);
GrPaint paint;
paint.setCoverageSetOpXPFactory(op, invert);
GrStyledShape shape(path, GrStyle::SimpleFill());
GrPathRenderer::CanDrawPathArgs canDrawArgs;
canDrawArgs.fCaps = fRenderTargetContext->caps();
canDrawArgs.fProxy = fRenderTargetContext->asRenderTargetProxy();
canDrawArgs.fCaps = this->caps();
canDrawArgs.fProxy = this->asRenderTargetProxy();
canDrawArgs.fViewMatrix = &viewMatrix;
canDrawArgs.fShape = &shape;
canDrawArgs.fPaint = &paint;
canDrawArgs.fClipConservativeBounds = &clipConservativeBounds;
canDrawArgs.fAAType = aaType;
SkASSERT(!fRenderTargetContext->wrapsVkSecondaryCB());
SkASSERT(!this->wrapsVkSecondaryCB());
canDrawArgs.fTargetIsWrappedVkSecondaryCB = false;
canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings;
// Don't allow the SW renderer
GrPathRenderer* pr = fRenderTargetContext->drawingManager()->getPathRenderer(
GrPathRenderer* pr = this->drawingManager()->getPathRenderer(
canDrawArgs, false, GrPathRendererChain::DrawType::kStencilAndColor);
if (!pr) {
return false;
}
GrPathRenderer::DrawPathArgs args{fRenderTargetContext->drawingManager()->getContext(),
GrPathRenderer::DrawPathArgs args{this->drawingManager()->getContext(),
std::move(paint),
ss,
fRenderTargetContext,
this,
clip,
&clipConservativeBounds,
&viewMatrix,
&shape,
aaType,
fRenderTargetContext->colorInfo().isLinearlyBlended()};
this->colorInfo().isLinearlyBlended()};
pr->drawPath(args);
return true;
}
SkBudgeted GrRenderTargetContextPriv::isBudgeted() const {
ASSERT_SINGLE_OWNER_PRIV
SkBudgeted GrRenderTargetContext::isBudgeted() const {
ASSERT_SINGLE_OWNER
if (fRenderTargetContext->fContext->abandoned()) {
if (fContext->abandoned()) {
return SkBudgeted::kNo;
}
SkDEBUGCODE(fRenderTargetContext->validate();)
SkDEBUGCODE(this->validate();)
return fRenderTargetContext->asSurfaceProxy()->isBudgeted();
return this->asSurfaceProxy()->isBudgeted();
}
void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip* clip,

View File

@ -33,7 +33,6 @@ class GrCoverageCountingPathRenderer;
class GrDrawOp;
class GrOp;
class GrRenderTarget;
class GrRenderTargetContextPriv;
class GrStyledShape;
class GrStyle;
class GrTextureProxy;
@ -560,6 +559,104 @@ public:
*/
void drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
GrOpsTask* getOpsTask();
// called to note the last clip drawn to the stencil buffer.
// TODO: remove after clipping overhaul.
void setLastClip(uint32_t clipStackGenID,
const SkIRect& devClipBounds,
int numClipAnalyticElements) {
GrOpsTask* opsTask = this->getOpsTask();
opsTask->fLastClipStackGenID = clipStackGenID;
opsTask->fLastDevClipBounds = devClipBounds;
opsTask->fLastClipNumAnalyticElements = numClipAnalyticElements;
}
// called to determine if we have to render the clip into SB.
// TODO: remove after clipping overhaul.
bool mustRenderClip(uint32_t clipStackGenID,
const SkIRect& devClipBounds,
int numClipAnalyticElements) {
GrOpsTask* opsTask = this->getOpsTask();
return opsTask->fLastClipStackGenID != clipStackGenID ||
!opsTask->fLastDevClipBounds.contains(devClipBounds) ||
opsTask->fLastClipNumAnalyticElements != numClipAnalyticElements;
}
// Clear at minimum the pixels within 'scissor', but is allowed to clear the full render target
// if that is the more performant option.
void clearAtLeast(const SkIRect& scissor, const SkPMColor4f& color) {
this->internalClear(&scissor, color, /* upgrade to full */ true);
}
void clearStencilClip(const SkIRect& scissor, bool insideStencilMask) {
this->internalStencilClear(&scissor, insideStencilMask);
}
// While this can take a general clip, since GrReducedClip relies on this function, it must take
// care to only provide hard clips or we could get stuck in a loop. The general clip is needed
// so that path renderers can use this function.
void stencilRect(const GrClip* clip,
const GrUserStencilSettings* ss,
GrPaint&& paint,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix* localMatrix = nullptr) {
// Since this provides stencil settings to drawFilledQuad, it performs a different AA type
// resolution compared to regular rect draws, which is the main reason it remains separate.
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix),
localMatrix ? GrQuad::MakeFromRect(rect, *localMatrix) : GrQuad(rect),
GrQuadAAFlags::kNone};
this->drawFilledQuad(clip, std::move(paint), doStencilMSAA, &quad, ss);
}
void stencilPath(const GrHardClip*,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
sk_sp<const GrPath>);
/**
* Draws a path, either AA or not, and touches the stencil buffer with the user stencil settings
* for each color sample written.
*/
bool drawAndStencilPath(const GrHardClip*,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
const SkPath&);
SkBudgeted isBudgeted() const;
int maxWindowRectangles() const;
SkGlyphRunListPainter* glyphRunPainter() { return &fGlyphPainter; }
/*
* This unique ID will not change for a given RenderTargetContext. However, it is _NOT_
* guaranteed to match the uniqueID of the underlying GrRenderTarget - beware!
*/
GrSurfaceProxy::UniqueID uniqueID() const { return this->asSurfaceProxy()->uniqueID(); }
void addOp(GrOp::Owner);
// Allows caller of addDrawOp to know which op list an op will be added to.
using WillAddOpFn = void(GrOp*, uint32_t opsTaskID);
// These perform processing specific to GrDrawOp-derived ops before recording them into an
// op list. Before adding the op to an op list the WillAddOpFn is called. Note that it
// will not be called in the event that the op is discarded. Moreover, the op may merge into
// another op after the function is called (either before addDrawOp returns or some time later).
//
// If the clip pointer is null, no clipping will be performed.
void addDrawOp(const GrClip*,
GrOp::Owner,
const std::function<WillAddOpFn>& = std::function<WillAddOpFn>());
void addDrawOp(GrOp::Owner op) { this->addDrawOp(nullptr, std::move(op)); }
bool refsWrappedObjects() const { return this->asRenderTargetProxy()->refsWrappedObjects(); }
/**
* The next time this GrRenderTargetContext is flushed, the gpu will wait on the passed in
* semaphores before executing any commands.
@ -582,12 +679,7 @@ public:
GrRenderTargetContext* asRenderTargetContext() override { return this; }
// Provides access to functions that aren't part of the public API.
GrRenderTargetContextPriv priv();
const GrRenderTargetContextPriv priv() const; // NOLINT(readability-const-return-type)
#if GR_TEST_UTILS
bool testingOnly_IsInstantiated() const { return this->asSurfaceProxy()->isInstantiated(); }
void testingOnly_SetPreserveOpsOnFullClear() { fPreserveOpsOnFullClear_TestingOnly = true; }
GrOpsTask* testingOnly_PeekLastOpsTask() { return fOpsTask.get(); }
#endif
@ -597,30 +689,8 @@ private:
GrAAType chooseAAType(GrAA);
friend class GrClipStackClip; // for access to getOpsTask
friend class GrClipStack; // ""
friend class GrRenderTargetContextPriv;
// All the path and text renderers/ops currently make their own ops
friend class GrSoftwarePathRenderer; // for access to add[Mesh]DrawOp
friend class GrAAConvexPathRenderer; // for access to add[Mesh]DrawOp
friend class GrDashLinePathRenderer; // for access to add[Mesh]DrawOp
friend class GrAAHairLinePathRenderer; // for access to add[Mesh]DrawOp
friend class GrAALinearizingConvexPathRenderer; // for access to add[Mesh]DrawOp
friend class GrSmallPathRenderer; // for access to add[Mesh]DrawOp
friend class GrDefaultPathRenderer; // for access to add[Mesh]DrawOp
friend class GrStencilAndCoverPathRenderer; // for access to add[Mesh]DrawOp
friend class GrTriangulatingPathRenderer; // for access to add[Mesh]DrawOp
friend class GrCCPerFlushResources; // for access to addDrawOp
friend class GrCoverageCountingPathRenderer; // for access to addDrawOp
friend class GrFillRectOp; // for access to addDrawOp
friend class GrTessellationPathRenderer; // for access to addDrawOp
friend class GrTextureOp; // for access to addDrawOp
SkDEBUGCODE(void onValidate() const override;)
GrOpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const;
void setNeedsStencil(bool useMixedSamplesIfNotMSAA);
@ -680,19 +750,6 @@ private:
void drawShapeUsingPathRenderer(const GrClip*, GrPaint&&, GrAA, const SkMatrix&,
const GrStyledShape&, bool attemptShapeFallback = true);
void addOp(GrOp::Owner);
// Allows caller of addDrawOp to know which op list an op will be added to.
using WillAddOpFn = void(GrOp*, uint32_t opsTaskID);
// These perform processing specific to GrDrawOp-derived ops before recording them into an
// op list. Before adding the op to an op list the WillAddOpFn is called. Note that it
// will not be called in the event that the op is discarded. Moreover, the op may merge into
// another op after the function is called (either before addDrawOp returns or some time later).
//
// If the clip pointer is null, no clipping will be performed.
void addDrawOp(const GrClip*, GrOp::Owner,
const std::function<WillAddOpFn>& = std::function<WillAddOpFn>());
// Makes a copy of the proxy if it is necessary for the draw and places the texture that should
// be used by GrXferProcessor to access the destination color in 'result'. If the return
// value is false then a texture copy could not be made.
@ -701,8 +758,6 @@ private:
bool SK_WARN_UNUSED_RESULT setupDstProxyView(const GrOp& op,
GrXferProcessor::DstProxyView* result);
GrOpsTask* getOpsTask();
SkGlyphRunListPainter* glyphPainter() { return &fGlyphPainter; }
GrSurfaceProxyView fWriteView;

View File

@ -1,139 +0,0 @@
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrRenderTargetContextPriv_DEFINED
#define GrRenderTargetContextPriv_DEFINED
#include "src/gpu/GrOpsTask.h"
#include "src/gpu/GrPathRendering.h"
#include "src/gpu/GrRenderTargetContext.h"
class GrHardClip;
class GrPath;
struct GrUserStencilSettings;
/** Class that adds methods to GrRenderTargetContext that are only intended for use internal to
Skia. This class is purely a privileged window into GrRenderTargetContext. It should never have
additional data members or virtual methods. */
class GrRenderTargetContextPriv {
public:
GrRecordingContext* recordingContext() { return fRenderTargetContext->fContext; }
// called to note the last clip drawn to the stencil buffer.
// TODO: remove after clipping overhaul.
void setLastClip(uint32_t clipStackGenID, const SkIRect& devClipBounds,
int numClipAnalyticElements) {
GrOpsTask* opsTask = fRenderTargetContext->getOpsTask();
opsTask->fLastClipStackGenID = clipStackGenID;
opsTask->fLastDevClipBounds = devClipBounds;
opsTask->fLastClipNumAnalyticElements = numClipAnalyticElements;
}
// called to determine if we have to render the clip into SB.
// TODO: remove after clipping overhaul.
bool mustRenderClip(uint32_t clipStackGenID, const SkIRect& devClipBounds,
int numClipAnalyticElements) const {
GrOpsTask* opsTask = fRenderTargetContext->getOpsTask();
return opsTask->fLastClipStackGenID != clipStackGenID ||
!opsTask->fLastDevClipBounds.contains(devClipBounds) ||
opsTask->fLastClipNumAnalyticElements != numClipAnalyticElements;
}
// Clear at minimum the pixels within 'scissor', but is allowed to clear the full render target
// if that is the more performant option.
void clearAtLeast(const SkIRect& scissor, const SkPMColor4f& color) {
fRenderTargetContext->internalClear(&scissor, color, /* upgrade to full */ true);
}
void clearStencilClip(const SkIRect& scissor, bool insideStencilMask) {
fRenderTargetContext->internalStencilClear(&scissor, insideStencilMask);
}
// While this can take a general clip, since GrReducedClip relies on this function, it must take
// care to only provide hard clips or we could get stuck in a loop. The general clip is needed
// so that path renderers can use this function.
void stencilRect(
const GrClip* clip, const GrUserStencilSettings* ss, GrPaint&& paint,
GrAA doStencilMSAA, const SkMatrix& viewMatrix, const SkRect& rect,
const SkMatrix* localMatrix = nullptr) {
// Since this provides stencil settings to drawFilledQuad, it performs a different AA type
// resolution compared to regular rect draws, which is the main reason it remains separate.
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix),
localMatrix ? GrQuad::MakeFromRect(rect, *localMatrix) : GrQuad(rect),
GrQuadAAFlags::kNone};
fRenderTargetContext->drawFilledQuad(clip, std::move(paint), doStencilMSAA, &quad, ss);
}
void stencilPath(
const GrHardClip*, GrAA doStencilMSAA, const SkMatrix& viewMatrix, sk_sp<const GrPath>);
/**
* Draws a path, either AA or not, and touches the stencil buffer with the user stencil settings
* for each color sample written.
*/
bool drawAndStencilPath(const GrHardClip*,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
const SkPath&);
SkBudgeted isBudgeted() const;
int maxWindowRectangles() const;
/*
* This unique ID will not change for a given RenderTargetContext. However, it is _NOT_
* guaranteed to match the uniqueID of the underlying GrRenderTarget - beware!
*/
GrSurfaceProxy::UniqueID uniqueID() const {
return fRenderTargetContext->asSurfaceProxy()->uniqueID();
}
uint32_t testingOnly_getOpsTaskID();
using WillAddOpFn = GrRenderTargetContext::WillAddOpFn;
void testingOnly_addDrawOp(GrOp::Owner);
void testingOnly_addDrawOp(const GrClip*, GrOp::Owner ,
const std::function<WillAddOpFn>& = std::function<WillAddOpFn>());
SkGlyphRunListPainter* testingOnly_glyphRunPainter() {
return &fRenderTargetContext->fGlyphPainter;
}
bool refsWrappedObjects() const {
return fRenderTargetContext->asRenderTargetProxy()->refsWrappedObjects();
}
void addDrawOp(const GrClip* clip, GrOp::Owner op) {
fRenderTargetContext->addDrawOp(clip, std::move(op));
}
private:
explicit GrRenderTargetContextPriv(GrRenderTargetContext* renderTargetContext)
: fRenderTargetContext(renderTargetContext) {}
GrRenderTargetContextPriv(const GrRenderTargetContextPriv&) = delete;
GrRenderTargetContextPriv& operator=(const GrRenderTargetContextPriv&) = delete;
// No taking addresses of this type.
const GrRenderTargetContextPriv* operator&() const;
GrRenderTargetContextPriv* operator&();
GrRenderTargetContext* fRenderTargetContext;
friend class GrRenderTargetContext; // to construct/copy this type.
};
inline GrRenderTargetContextPriv GrRenderTargetContext::priv() {
return GrRenderTargetContextPriv(this);
}
inline const GrRenderTargetContextPriv GrRenderTargetContext::priv() const { // NOLINT(readability-const-return-type)
return GrRenderTargetContextPriv(const_cast<GrRenderTargetContext*>(this));
}
#endif

View File

@ -20,9 +20,7 @@
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSWMaskHelper.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/geometry/GrStyledShape.h"
#include "src/gpu/ops/GrDrawOp.h"
@ -101,8 +99,8 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetCo
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
renderTargetContext->priv().stencilRect(clip, &userStencilSettings, std::move(paint), GrAA::kNo,
viewMatrix, rect, &localMatrix);
renderTargetContext->stencilRect(clip, &userStencilSettings, std::move(paint), GrAA::kNo,
viewMatrix, rect, &localMatrix);
}
void GrSoftwarePathRenderer::DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,

View File

@ -10,7 +10,6 @@
#include "include/core/SkMatrix.h"
#include "include/core/SkPath.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrStencilSettings.h"
#include "src/gpu/geometry/GrShape.h"
#include "src/gpu/geometry/GrStyledShape.h"
@ -278,7 +277,7 @@ static void draw_stencil_rect(GrRenderTargetContext* rtc, const GrHardClip& clip
const SkRect& rect, GrAA aa) {
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
rtc->priv().stencilRect(&clip, ss, std::move(paint), aa, matrix, rect);
rtc->stencilRect(&clip, ss, std::move(paint), aa, matrix, rect);
}
static void draw_path(GrRecordingContext* context, GrRenderTargetContext* rtc,
@ -337,7 +336,7 @@ static GrAA supported_aa(GrRenderTargetContext* rtc, GrAA aa) {
bool GrStencilMaskHelper::init(const SkIRect& bounds, uint32_t genID,
const GrWindowRectangles& windowRects, int numFPs) {
if (!fRTC->priv().mustRenderClip(genID, bounds, numFPs)) {
if (!fRTC->mustRenderClip(genID, bounds, numFPs)) {
return false;
}
@ -478,10 +477,10 @@ void GrStencilMaskHelper::clear(bool insideStencil) {
GrStencilSettings::SetClipBitSettings(insideStencil), SkMatrix::I(),
SkRect::Make(fClip.fixedClip().scissorRect()), GrAA::kNo);
} else {
fRTC->priv().clearStencilClip(fClip.fixedClip().scissorRect(), insideStencil);
fRTC->clearStencilClip(fClip.fixedClip().scissorRect(), insideStencil);
}
}
void GrStencilMaskHelper::finish() {
fRTC->priv().setLastClip(fClip.stencilStackID(), fClip.fixedClip().scissorRect(), fNumFPs);
fRTC->setLastClip(fClip.stencilStackID(), fClip.fixedClip().scissorRect(), fNumFPs);
}

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
#include "src/gpu/effects/generated/GrColorMatrixFragmentProcessor.h"
@ -127,9 +126,7 @@ const GrDrawingManager* GrSurfaceContext::drawingManager() const {
}
#ifdef SK_DEBUG
GrSingleOwner* GrSurfaceContext::singleOwner() {
return fContext->priv().singleOwner();
}
GrSingleOwner* GrSurfaceContext::singleOwner() const { return fContext->priv().singleOwner(); }
#endif
bool GrSurfaceContext::readPixels(GrDirectContext* dContext, const GrImageInfo& origDstInfo,

View File

@ -27,7 +27,6 @@ class GrRenderTargetContext;
class GrRenderTargetProxy;
class GrSingleOwner;
class GrSurface;
class GrSurfaceContextPriv;
class GrSurfaceProxy;
class GrTextureProxy;
struct SkIPoint;
@ -58,6 +57,8 @@ public:
virtual ~GrSurfaceContext() = default;
GrRecordingContext* recordingContext() { return fContext; }
const GrColorInfo& colorInfo() const { return fColorInfo; }
GrImageInfo imageInfo() const { return {fColorInfo, fReadView.proxy()->dimensions()}; }
@ -160,10 +161,6 @@ public:
GrAuditTrail* auditTrail();
// Provides access to functions that aren't part of the public API.
GrSurfaceContextPriv surfPriv();
const GrSurfaceContextPriv surfPriv() const; // NOLINT(readability-const-return-type)
#if GR_TEST_UTILS
bool testCopy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) {
return this->copy(src, srcRect, dstPoint);
@ -175,14 +172,12 @@ public:
#endif
protected:
friend class GrSurfaceContextPriv;
GrDrawingManager* drawingManager();
const GrDrawingManager* drawingManager() const;
SkDEBUGCODE(void validate() const;)
SkDEBUGCODE(GrSingleOwner* singleOwner();)
SkDEBUGCODE(GrSingleOwner* singleOwner() const;)
GrRecordingContext* fContext;

View File

@ -1,45 +0,0 @@
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrSurfaceContextPriv_DEFINED
#define GrSurfaceContextPriv_DEFINED
#include "src/gpu/GrSurfaceContext.h"
/** Class that adds methods to GrSurfaceContext that are only intended for use internal to
Skia. This class is purely a privileged window into GrSurfaceContext. It should never have
additional data members or virtual methods. */
class GrSurfaceContextPriv {
public:
GrRecordingContext* getContext() { return fSurfaceContext->fContext; }
private:
explicit GrSurfaceContextPriv(GrSurfaceContext* surfaceContext)
: fSurfaceContext(surfaceContext) {
}
GrSurfaceContextPriv(const GrSurfaceContextPriv&) = delete;
GrSurfaceContextPriv& operator=(const GrSurfaceContextPriv&) = delete;
// No taking addresses of this type.
const GrSurfaceContextPriv* operator&() const;
GrSurfaceContextPriv* operator&();
GrSurfaceContext* fSurfaceContext;
friend class GrSurfaceContext; // to construct/copy this type.
};
inline GrSurfaceContextPriv GrSurfaceContext::surfPriv() {
return GrSurfaceContextPriv(this);
}
inline const GrSurfaceContextPriv GrSurfaceContext::surfPriv() const { // NOLINT(readability-const-return-type)
return GrSurfaceContextPriv(const_cast<GrSurfaceContext*>(this));
}
#endif

View File

@ -37,7 +37,6 @@
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrImageTextureMaker.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
#include "src/gpu/GrTextureAdjuster.h"
@ -202,7 +201,7 @@ void SkGpuDevice::clearAll() {
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext.get());
SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
fRenderTargetContext->priv().clearAtLeast(rect, SK_PMColor4fTRANSPARENT);
fRenderTargetContext->clearAtLeast(rect, SK_PMColor4fTRANSPARENT);
}
void SkGpuDevice::replaceRenderTargetContext(std::unique_ptr<GrRenderTargetContext> rtc,
@ -228,7 +227,7 @@ void SkGpuDevice::replaceRenderTargetContext(std::unique_ptr<GrRenderTargetConte
void SkGpuDevice::replaceRenderTargetContext(SkSurface::ContentChangeMode mode) {
ASSERT_SINGLE_OWNER
SkBudgeted budgeted = fRenderTargetContext->priv().isBudgeted();
SkBudgeted budgeted = fRenderTargetContext->isBudgeted();
// This entry point is used by SkSurface_Gpu::onCopyOnWrite so it must create a
// kExact-backed render target context.

View File

@ -12,7 +12,6 @@
#include "src/gpu/GrOnFlushResourceProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/ccpr/GrCCPathCache.h"
#include "src/gpu/ccpr/GrGSCoverageProcessor.h"
#include "src/gpu/ccpr/GrSampleMaskProcessor.h"
@ -537,9 +536,9 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP) {
const CopyPathRange& copyRange = fCopyPathRanges[copyRangeIdx];
int endCopyInstance = baseCopyInstance + copyRange.fCount;
if (rtc) {
auto op = CopyAtlasOp::Make(
rtc->surfPriv().getContext(), sk_ref_sp(this), copyRange.fSrcProxy,
baseCopyInstance, endCopyInstance, atlas.drawBounds());
auto op = CopyAtlasOp::Make(rtc->recordingContext(), sk_ref_sp(this),
copyRange.fSrcProxy, baseCopyInstance, endCopyInstance,
atlas.drawBounds());
rtc->addDrawOp(nullptr, std::move(op));
}
baseCopyInstance = endCopyInstance;
@ -567,16 +566,16 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP) {
GrOp::Owner op;
if (CoverageType::kA8_Multisample == fRenderedAtlasStack.coverageType()) {
op = GrStencilAtlasOp::Make(
rtc->surfPriv().getContext(), sk_ref_sp(this), atlas.getFillBatchID(),
rtc->recordingContext(), sk_ref_sp(this), atlas.getFillBatchID(),
atlas.getStrokeBatchID(), baseStencilResolveInstance,
atlas.getEndStencilResolveInstance(), atlas.drawBounds());
} else if (onFlushRP->caps()->shaderCaps()->geometryShaderSupport()) {
op = RenderAtlasOp<GrGSCoverageProcessor>::Make(
rtc->surfPriv().getContext(), sk_ref_sp(this), atlas.getFillBatchID(),
rtc->recordingContext(), sk_ref_sp(this), atlas.getFillBatchID(),
atlas.getStrokeBatchID(), atlas.drawBounds());
} else {
op = RenderAtlasOp<GrVSCoverageProcessor>::Make(
rtc->surfPriv().getContext(), sk_ref_sp(this), atlas.getFillBatchID(),
rtc->recordingContext(), sk_ref_sp(this), atlas.getFillBatchID(),
atlas.getStrokeBatchID(), atlas.drawBounds());
}
rtc->addDrawOp(nullptr, std::move(op));

View File

@ -19,7 +19,6 @@
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBitmapTextGeoProc.h"
@ -454,12 +453,11 @@ GrOp::Owner GrAtlasTextOp::CreateOpTestingOnly(GrRenderTargetContext* rtc,
return nullptr;
}
auto rContext = rtc->priv().recordingContext();
auto rContext = rtc->recordingContext();
GrSDFTOptions SDFOptions = rContext->priv().SDFTOptions();
sk_sp<GrTextBlob> blob = GrTextBlob::Make(glyphRunList, drawMatrix);
SkGlyphRunListPainter* painter = rtc->priv().testingOnly_glyphRunPainter();
SkGlyphRunListPainter* painter = rtc->glyphRunPainter();
painter->processGlyphRun(
*glyphRunList.begin(),
drawMatrix, glyphRunList.origin(),

View File

@ -20,10 +20,8 @@
#include "src/gpu/GrDrawOpTest.h"
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSimpleMesh.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/geometry/GrPathUtils.h"
#include "src/gpu/geometry/GrStyledShape.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
@ -543,7 +541,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
const SkMatrix& viewMatrix,
const GrStyledShape& shape,
bool stencilOnly) {
auto context = renderTargetContext->surfPriv().getContext();
auto context = renderTargetContext->recordingContext();
SkASSERT(GrAAType::kCoverage != aaType);
SkPath path;
@ -657,8 +655,9 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
viewMatrix;
// This is a non-coverage aa rect op since we assert aaType != kCoverage at the start
assert_alive(paint);
renderTargetContext->priv().stencilRect(clip, passes[p], std::move(paint),
GrAA(aaType == GrAAType::kMSAA), viewM, bounds, &localMatrix);
renderTargetContext->stencilRect(clip, passes[p], std::move(paint),
GrAA(aaType == GrAAType::kMSAA), viewM, bounds,
&localMatrix);
} else {
bool stencilPass = stencilOnly || passCount > 1;
GrOp::Owner op;

View File

@ -9,7 +9,6 @@
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrPath.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrStencilClip.h"
#include "src/gpu/GrStyle.h"
@ -97,8 +96,8 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onStencilPath");
sk_sp<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
args.fRenderTargetContext->priv().stencilPath(
args.fClip, args.fDoStencilMSAA, *args.fViewMatrix, std::move(p));
args.fRenderTargetContext->stencilPath(args.fClip, args.fDoStencilMSAA, *args.fViewMatrix,
std::move(p));
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
@ -140,8 +139,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
// Just ignore the analytic FPs (if any) during the stencil pass. They will still clip the
// final draw and it is meaningless to multiply by coverage when drawing to stencil.
args.fRenderTargetContext->priv().stencilPath(
&stencilClip, GrAA(stencilAAType == GrAAType::kMSAA), viewMatrix, std::move(path));
args.fRenderTargetContext->stencilPath(&stencilClip, GrAA(stencilAAType == GrAAType::kMSAA),
viewMatrix, std::move(path));
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@ -174,9 +173,9 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
// We have to suppress enabling MSAA for mixed samples or we will get seams due to
// coverage modulation along the edge where two triangles making up the rect meet.
GrAA coverAA = GrAA(args.fAAType == GrAAType::kMSAA);
args.fRenderTargetContext->priv().stencilRect(
args.fClip, &kInvertedCoverPass, std::move(args.fPaint), coverAA,
coverMatrix, coverBounds, &localMatrix);
args.fRenderTargetContext->stencilRect(args.fClip, &kInvertedCoverPass,
std::move(args.fPaint), coverAA, coverMatrix,
coverBounds, &localMatrix);
}
} else {
GrOp::Owner op = GrDrawPathOp::Make(

View File

@ -14,7 +14,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/geometry/GrStyledShape.h"
#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/tessellate/GrDrawAtlasPathOp.h"
@ -446,8 +445,8 @@ void GrTessellationPathRenderer::renderAtlas(GrOnFlushResourceProvider* onFlushR
GrPaint paint;
paint.setColor4f(SK_PMColor4fWHITE);
auto coverOp = GrFillRectOp::Make(rtc->surfPriv().getContext(), std::move(paint), aaType,
&drawQuad, stencil, fillRectFlags);
auto coverOp = GrFillRectOp::Make(rtc->recordingContext(), std::move(paint), aaType, &drawQuad,
stencil, fillRectFlags);
rtc->addDrawOp(nullptr, std::move(coverOp));
if (rtc->asSurfaceProxy()->requiresManualMSAAResolve()) {

View File

@ -18,7 +18,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
@ -79,7 +78,7 @@ SkPMColor4f calculate_colors(GrRenderTargetContext* rtc,
const SkMatrixProvider& matrix,
GrMaskFormat grMaskFormat,
GrPaint* grPaint) {
GrRecordingContext* rContext = rtc->priv().recordingContext();
GrRecordingContext* rContext = rtc->recordingContext();
const GrColorInfo& colorInfo = rtc->colorInfo();
if (grMaskFormat == kARGB_GrMaskFormat) {
SkPaintToGrPaintWithPrimitiveColor(rContext, colorInfo, paint, matrix, grPaint);
@ -244,8 +243,8 @@ void PathSubRun::draw(const GrClip* clip,
SkPreConcatMatrixProvider strikeToDevice(viewMatrix, pathMatrix);
GrStyledShape shape(path, drawPaint);
GrBlurUtils::drawShapeWithMaskFilter(
rtc->priv().recordingContext(), rtc, clip, runPaint, strikeToDevice, shape);
GrBlurUtils::drawShapeWithMaskFilter(rtc->recordingContext(), rtc, clip, runPaint,
strikeToDevice, shape);
}
} else {
// Transform the path to device because the deviceMatrix must be unchanged to
@ -261,8 +260,8 @@ void PathSubRun::draw(const GrClip* clip,
path.transform(pathMatrix, &deviceOutline);
deviceOutline.setIsVolatile(true);
GrStyledShape shape(deviceOutline, drawPaint);
GrBlurUtils::drawShapeWithMaskFilter(
rtc->priv().recordingContext(), rtc, clip, runPaint, viewMatrix, shape);
GrBlurUtils::drawShapeWithMaskFilter(rtc->recordingContext(), rtc, clip, runPaint,
viewMatrix, shape);
}
}
}
@ -569,7 +568,7 @@ void DirectMaskSubRun::draw(const GrClip* clip, const SkMatrixProvider& viewMatr
const SkGlyphRunList& glyphRunList, GrRenderTargetContext* rtc) const{
auto[drawingClip, op] = this->makeAtlasTextOp(clip, viewMatrix, glyphRunList, rtc);
if (op != nullptr) {
rtc->priv().addDrawOp(drawingClip, std::move(op));
rtc->addDrawOp(drawingClip, std::move(op));
}
}
@ -664,7 +663,7 @@ DirectMaskSubRun::makeAtlasTextOp(const GrClip* clip, const SkMatrixProvider& vi
drawingColor
};
GrRecordingContext* const context = rtc->priv().recordingContext();
GrRecordingContext* const context = rtc->recordingContext();
GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(context,
op_mask_type(fMaskFormat),
false,
@ -923,7 +922,7 @@ void TransformedMaskSubRun::draw(const GrClip* clip,
GrRenderTargetContext* rtc) const {
auto[drawingClip, op] = this->makeAtlasTextOp(clip, viewMatrix, glyphRunList, rtc);
if (op != nullptr) {
rtc->priv().addDrawOp(drawingClip, std::move(op));
rtc->addDrawOp(drawingClip, std::move(op));
}
}
@ -961,7 +960,7 @@ TransformedMaskSubRun::makeAtlasTextOp(const GrClip* clip,
drawingColor
};
GrRecordingContext* context = rtc->priv().recordingContext();
GrRecordingContext* context = rtc->recordingContext();
GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(
context,
op_mask_type(fMaskFormat),
@ -1245,7 +1244,7 @@ SDFTSubRun::makeAtlasTextOp(const GrClip* clip,
drawingColor
};
GrRecordingContext* context = rtc->priv().recordingContext();
GrRecordingContext* context = rtc->recordingContext();
GrOp::Owner op = GrOp::Make<GrAtlasTextOp>(
context,
maskType,
@ -1267,7 +1266,7 @@ void SDFTSubRun::draw(const GrClip* clip,
GrRenderTargetContext* rtc) const {
auto[drawingClip, op] = this->makeAtlasTextOp(clip, viewMatrix, glyphRunList, rtc);
if (op != nullptr) {
rtc->priv().addDrawOp(drawingClip, std::move(op));
rtc->addDrawOp(drawingClip, std::move(op));
}
}

View File

@ -20,7 +20,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/SkGpuDevice.h"
#include "src/image/SkImage_Base.h"
@ -114,7 +113,7 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(const SkIRect* subset) {
SkBudgeted budgeted = rtc->asSurfaceProxy()->isBudgeted();
GrSurfaceProxyView srcView = rtc->readSurfaceView();
if (subset || !srcView.asTextureProxy() || rtc->priv().refsWrappedObjects()) {
if (subset || !srcView.asTextureProxy() || rtc->refsWrappedObjects()) {
// If the original render target is a buffer originally created by the client, then we don't
// want to ever retarget the SkSurface at another buffer we create. Force a copy now to
// avoid copy-on-write.
@ -148,7 +147,7 @@ void SkSurface_Gpu::onAsyncRescaleAndReadPixels(const SkImageInfo& info,
ReadPixelsContext context) {
auto* rtc = this->fDevice->accessRenderTargetContext();
// Context TODO: Elevate direct context requirement to public API.
auto dContext = rtc->priv().recordingContext()->asDirectContext();
auto dContext = rtc->recordingContext()->asDirectContext();
if (!dContext) {
return;
}
@ -166,7 +165,7 @@ void SkSurface_Gpu::onAsyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSp
ReadPixelsContext context) {
auto* rtc = this->fDevice->accessRenderTargetContext();
// Context TODO: Elevate direct context requirement to public API.
auto dContext = rtc->priv().recordingContext()->asDirectContext();
auto dContext = rtc->recordingContext()->asDirectContext();
if (!dContext) {
return;
}

View File

@ -10,7 +10,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/ops/GrTextureOp.h"
#include "tests/Test.h"
@ -157,7 +156,7 @@ static void textureop_creation_test(skiatest::Reporter* reporter, GrDirectContex
overallAA,
&quad,
nullptr);
rtc->priv().testingOnly_addDrawOp(nullptr, std::move(op));
rtc->addDrawOp(nullptr, std::move(op));
}
} else {
GrTextureOp::AddTextureSetOps(rtc.get(),

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrPathRenderer.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/ccpr/GrCCPathCache.h"
#include "src/gpu/ccpr/GrCoverageCountingPathRenderer.h"
@ -45,10 +44,9 @@ private:
Effect apply(GrRecordingContext* context, GrRenderTargetContext* rtc, GrAAType,
bool hasUserStencilSettings, GrAppliedClip* out,
SkRect* bounds) const override {
out->addCoverageFP(fCCPR->makeClipProcessor(/*inputFP=*/nullptr,
rtc->priv().testingOnly_getOpsTaskID(), fPath,
SkIRect::MakeWH(rtc->width(), rtc->height()),
*context->priv().caps()));
out->addCoverageFP(fCCPR->makeClipProcessor(
/*inputFP=*/nullptr, rtc->getOpsTask()->uniqueID(), fPath,
SkIRect::MakeWH(rtc->width(), rtc->height()), *context->priv().caps()));
return Effect::kClipped;
}

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrOpsRenderPass.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
@ -600,7 +599,7 @@ static void run_test(GrDirectContext* dContext, const char* testName,
SkAutoSTMalloc<kImageHeight * kImageWidth, uint32_t> resultPx(h * rowBytes);
rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad));
rtc->priv().testingOnly_addDrawOp(GrMeshTestOp::Make(dContext, prepareFn, executeFn));
rtc->addDrawOp(GrMeshTestOp::Make(dContext, prepareFn, executeFn));
rtc->readPixels(dContext, gold.info(), resultPx, rowBytes, {0, 0});

View File

@ -20,7 +20,6 @@
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
@ -229,8 +228,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo
for (GrScissorTest scissorTest : {GrScissorTest::kEnabled, GrScissorTest::kDisabled}) {
rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad));
rtc->priv().testingOnly_addDrawOp(
GrPipelineDynamicStateTestOp::Make(dContext, scissorTest, vbuff));
rtc->addDrawOp(GrPipelineDynamicStateTestOp::Make(dContext, scissorTest, vbuff));
auto ii = SkImageInfo::Make(kScreenSize, kScreenSize,
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
rtc->readPixels(dContext, ii, resultPx, 4 * kScreenSize, {0, 0});

View File

@ -19,7 +19,6 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrThreadSafeCache.h"
#include "tests/Test.h"
@ -615,7 +614,7 @@ void TestHelper::addVertAccess(SkCanvas* canvas,
*createdOp = (GrThreadSafeVertexTestOp*) op.get();
}
rtc->priv().testingOnly_addDrawOp(std::move(op));
rtc->addDrawOp(std::move(op));
}
GrSurfaceProxyView TestHelper::CreateViewOnCpu(GrRecordingContext* rContext,

View File

@ -16,7 +16,6 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
#include "src/gpu/GrTexture.h"
@ -213,8 +212,8 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
ctx.get(), GrColorType::kAlpha_F16, nullptr, SkBackingFit::kExact, {10, 10});
REPORTER_ASSERT(reporter, mockAtlas);
LazyProxyTest::Clip clip(&test, mockAtlas->asTextureProxy());
rtc->priv().testingOnly_addDrawOp(
&clip, LazyProxyTest::Op::Make(ctx.get(), proxyProvider, &test, nullTexture));
rtc->addDrawOp(&clip,
LazyProxyTest::Op::Make(ctx.get(), proxyProvider, &test, nullTexture));
ctx->priv().testingOnly_flushAndRemoveOnFlushCallbackObject(&test);
}
}
@ -388,8 +387,8 @@ DEF_GPUTEST(LazyProxyFailedInstantiationTest, reporter, /* options */) {
rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad));
int executeTestValue = 0;
rtc->priv().testingOnly_addDrawOp(LazyFailedInstantiationTestOp::Make(
ctx.get(), proxyProvider, &executeTestValue, failInstantiation));
rtc->addDrawOp(LazyFailedInstantiationTestOp::Make(ctx.get(), proxyProvider,
&executeTestValue, failInstantiation));
ctx->flushAndSubmit();
if (failInstantiation) {

View File

@ -17,7 +17,7 @@
#include "src/gpu/GrOnFlushResourceProvider.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/effects/GrTextureEffect.h"
@ -410,7 +410,7 @@ public:
paint.setColor4f(op->color());
std::unique_ptr<GrDrawOp> drawOp(NonAARectOp::Make(std::move(paint),
SkRect::Make(r)));
rtc->priv().testingOnly_addDrawOp(std::move(drawOp));
rtc->addDrawOp(std::move(drawOp));
#endif
blocksInAtlas++;
@ -484,8 +484,8 @@ static GrSurfaceProxyView make_upstream_image(GrRecordingContext* rContext,
AtlasedRectOp* sparePtr = (AtlasedRectOp*)op.get();
uint32_t opsTaskID;
rtc->priv().testingOnly_addDrawOp(nullptr, std::move(op),
[&opsTaskID](GrOp* op, uint32_t id) { opsTaskID = id; });
rtc->addDrawOp(nullptr, std::move(op),
[&opsTaskID](GrOp* op, uint32_t id) { opsTaskID = id; });
SkASSERT(SK_InvalidUniqueID != opsTaskID);
object->addOp(opsTaskID, sparePtr);

View File

@ -22,7 +22,6 @@
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
#include "src/gpu/glsl/GrGLSLVarying.h"
@ -197,14 +196,14 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
GrPaint grPaint;
// This one should succeed.
renderTargetContext->priv().testingOnly_addDrawOp(Op::Make(context, attribCnt));
renderTargetContext->addDrawOp(Op::Make(context, attribCnt));
context->flushAndSubmit();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 1);
REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 0);
#endif
context->priv().resetGpuStats();
renderTargetContext->priv().testingOnly_addDrawOp(Op::Make(context, attribCnt + 1));
renderTargetContext->addDrawOp(Op::Make(context, attribCnt + 1));
context->flushAndSubmit();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 0);

View File

@ -16,7 +16,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
@ -177,10 +176,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
clone = fp->clone();
}
GrOp::Owner op = TestOp::Make(context, std::move(fp));
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
if (clone) {
op = TestOp::Make(context, std::move(clone));
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
}
@ -237,7 +236,7 @@ void test_draw_op(GrRecordingContext* rContext,
auto op = GrFillRectOp::MakeNonAARect(rContext, std::move(paint), SkMatrix::I(),
SkRect::MakeWH(rtc->width(), rtc->height()));
rtc->priv().testingOnly_addDrawOp(std::move(op));
rtc->addDrawOp(std::move(op));
}
// The output buffer must be the same size as the render-target context.

View File

@ -18,7 +18,6 @@
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrPipeline.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"

View File

@ -12,7 +12,6 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/SkGr.h"
#ifdef SK_GL

View File

@ -25,7 +25,7 @@ static std::unique_ptr<GrRenderTargetContext> get_rtc(GrRecordingContext* rConte
static void check_instantiation_status(skiatest::Reporter* reporter,
GrRenderTargetContext* rtCtx,
bool wrappedExpectation) {
REPORTER_ASSERT(reporter, rtCtx->testingOnly_IsInstantiated() == wrappedExpectation);
REPORTER_ASSERT(reporter, rtCtx->asRenderTargetProxy()->isInstantiated() == wrappedExpectation);
GrTextureProxy* tProxy = rtCtx->asTextureProxy();
REPORTER_ASSERT(reporter, tProxy);

View File

@ -8,7 +8,6 @@
#include "tests/Test.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
static void run_test(skiatest::Reporter*, GrDirectContext*, GrRenderTargetContext*, SkVector a,

View File

@ -20,11 +20,9 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrSemaphore.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/ccpr/GrCCPathCache.h"
@ -52,34 +50,6 @@ int GrResourceCache::countUniqueKeysWithTag(const char* tag) const {
}
#endif
///////////////////////////////////////////////////////////////////////////////
#define ASSERT_SINGLE_OWNER GR_ASSERT_SINGLE_OWNER(fRenderTargetContext->singleOwner())
uint32_t GrRenderTargetContextPriv::testingOnly_getOpsTaskID() {
return fRenderTargetContext->getOpsTask()->uniqueID();
}
void GrRenderTargetContextPriv::testingOnly_addDrawOp(GrOp::Owner op) {
this->testingOnly_addDrawOp(nullptr, std::move(op), {});
}
void GrRenderTargetContextPriv::testingOnly_addDrawOp(
const GrClip* clip,
GrOp::Owner op,
const std::function<GrRenderTargetContext::WillAddOpFn>& willAddFn) {
ASSERT_SINGLE_OWNER
if (fRenderTargetContext->fContext->abandoned()) {
return;
}
SkDEBUGCODE(fRenderTargetContext->validate());
GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->auditTrail(),
"GrRenderTargetContext::testingOnly_addDrawOp");
fRenderTargetContext->addDrawOp(clip, std::move(op), willAddFn);
}
#undef ASSERT_SINGLE_OWNER
//////////////////////////////////////////////////////////////////////////////
void GrCoverageCountingPathRenderer::testingOnly_drawPathDirectly(const DrawPathArgs& args) {
@ -168,7 +138,7 @@ DRAW_OP_TEST_EXTERN(TriangulatingPathOp);
DRAW_OP_TEST_EXTERN(TextureOp);
void GrDrawRandomOp(SkRandom* random, GrRenderTargetContext* renderTargetContext, GrPaint&& paint) {
auto context = renderTargetContext->surfPriv().getContext();
auto context = renderTargetContext->recordingContext();
using MakeDrawOpFn = GrOp::Owner (GrPaint&&, SkRandom*,
GrRecordingContext*, int numSamples);
static constexpr MakeDrawOpFn* gFactories[] = {
@ -203,6 +173,6 @@ void GrDrawRandomOp(SkRandom* random, GrRenderTargetContext* renderTargetContext
// Creating a GrAtlasTextOp my not produce an op if for example, it is totally outside the
// render target context.
if (op) {
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
renderTargetContext->addDrawOp(std::move(op));
}
}