Move the remainder of GrRenderTargetContext factories.
This mostly handles cases where we are wrapping a GrBackend* or an already made proxy. Change-Id: Ieb33eb51f7db84611ade0f8243b6d9023ce8e390 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262234 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
a6434a5ef5
commit
ba0ff78359
@ -40,85 +40,6 @@ void GrContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBO
|
||||
fContext->addOnFlushCallbackObject(onFlushCBObject);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContext(
|
||||
const GrBackendTexture& tex,
|
||||
GrSurfaceOrigin origin,
|
||||
int sampleCnt,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* props,
|
||||
ReleaseProc releaseProc,
|
||||
ReleaseContext releaseCtx) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
SkASSERT(sampleCnt > 0);
|
||||
|
||||
sk_sp<GrTextureProxy> proxy(this->proxyProvider()->wrapRenderableBackendTexture(
|
||||
tex, origin, sampleCnt, colorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
|
||||
releaseProc, releaseCtx));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy), colorType,
|
||||
std::move(colorSpace), props);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetContext(
|
||||
const GrBackendRenderTarget& backendRT,
|
||||
GrSurfaceOrigin origin,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
ReleaseProc releaseProc,
|
||||
ReleaseContext releaseCtx) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
|
||||
sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendRenderTarget(
|
||||
backendRT, colorType, origin, releaseProc, releaseCtx);
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy), colorType,
|
||||
std::move(colorSpace), surfaceProps);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext>
|
||||
GrContextPriv::makeBackendTextureAsRenderTargetRenderTargetContext(const GrBackendTexture& tex,
|
||||
GrSurfaceOrigin origin,
|
||||
int sampleCnt,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* props) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
SkASSERT(sampleCnt > 0);
|
||||
sk_sp<GrSurfaceProxy> proxy(
|
||||
this->proxyProvider()->wrapBackendTextureAsRenderTarget(tex, colorType,
|
||||
origin, sampleCnt));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->drawingManager()->makeRenderTargetContext(std::move(proxy), colorType,
|
||||
std::move(colorSpace), props);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrContextPriv::makeVulkanSecondaryCBRenderTargetContext(
|
||||
const SkImageInfo& imageInfo, const GrVkDrawableInfo& vkInfo, const SkSurfaceProps* props) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
sk_sp<GrSurfaceProxy> proxy(
|
||||
this->proxyProvider()->wrapVulkanSecondaryCBAsRenderTarget(imageInfo, vkInfo));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->drawingManager()->makeRenderTargetContext(
|
||||
std::move(proxy),
|
||||
SkColorTypeToGrColorType(imageInfo.colorType()),
|
||||
imageInfo.refColorSpace(),
|
||||
props);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
|
||||
const GrFlushInfo& info) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
|
@ -76,40 +76,6 @@ public:
|
||||
*/
|
||||
static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&);
|
||||
|
||||
// These match the definitions in SkSurface & GrSurface.h, for whence they came
|
||||
typedef void* ReleaseContext;
|
||||
typedef void (*ReleaseProc)(ReleaseContext);
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> makeBackendTextureRenderTargetContext(
|
||||
const GrBackendTexture& tex,
|
||||
GrSurfaceOrigin origin,
|
||||
int sampleCnt,
|
||||
GrColorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* = nullptr,
|
||||
ReleaseProc = nullptr,
|
||||
ReleaseContext = nullptr);
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> makeBackendRenderTargetRenderTargetContext(
|
||||
const GrBackendRenderTarget&,
|
||||
GrSurfaceOrigin origin,
|
||||
GrColorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* = nullptr,
|
||||
ReleaseProc = nullptr,
|
||||
ReleaseContext = nullptr);
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> makeBackendTextureAsRenderTargetRenderTargetContext(
|
||||
const GrBackendTexture& tex,
|
||||
GrSurfaceOrigin origin,
|
||||
int sampleCnt,
|
||||
GrColorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* = nullptr);
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> makeVulkanSecondaryCBRenderTargetContext(
|
||||
const SkImageInfo&, const GrVkDrawableInfo&, const SkSurfaceProps* = nullptr);
|
||||
|
||||
/**
|
||||
* Finalizes all pending reads and writes to the surfaces and also performs an MSAA resolves
|
||||
* if necessary. The GrSurfaceProxy array is treated as a hint. If it is supplied the context
|
||||
|
@ -909,33 +909,3 @@ void GrDrawingManager::flushIfNecessary() {
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
|
||||
sk_sp<GrSurfaceProxy> sProxy,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
bool managedOpsTask) {
|
||||
if (this->wasAbandoned() || !sProxy->asRenderTargetProxy()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<GrRenderTargetProxy> renderTargetProxy(sk_ref_sp(sProxy->asRenderTargetProxy()));
|
||||
|
||||
GrSurfaceOrigin origin = renderTargetProxy->origin();
|
||||
GrSwizzle readSwizzle = fContext->priv().caps()->getReadSwizzle(sProxy->backendFormat(),
|
||||
colorType);
|
||||
GrSwizzle outSwizzle = fContext->priv().caps()->getOutputSwizzle(sProxy->backendFormat(),
|
||||
colorType);
|
||||
|
||||
return std::unique_ptr<GrRenderTargetContext>(
|
||||
new GrRenderTargetContext(fContext,
|
||||
std::move(renderTargetProxy),
|
||||
colorType,
|
||||
origin,
|
||||
readSwizzle,
|
||||
outSwizzle,
|
||||
std::move(colorSpace),
|
||||
surfaceProps,
|
||||
managedOpsTask));
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,6 @@ public:
|
||||
|
||||
void freeGpuResources();
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> makeRenderTargetContext(sk_sp<GrSurfaceProxy>,
|
||||
GrColorType,
|
||||
sk_sp<SkColorSpace>,
|
||||
const SkSurfaceProps*,
|
||||
bool managedOpsTask = true);
|
||||
|
||||
// A managed opsTask is controlled by the drawing manager (i.e., sorted & flushed with the
|
||||
// others). An unmanaged one is created and used by the onFlushCallback.
|
||||
sk_sp<GrOpsTask> newOpsTask(GrSurfaceProxyView, bool managedOpsTask);
|
||||
|
@ -25,8 +25,16 @@ std::unique_ptr<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTarg
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto renderTargetContext = fDrawingMgr->makeRenderTargetContext(
|
||||
std::move(proxy), colorType, std::move(colorSpace), props, false);
|
||||
auto context = fDrawingMgr->getContext();
|
||||
|
||||
if (!proxy->asRenderTargetProxy()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrSurfaceOrigin origin = proxy->origin();
|
||||
auto renderTargetContext = GrRenderTargetContext::Make(
|
||||
context, colorType, std::move(colorSpace), std::move(proxy),
|
||||
origin, props, false);
|
||||
|
||||
if (!renderTargetContext) {
|
||||
return nullptr;
|
||||
|
@ -137,6 +137,27 @@ private:
|
||||
GrDrawingManager* fDrawingManager;
|
||||
};
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
|
||||
GrRecordingContext* context,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
sk_sp<GrSurfaceProxy> proxy,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
bool managedOps) {
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const GrBackendFormat& format = proxy->backendFormat();
|
||||
GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(format, colorType);
|
||||
GrSwizzle outSwizzle = context->priv().caps()->getOutputSwizzle(format, colorType);
|
||||
|
||||
return std::make_unique<GrRenderTargetContext>(context, std::move(proxy), colorType, origin,
|
||||
readSwizzle, outSwizzle, std::move(colorSpace),
|
||||
surfaceProps, managedOps);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
|
||||
GrRecordingContext* context,
|
||||
GrColorType colorType,
|
||||
@ -166,21 +187,15 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
|
||||
desc.fHeight = dimensions.height();
|
||||
desc.fConfig = config;
|
||||
|
||||
GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(format, colorType);
|
||||
GrSwizzle outSwizzle = context->priv().caps()->getOutputSwizzle(format, colorType);
|
||||
|
||||
sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
|
||||
format, desc, GrRenderable::kYes, sampleCnt, origin, mipMapped, fit, budgeted,
|
||||
isProtected);
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
GrRenderTargetProxy* rtp = proxy->asRenderTargetProxy();
|
||||
SkASSERT(rtp);
|
||||
|
||||
auto rtc = std::make_unique<GrRenderTargetContext>(context, sk_ref_sp(rtp), colorType, origin,
|
||||
readSwizzle, outSwizzle,
|
||||
std::move(colorSpace), surfaceProps, true);
|
||||
auto rtc = GrRenderTargetContext::Make(context, colorType, std::move(colorSpace),
|
||||
std::move(proxy), origin, surfaceProps, true);
|
||||
if (!rtc) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -253,12 +268,90 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeWithFallback(
|
||||
return rtc;
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendTexture(
|
||||
GrRecordingContext* context,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const GrBackendTexture& tex,
|
||||
int sampleCnt,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
ReleaseProc releaseProc,
|
||||
ReleaseContext releaseCtx) {
|
||||
SkASSERT(sampleCnt > 0);
|
||||
sk_sp<GrTextureProxy> proxy(context->priv().proxyProvider()->wrapRenderableBackendTexture(
|
||||
tex, origin, sampleCnt, colorType, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
|
||||
releaseProc, releaseCtx));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GrRenderTargetContext::Make(context, colorType, std::move(colorSpace), std::move(proxy),
|
||||
origin, surfaceProps);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendTextureAsRenderTarget(
|
||||
GrRecordingContext* context,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const GrBackendTexture& tex,
|
||||
int sampleCnt,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps* surfaceProps) {
|
||||
SkASSERT(sampleCnt > 0);
|
||||
sk_sp<GrSurfaceProxy> proxy(context->priv().proxyProvider()->wrapBackendTextureAsRenderTarget(
|
||||
tex, colorType, origin, sampleCnt));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GrRenderTargetContext::Make(context, colorType, std::move(colorSpace), std::move(proxy),
|
||||
origin, surfaceProps);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendRenderTarget(
|
||||
GrRecordingContext* context,
|
||||
GrColorType colorType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const GrBackendRenderTarget& rt,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
ReleaseProc releaseProc,
|
||||
ReleaseContext releaseCtx) {
|
||||
sk_sp<GrSurfaceProxy> proxy(context->priv().proxyProvider()->wrapBackendRenderTarget(
|
||||
rt, colorType, origin, releaseProc, releaseCtx));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GrRenderTargetContext::Make(context, colorType, std::move(colorSpace), std::move(proxy),
|
||||
origin, surfaceProps);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromVulkanSecondaryCB(
|
||||
GrRecordingContext* context,
|
||||
const SkImageInfo& imageInfo,
|
||||
const GrVkDrawableInfo& vkInfo,
|
||||
const SkSurfaceProps* props) {
|
||||
sk_sp<GrSurfaceProxy> proxy(
|
||||
context->priv().proxyProvider()->wrapVulkanSecondaryCBAsRenderTarget(imageInfo,
|
||||
vkInfo));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
|
||||
return GrRenderTargetContext::Make(context, SkColorTypeToGrColorType(imageInfo.colorType()),
|
||||
imageInfo.refColorSpace(), std::move(proxy),
|
||||
kTopLeft_GrSurfaceOrigin, props);
|
||||
}
|
||||
|
||||
// In MDB mode the reffing of the 'getLastOpsTask' call's result allows in-progress
|
||||
// GrOpsTask to be picked up and added to by renderTargetContexts lower in the call
|
||||
// stack. When this occurs with a closed GrOpsTask, a new one will be allocated
|
||||
// when the renderTargetContext attempts to use it (via getOpsTask).
|
||||
GrRenderTargetContext::GrRenderTargetContext(GrRecordingContext* context,
|
||||
sk_sp<GrRenderTargetProxy> rtp,
|
||||
sk_sp<GrSurfaceProxy> proxy,
|
||||
GrColorType colorType,
|
||||
GrSurfaceOrigin origin,
|
||||
GrSwizzle readSwizzle,
|
||||
@ -266,7 +359,7 @@ GrRenderTargetContext::GrRenderTargetContext(GrRecordingContext* context,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
bool managedOpsTask)
|
||||
: GrSurfaceContext(context, std::move(rtp), colorType, kPremul_SkAlphaType,
|
||||
: GrSurfaceContext(context, std::move(proxy), colorType, kPremul_SkAlphaType,
|
||||
std::move(colorSpace), origin, readSwizzle)
|
||||
, fOutputSwizzle(outSwizzle)
|
||||
, fOpsTask(sk_ref_sp(fSurfaceProxy->getLastOpsTask()))
|
||||
|
@ -57,6 +57,10 @@ class SkVertices;
|
||||
*/
|
||||
class GrRenderTargetContext : public GrSurfaceContext {
|
||||
public:
|
||||
static std::unique_ptr<GrRenderTargetContext> Make(
|
||||
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, sk_sp<GrSurfaceProxy>,
|
||||
GrSurfaceOrigin, const SkSurfaceProps*, bool managedOps = true);
|
||||
|
||||
static std::unique_ptr<GrRenderTargetContext> Make(
|
||||
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
|
||||
const SkISize& dimensions, const GrBackendFormat&, int sampleCnt, GrMipMapped,
|
||||
@ -79,7 +83,30 @@ public:
|
||||
GrProtected = GrProtected::kNo, GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
|
||||
SkBudgeted = SkBudgeted::kYes, const SkSurfaceProps* = nullptr);
|
||||
|
||||
GrRenderTargetContext(GrRecordingContext*, sk_sp<GrRenderTargetProxy>, GrColorType,
|
||||
// These match the definitions in SkSurface & GrSurface.h, for whence they came
|
||||
typedef void* ReleaseContext;
|
||||
typedef void (*ReleaseProc)(ReleaseContext);
|
||||
|
||||
// Creates a GrRenderTargetContext that wraps the passed in GrBackendTexture.
|
||||
static std::unique_ptr<GrRenderTargetContext> MakeFromBackendTexture(
|
||||
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, const GrBackendTexture&,
|
||||
int sampleCnt, GrSurfaceOrigin, const SkSurfaceProps*, ReleaseProc releaseProc,
|
||||
ReleaseContext releaseCtx);
|
||||
|
||||
static std::unique_ptr<GrRenderTargetContext> MakeFromBackendTextureAsRenderTarget(
|
||||
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, const GrBackendTexture&,
|
||||
int sampleCnt, GrSurfaceOrigin, const SkSurfaceProps*);
|
||||
|
||||
static std::unique_ptr<GrRenderTargetContext> MakeFromBackendRenderTarget(
|
||||
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, const GrBackendRenderTarget&,
|
||||
GrSurfaceOrigin, const SkSurfaceProps*, ReleaseProc releaseProc,
|
||||
ReleaseContext releaseCtx);
|
||||
|
||||
static std::unique_ptr<GrRenderTargetContext> MakeFromVulkanSecondaryCB(
|
||||
GrRecordingContext*, const SkImageInfo&, const GrVkDrawableInfo&,
|
||||
const SkSurfaceProps*);
|
||||
|
||||
GrRenderTargetContext(GrRecordingContext*, sk_sp<GrSurfaceProxy>, GrColorType,
|
||||
GrSurfaceOrigin, GrSwizzle readSwizzle, GrSwizzle outSwizzle,
|
||||
sk_sp<SkColorSpace>, const SkSurfaceProps*, bool managedOpsTask = true);
|
||||
|
||||
|
@ -30,7 +30,7 @@ sk_sp<GrVkSecondaryCBDrawContext> GrVkSecondaryCBDrawContext::Make(GrContext* ct
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rtc = ctx->priv().makeVulkanSecondaryCBRenderTargetContext(imageInfo, vkInfo, props);
|
||||
auto rtc = GrRenderTargetContext::MakeFromVulkanSecondaryCB(ctx, imageInfo, vkInfo, props);
|
||||
SkASSERT(rtc->asSurfaceProxy()->isInstantiated());
|
||||
|
||||
sk_sp<SkGpuDevice> device(
|
||||
|
@ -310,9 +310,9 @@ sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopyWithExternalBackend(
|
||||
|
||||
// Needs to create a render target with external texture
|
||||
// in order to draw to it for the yuv->rgb conversion.
|
||||
auto renderTargetContext = ctx->priv().makeBackendTextureRenderTargetContext(
|
||||
backendTexture, imageOrigin, 1, grColorType, std::move(imageColorSpace), nullptr,
|
||||
textureReleaseProc, releaseContext);
|
||||
auto renderTargetContext = GrRenderTargetContext::MakeFromBackendTexture(
|
||||
ctx, grColorType, std::move(imageColorSpace), backendTexture, 1, imageOrigin,
|
||||
nullptr, textureReleaseProc, releaseContext);
|
||||
if (!renderTargetContext) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -438,9 +438,9 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rtc = context->priv().makeBackendTextureRenderTargetContext(
|
||||
backendTexture, c.origin(), c.sampleCount(), grCT, c.refColorSpace(), &c.surfaceProps(),
|
||||
textureReleaseProc, releaseContext);
|
||||
auto rtc = GrRenderTargetContext::MakeFromBackendTexture(
|
||||
context, grCT, c.refColorSpace(), backendTexture, c.sampleCount(), c.origin(),
|
||||
&c.surfaceProps(), textureReleaseProc, releaseContext);
|
||||
if (!rtc) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -519,9 +519,9 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrB
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rtc = context->priv().makeBackendTextureRenderTargetContext(
|
||||
tex, origin, sampleCnt, grColorType, std::move(colorSpace), props, textureReleaseProc,
|
||||
releaseContext);
|
||||
auto rtc = GrRenderTargetContext::MakeFromBackendTexture(
|
||||
context, grColorType, std::move(colorSpace), tex, sampleCnt, origin, props,
|
||||
textureReleaseProc, releaseContext);
|
||||
if (!rtc) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -572,15 +572,9 @@ bool SkSurface_Gpu::onReplaceBackendTexture(const GrBackendTexture& backendTextu
|
||||
sampleCnt, grColorType, true)) {
|
||||
return false;
|
||||
}
|
||||
auto rtc =
|
||||
context->priv().makeBackendTextureRenderTargetContext(backendTexture,
|
||||
origin,
|
||||
sampleCnt,
|
||||
oldRTC->colorInfo().colorType(),
|
||||
std::move(colorSpace),
|
||||
&this->props(),
|
||||
releaseProc,
|
||||
releaseContext);
|
||||
auto rtc = GrRenderTargetContext::MakeFromBackendTexture(
|
||||
context, oldRTC->colorInfo().colorType(), std::move(colorSpace), backendTexture,
|
||||
sampleCnt, origin, &this->props(), releaseProc, releaseContext);
|
||||
if (!rtc) {
|
||||
return false;
|
||||
}
|
||||
@ -622,8 +616,9 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rtc = context->priv().makeBackendRenderTargetRenderTargetContext(
|
||||
rt, origin, grColorType, std::move(colorSpace), props, relProc, releaseContext);
|
||||
auto rtc = GrRenderTargetContext::MakeFromBackendRenderTarget(
|
||||
context, grColorType, std::move(colorSpace), rt, origin, props, relProc,
|
||||
releaseContext);
|
||||
if (!rtc) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -657,8 +652,8 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rtc = context->priv().makeBackendTextureAsRenderTargetRenderTargetContext(
|
||||
tex, origin, sampleCnt, grColorType, std::move(colorSpace), props);
|
||||
auto rtc = GrRenderTargetContext::MakeFromBackendTextureAsRenderTarget(
|
||||
context, grColorType, std::move(colorSpace), tex, sampleCnt, origin, props);
|
||||
if (!rtc) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
|
||||
|
||||
// Should not be able to wrap as a RT
|
||||
{
|
||||
auto temp = context0->priv().makeBackendTextureRenderTargetContext(
|
||||
backendTex, origin, 1, colorType, nullptr);
|
||||
auto temp = GrRenderTargetContext::MakeFromBackendTexture(
|
||||
context0, colorType, nullptr, backendTex, 1, origin, nullptr, nullptr, nullptr);
|
||||
if (temp) {
|
||||
ERRORF(reporter, "Should not be able to wrap an EXTERNAL texture as a RT.");
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(Gr1x1TextureMipMappedTest, reporter, ctxInfo)
|
||||
|
||||
// Create a new render target and draw 'mipmapProxy' into it using the provided 'filter'.
|
||||
static std::unique_ptr<GrRenderTargetContext> draw_mipmap_into_new_render_target(
|
||||
GrDrawingManager* drawingManager, GrProxyProvider* proxyProvider, GrColorType colorType,
|
||||
GrRecordingContext* context, GrProxyProvider* proxyProvider, GrColorType colorType,
|
||||
SkAlphaType alphaType, sk_sp<GrTextureProxy> mipmapProxy, GrSamplerState::Filter filter) {
|
||||
GrSurfaceDesc desc;
|
||||
desc.fWidth = 1;
|
||||
@ -348,8 +348,11 @@ static std::unique_ptr<GrRenderTargetContext> draw_mipmap_into_new_render_target
|
||||
sk_sp<GrSurfaceProxy> renderTarget = proxyProvider->createProxy(
|
||||
mipmapProxy->backendFormat(), desc, GrRenderable::kYes, 1, kTopLeft_GrSurfaceOrigin,
|
||||
GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
|
||||
auto rtc = drawingManager->makeRenderTargetContext(
|
||||
std::move(renderTarget), colorType, nullptr, nullptr, true);
|
||||
|
||||
auto rtc = GrRenderTargetContext::Make(
|
||||
context, colorType, nullptr, std::move(renderTarget), kTopLeft_GrSurfaceOrigin,
|
||||
nullptr);
|
||||
|
||||
rtc->drawTexture(GrNoClip(), mipmapProxy, colorType, alphaType, filter, SkBlendMode::kSrcOver,
|
||||
{1,1,1,1}, SkRect::MakeWH(4, 4), SkRect::MakeWH(1,1), GrAA::kYes,
|
||||
GrQuadAAFlags::kAll, SkCanvas::kFast_SrcRectConstraint, SkMatrix::I(),
|
||||
@ -383,7 +386,6 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
GrColorType colorType = GrColorType::kRGBA_8888;
|
||||
SkAlphaType alphaType = kPremul_SkAlphaType;
|
||||
|
||||
GrDrawingManager* drawingManager = context->priv().drawingManager();
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
|
||||
// Create a mipmapped render target.
|
||||
@ -399,9 +401,9 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
// dirty again until GrRenderTask::makeClosed().
|
||||
mipmapProxy->markMipMapsClean();
|
||||
|
||||
// Render something to dirty the mips.
|
||||
auto mipmapRTC = drawingManager->makeRenderTargetContext(
|
||||
mipmapProxy, colorType, nullptr, nullptr, true);
|
||||
auto mipmapRTC = GrRenderTargetContext::Make(
|
||||
context.get(), colorType, nullptr, mipmapProxy, kTopLeft_GrSurfaceOrigin, nullptr);
|
||||
|
||||
mipmapRTC->clear(nullptr, {.1f,.2f,.3f,.4f}, CanClearFullscreen::kYes);
|
||||
REPORTER_ASSERT(reporter, mipmapProxy->getLastRenderTask());
|
||||
// mipmapProxy's last render task should now just be the opsTask containing the clear.
|
||||
@ -412,7 +414,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
|
||||
|
||||
// Draw the dirty mipmap texture into a render target.
|
||||
auto rtc1 = draw_mipmap_into_new_render_target(drawingManager, proxyProvider, colorType,
|
||||
auto rtc1 = draw_mipmap_into_new_render_target(context.get(), proxyProvider, colorType,
|
||||
alphaType, mipmapProxy, Filter::kMipMap);
|
||||
|
||||
// Mipmaps should have gotten marked dirty during makeClosed, then marked clean again as
|
||||
@ -426,7 +428,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
|
||||
|
||||
// Draw the now-clean mipmap texture into a second target.
|
||||
auto rtc2 = draw_mipmap_into_new_render_target(drawingManager, proxyProvider, colorType,
|
||||
auto rtc2 = draw_mipmap_into_new_render_target(context.get(), proxyProvider, colorType,
|
||||
alphaType, mipmapProxy, Filter::kMipMap);
|
||||
|
||||
// Make sure the mipmap texture still has the same regen task.
|
||||
@ -453,7 +455,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
|
||||
|
||||
// Draw the dirty mipmap texture into a render target, but don't do mipmap filtering.
|
||||
rtc1 = draw_mipmap_into_new_render_target(drawingManager, proxyProvider, colorType,
|
||||
rtc1 = draw_mipmap_into_new_render_target(context.get(), proxyProvider, colorType,
|
||||
alphaType, mipmapProxy, Filter::kBilerp);
|
||||
|
||||
// Mipmaps should have gotten marked dirty during makeClosed() when adding the dependency.
|
||||
@ -466,7 +468,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
mipmapRTC->testingOnly_PeekLastOpsTask() == mipmapProxy->getLastRenderTask());
|
||||
|
||||
// Draw the stil-dirty mipmap texture into a second target with mipmap filtering.
|
||||
rtc2 = draw_mipmap_into_new_render_target(drawingManager, proxyProvider, colorType,
|
||||
rtc2 = draw_mipmap_into_new_render_target(context.get(), proxyProvider, colorType,
|
||||
alphaType, mipmapProxy, Filter::kMipMap);
|
||||
|
||||
// Make sure the mipmap texture now has a new last render task that regenerates the mips,
|
||||
|
Loading…
Reference in New Issue
Block a user