Cruft leftover from GrSurfaceContext hierarchy v1/v2 split
Non-substantive changes that didn't fit any earlier CL in the chain. Bug: skia:11837 Change-Id: Ic9b7c05c014b03ab5b30532098fb8cd2da846d9a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428958 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
ae85ea6154
commit
643f481b15
@ -12,6 +12,7 @@
|
||||
#include "src/gpu/GrDirectContextPriv.h"
|
||||
#include "src/gpu/GrPaint.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrThreadSafeCache.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
#include "src/gpu/effects/GrSkSLFP.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/geometry/GrStyledShape.h"
|
||||
|
@ -282,10 +282,10 @@ sk_sp<SkSpecialImage> SkDisplacementMapImageFilter::onFilterImage(const Context&
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
if (ctx.gpuBacked()) {
|
||||
auto context = ctx.getContext();
|
||||
auto rContext = ctx.getContext();
|
||||
|
||||
GrSurfaceProxyView colorView = color->view(context);
|
||||
GrSurfaceProxyView displView = displ->view(context);
|
||||
GrSurfaceProxyView colorView = color->view(rContext);
|
||||
GrSurfaceProxyView displView = displ->view(rContext);
|
||||
if (!colorView.proxy() || !displView.proxy()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -303,7 +303,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapImageFilter::onFilterImage(const Context&
|
||||
offsetMatrix,
|
||||
std::move(colorView),
|
||||
color->subset(),
|
||||
*context->priv().caps());
|
||||
*rContext->priv().caps());
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp),
|
||||
color->getColorSpace(), color->alphaType(),
|
||||
ctx.colorSpace(), kPremul_SkAlphaType);
|
||||
@ -311,12 +311,12 @@ sk_sp<SkSpecialImage> SkDisplacementMapImageFilter::onFilterImage(const Context&
|
||||
kPremul_SkAlphaType,
|
||||
ctx.refColorSpace(),
|
||||
bounds.size());
|
||||
auto sfc = context->priv().makeSFC(info,
|
||||
SkBackingFit::kApprox,
|
||||
1,
|
||||
GrMipmapped::kNo,
|
||||
isProtected,
|
||||
kBottomLeft_GrSurfaceOrigin);
|
||||
auto sfc = rContext->priv().makeSFC(info,
|
||||
SkBackingFit::kApprox,
|
||||
1,
|
||||
GrMipmapped::kNo,
|
||||
isProtected,
|
||||
kBottomLeft_GrSurfaceOrigin);
|
||||
if (!sfc) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -327,7 +327,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapImageFilter::onFilterImage(const Context&
|
||||
|
||||
offset->fX = bounds.left();
|
||||
offset->fY = bounds.top();
|
||||
return SkSpecialImage::MakeDeferredFromGpu(context,
|
||||
return SkSpecialImage::MakeDeferredFromGpu(rContext,
|
||||
SkIRect::MakeWH(bounds.width(), bounds.height()),
|
||||
kNeedNewImageUniqueID_SpecialImage,
|
||||
sfc->readSurfaceView(),
|
||||
|
@ -13,16 +13,15 @@
|
||||
#include "src/core/SkDevice.h"
|
||||
|
||||
class GrRenderTargetProxy;
|
||||
namespace skgpu {
|
||||
class SurfaceFillContext;
|
||||
#if SK_GPU_V1
|
||||
namespace v1 { class SurfaceDrawContext; }
|
||||
#endif // SK_GPU_V1
|
||||
}
|
||||
class GrSurfaceProxyView;
|
||||
|
||||
namespace skgpu {
|
||||
|
||||
class SurfaceFillContext;
|
||||
#if SK_GPU_V1
|
||||
namespace v1 { class SurfaceDrawContext; }
|
||||
#endif // SK_GPU_V1
|
||||
|
||||
class BaseDevice : public SkBaseDevice {
|
||||
public:
|
||||
enum InitContents {
|
||||
@ -37,10 +36,10 @@ public:
|
||||
BaseDevice* asGpuDevice() override { return this; }
|
||||
|
||||
#if SK_GPU_V1
|
||||
virtual skgpu::v1::SurfaceDrawContext* surfaceDrawContext() { return nullptr; }
|
||||
virtual v1::SurfaceDrawContext* surfaceDrawContext() { return nullptr; }
|
||||
#endif
|
||||
|
||||
virtual skgpu::SurfaceFillContext* surfaceFillContext() = 0;
|
||||
virtual SurfaceFillContext* surfaceFillContext() = 0;
|
||||
GrRenderTargetProxy* targetProxy();
|
||||
GrRecordingContext* recordingContext() const { return fContext.get(); }
|
||||
|
||||
|
@ -14,7 +14,6 @@ class GrClip;
|
||||
class GrPaint;
|
||||
class GrRecordingContext;
|
||||
class GrRenderTarget;
|
||||
namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
|
||||
class GrStyledShape;
|
||||
class GrStyle;
|
||||
struct SkIRect;
|
||||
@ -24,7 +23,7 @@ class SkMatrix;
|
||||
class SkPaint;
|
||||
class SkPath;
|
||||
class SkPathEffect;
|
||||
|
||||
namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
|
||||
|
||||
/**
|
||||
* Blur utilities.
|
||||
|
@ -16,10 +16,12 @@
|
||||
#if SK_GPU_V1
|
||||
#include "src/gpu/v1/Device_v1.h"
|
||||
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
|
||||
#include "src/gpu/v1/SurfaceFillContext_v1.h"
|
||||
#endif
|
||||
#if SK_GPU_V2
|
||||
#include "src/gpu/SurfaceFillContext.h"
|
||||
#include "src/gpu/v2/Device_v2.h"
|
||||
#include "src/gpu/v2/SurfaceDrawContext_v2.h"
|
||||
#include "src/gpu/v2/SurfaceFillContext_v2.h"
|
||||
#endif
|
||||
|
||||
void GrRecordingContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
|
||||
|
@ -175,11 +175,11 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask(
|
||||
dstRect, invert);
|
||||
}
|
||||
|
||||
static GrSurfaceProxyView make_deferred_mask_texture_view(GrRecordingContext* context,
|
||||
static GrSurfaceProxyView make_deferred_mask_texture_view(GrRecordingContext* rContext,
|
||||
SkBackingFit fit,
|
||||
SkISize dimensions) {
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
GrProxyProvider* proxyProvider = rContext->priv().proxyProvider();
|
||||
const GrCaps* caps = rContext->priv().caps();
|
||||
|
||||
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
|
||||
GrRenderable::kNo);
|
||||
|
@ -180,11 +180,11 @@ public:
|
||||
std::unique_ptr<PathGlyph[], GrSubRunAllocator::ArrayDestroyer> pathData);
|
||||
|
||||
#if SK_GPU_V1
|
||||
void draw(const GrClip* clip,
|
||||
void draw(const GrClip*,
|
||||
const SkMatrixProvider& viewMatrix,
|
||||
const SkGlyphRunList& glyphRunList,
|
||||
const SkPaint& paint,
|
||||
skgpu::v1::SurfaceDrawContext* sdc) const override;
|
||||
const SkGlyphRunList&,
|
||||
const SkPaint&,
|
||||
skgpu::v1::SurfaceDrawContext*) const override;
|
||||
#endif
|
||||
|
||||
bool canReuse(const SkPaint& paint, const SkMatrix& drawMatrix) const override;
|
||||
|
@ -38,6 +38,7 @@ class SkSurfaceProps;
|
||||
class SkTextBlob;
|
||||
class SkTextBlobRunIterator;
|
||||
|
||||
namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
|
||||
|
||||
// -- GrAtlasSubRun --------------------------------------------------------------------------------
|
||||
// GrAtlasSubRun is the API that GrAtlasTextOp uses to generate vertex data for drawing.
|
||||
|
@ -410,7 +410,7 @@ void draw_texture(skgpu::v1::SurfaceDrawContext* sdc,
|
||||
}
|
||||
|
||||
// Assumes srcRect and dstRect have already been optimized to fit the proxy.
|
||||
void draw_image(GrRecordingContext* context,
|
||||
void draw_image(GrRecordingContext* rContext,
|
||||
skgpu::v1::SurfaceDrawContext* sdc,
|
||||
const GrClip* clip,
|
||||
const SkMatrixProvider& matrixProvider,
|
||||
@ -431,7 +431,7 @@ void draw_image(GrRecordingContext* context,
|
||||
can_use_draw_texture(paint, sampling.useCubic, sampling.mipmap)) {
|
||||
// We've done enough checks above to allow us to pass ClampNearest() and not check for
|
||||
// scaling adjustments.
|
||||
auto [view, ct] = image.asView(context, GrMipmapped::kNo);
|
||||
auto [view, ct] = image.asView(rContext, GrMipmapped::kNo);
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
@ -501,7 +501,7 @@ void draw_image(GrRecordingContext* context,
|
||||
const SkRect* subset = restrictToSubset ? &src : nullptr;
|
||||
const SkRect* domain = coordsAllInsideSrcRect ? &src : nullptr;
|
||||
SkTileMode tileModes[] = {tm, tm};
|
||||
std::unique_ptr<GrFragmentProcessor> fp = image.asFragmentProcessor(context,
|
||||
std::unique_ptr<GrFragmentProcessor> fp = image.asFragmentProcessor(rContext,
|
||||
sampling,
|
||||
tileModes,
|
||||
textureMatrix,
|
||||
@ -517,7 +517,7 @@ void draw_image(GrRecordingContext* context,
|
||||
}
|
||||
|
||||
GrPaint grPaint;
|
||||
if (!SkPaintToGrPaintWithTexture(context,
|
||||
if (!SkPaintToGrPaintWithTexture(rContext,
|
||||
sdc->colorInfo(),
|
||||
paint,
|
||||
matrixProvider,
|
||||
@ -558,7 +558,7 @@ void draw_image(GrRecordingContext* context,
|
||||
}
|
||||
|
||||
GrBlurUtils::drawShapeWithMaskFilter(
|
||||
context, sdc, clip, shape, std::move(grPaint), ctm, mf);
|
||||
rContext, sdc, clip, shape, std::move(grPaint), ctm, mf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1509,7 +1509,7 @@ void SurfaceDrawContext::drawImageLattice(const GrClip* clip,
|
||||
}
|
||||
|
||||
void SurfaceDrawContext::drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
|
||||
const SkRect& bounds) {
|
||||
const SkRect& bounds) {
|
||||
GrOp::Owner op(GrDrawableOp::Make(fContext, std::move(drawable), bounds));
|
||||
SkASSERT(op);
|
||||
this->addOp(std::move(op));
|
||||
@ -1922,7 +1922,7 @@ void SurfaceDrawContext::drawShapeUsingPathRenderer(const GrClip* clip,
|
||||
aaType,
|
||||
this->colorInfo().isLinearlyBlended()};
|
||||
pr->drawPath(args);
|
||||
#endif
|
||||
#endif // SK_GPU_V1
|
||||
}
|
||||
|
||||
void SurfaceDrawContext::addDrawOp(const GrClip* clip,
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/gpu/GrOpsTask.h"
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/SurfaceFillContext.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
|
||||
#include <array>
|
||||
#include <tuple>
|
||||
|
@ -327,14 +327,15 @@ GrSurfaceProxyView SkImage_Lazy::textureProxyViewFromPlanes(GrRecordingContext*
|
||||
kPremul_SkAlphaType,
|
||||
/*color space*/ nullptr,
|
||||
this->dimensions());
|
||||
auto surfaceFillContext = ctx->priv().makeSFC(info,
|
||||
SkBackingFit::kExact,
|
||||
1,
|
||||
GrMipmapped::kNo,
|
||||
GrProtected::kNo,
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
budgeted);
|
||||
if (!surfaceFillContext) {
|
||||
|
||||
auto sfc = ctx->priv().makeSFC(info,
|
||||
SkBackingFit::kExact,
|
||||
1,
|
||||
GrMipmapped::kNo,
|
||||
GrProtected::kNo,
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
budgeted);
|
||||
if (!sfc) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -362,9 +363,9 @@ GrSurfaceProxyView SkImage_Lazy::textureProxyViewFromPlanes(GrRecordingContext*
|
||||
fp = GrColorSpaceXformEffect::Make(std::move(fp),
|
||||
srcColorSpace, kOpaque_SkAlphaType,
|
||||
dstColorSpace, kOpaque_SkAlphaType);
|
||||
surfaceFillContext->fillWithFP(std::move(fp));
|
||||
sfc->fillWithFP(std::move(fp));
|
||||
|
||||
return surfaceFillContext->readSurfaceView();
|
||||
return sfc->readSurfaceView();
|
||||
}
|
||||
|
||||
sk_sp<SkCachedData> SkImage_Lazy::getPlanes(
|
||||
|
@ -60,11 +60,11 @@ void runFPTest(skiatest::Reporter* reporter, GrDirectContext* dContext,
|
||||
continue;
|
||||
}
|
||||
|
||||
auto sContext = dContext->priv().makeSC(std::move(fpView), info.colorInfo());
|
||||
REPORTER_ASSERT(reporter, sContext);
|
||||
auto sc = dContext->priv().makeSC(std::move(fpView), info.colorInfo());
|
||||
REPORTER_ASSERT(reporter, sc);
|
||||
|
||||
GrPixmap readPixmap(info, readBuffer.begin(), info.minRowBytes());
|
||||
bool result = sContext->readPixels(dContext, readPixmap, {0, 0});
|
||||
bool result = sc->readPixels(dContext, readPixmap, {0, 0});
|
||||
REPORTER_ASSERT(reporter, result);
|
||||
REPORTER_ASSERT(reporter,
|
||||
!memcmp(readBuffer.begin(), controlPixelData.begin(), readBuffer.bytes()));
|
||||
|
@ -502,12 +502,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceContextReadPixels, reporter, ctxInfo)
|
||||
for (GrSurfaceOrigin origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
|
||||
auto factory = std::function<GpuSrcFactory<Surface>>(
|
||||
[direct, origin, renderable](const SkPixmap& src) {
|
||||
auto surfContext = skgpu::SurfaceContext::Make(
|
||||
auto sc = skgpu::SurfaceContext::Make(
|
||||
direct, src.info(), SkBackingFit::kExact, origin, renderable);
|
||||
if (surfContext) {
|
||||
surfContext->writePixels(direct, src, {0, 0});
|
||||
if (sc) {
|
||||
sc->writePixels(direct, src, {0, 0});
|
||||
}
|
||||
return surfContext;
|
||||
return sc;
|
||||
});
|
||||
auto label = SkStringPrintf("Renderable: %d, Origin: %d", (int)renderable, origin);
|
||||
gpu_read_pixels_test_driver(reporter, rules, factory, reader, label);
|
||||
|
@ -121,7 +121,7 @@ typedef bool (*CheckFn) (uint32_t orig, uint32_t actual, float error);
|
||||
|
||||
void read_and_check_pixels(skiatest::Reporter* reporter,
|
||||
GrDirectContext* dContext,
|
||||
skgpu::SurfaceContext* sContext,
|
||||
skgpu::SurfaceContext* sc,
|
||||
uint32_t* origData,
|
||||
const SkImageInfo& dstInfo, CheckFn checker, float error,
|
||||
const char* subtestName) {
|
||||
@ -129,7 +129,7 @@ void read_and_check_pixels(skiatest::Reporter* reporter,
|
||||
GrPixmap readPM = GrPixmap::Allocate(dstInfo);
|
||||
memset(readPM.addr(), 0, sizeof(uint32_t)*w*h);
|
||||
|
||||
if (!sContext->readPixels(dContext, readPM, {0, 0})) {
|
||||
if (!sc->readPixels(dContext, readPM, {0, 0})) {
|
||||
ERRORF(reporter, "Could not read pixels for %s.", subtestName);
|
||||
return;
|
||||
}
|
||||
@ -195,7 +195,8 @@ static std::unique_ptr<skgpu::SurfaceContext> make_surface_context(Encoding cont
|
||||
encoding_as_color_space(contextEncoding),
|
||||
kW, kH);
|
||||
|
||||
auto sc = skgpu::SurfaceContext::Make(rContext, info,
|
||||
auto sc = skgpu::SurfaceContext::Make(rContext,
|
||||
info,
|
||||
SkBackingFit::kExact,
|
||||
kBottomLeft_GrSurfaceOrigin,
|
||||
GrRenderable::kYes);
|
||||
|
@ -17,12 +17,12 @@ class GrSurfaceProxy;
|
||||
typedef uint32_t GrColor;
|
||||
|
||||
// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues
|
||||
void TestReadPixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext* srcContext,
|
||||
void TestReadPixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext*,
|
||||
uint32_t expectedPixelValues[], const char* testName);
|
||||
|
||||
// See if trying to write RGBA 8888 pixels to 'dstContext' matches matches the
|
||||
// expectation ('expectedToWork')
|
||||
void TestWritePixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext* srcContext,
|
||||
void TestWritePixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext*,
|
||||
bool expectedToWork, const char* testName);
|
||||
|
||||
// Ensure that the pixels can be copied from 'proxy' viewed as colorType, to an RGBA 8888
|
||||
|
@ -20,10 +20,6 @@
|
||||
#include "tools/gpu/BackendSurfaceFactory.h"
|
||||
#include "tools/gpu/ProxyUtils.h"
|
||||
|
||||
#if SK_GPU_V1
|
||||
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
|
||||
#endif
|
||||
|
||||
DEF_GPUTEST_FOR_ALL_CONTEXTS(WrappedSurfaceCopyOnWrite, reporter, ctxInfo) {
|
||||
GrDirectContext* dContext = ctxInfo.directContext();
|
||||
|
||||
@ -91,13 +87,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkipCopyTaskTest, reporter, ctxInfo) {
|
||||
/*color space*/ nullptr,
|
||||
10, 10);
|
||||
|
||||
auto dstSC = skgpu::SurfaceContext::Make(dContext, info,
|
||||
auto dstSC = skgpu::SurfaceContext::Make(dContext,
|
||||
info,
|
||||
SkBackingFit::kExact,
|
||||
kBottomLeft_GrSurfaceOrigin,
|
||||
GrRenderable::kYes);
|
||||
dstSC->asFillContext()->clear(SkPMColor4f{1, 0, 0, 1});
|
||||
|
||||
auto srcSC = skgpu::SurfaceContext::Make(dContext, info,
|
||||
auto srcSC = skgpu::SurfaceContext::Make(dContext,
|
||||
info,
|
||||
SkBackingFit::kExact,
|
||||
kBottomLeft_GrSurfaceOrigin,
|
||||
GrRenderable::kYes);
|
||||
@ -130,32 +128,23 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkipCopyTaskTest, reporter, ctxInfo) {
|
||||
}
|
||||
|
||||
#if SK_GPU_V1
|
||||
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
|
||||
|
||||
// Make sure GrOpsTask are skippable
|
||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkipOpsTaskTest, reporter, ctxInfo) {
|
||||
GrDirectContext* dContext = ctxInfo.directContext();
|
||||
|
||||
auto dst = skgpu::v1::SurfaceDrawContext::Make(dContext,
|
||||
GrColorType::kRGBA_8888,
|
||||
/*color space*/ nullptr,
|
||||
SkBackingFit::kExact,
|
||||
{10, 10},
|
||||
SkSurfaceProps());
|
||||
GrImageInfo ii(GrColorType::kRGBA_8888, kPremul_SkAlphaType, /*color space*/ nullptr, 10, 10);
|
||||
|
||||
auto dst = dContext->priv().makeSFC(ii, SkBackingFit::kExact);
|
||||
dst->clear(SkPMColor4f{1, 0, 0, 1});
|
||||
dContext->flush();
|
||||
|
||||
dst->clear(SkPMColor4f{0, 0, 1, 1});
|
||||
sk_sp<GrRenderTask> task = sk_ref_sp(dst->getOpsTask());
|
||||
sk_sp<GrRenderTask> task = dst->refRenderTask();
|
||||
|
||||
// GrDrawingManager maintains an "active ops task" and doesn't like having it closed behind
|
||||
// its back. temp exists just to replace dst's ops task as the active one.
|
||||
auto temp = skgpu::v1::SurfaceDrawContext::Make(dContext,
|
||||
GrColorType::kRGBA_8888,
|
||||
/*color space*/ nullptr,
|
||||
SkBackingFit::kExact,
|
||||
{10, 10},
|
||||
SkSurfaceProps());
|
||||
auto temp = dContext->priv().makeSFC(ii, SkBackingFit::kExact);
|
||||
temp->clear(SkPMColor4f{0, 0, 0, 0});
|
||||
|
||||
GrSurfaceProxyView readView = dst->readSurfaceView();
|
||||
|
Loading…
Reference in New Issue
Block a user