Remove deferred proxy machinery
These aren't used any more in favor of lazy proxies. Bug: skia:11288 Change-Id: I992e1a3dd343e0ebc7f3a4f18c0054453dfebbaf Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366896 Commit-Queue: Adlai Holler <adlai@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
a793f4f6fc
commit
a3987cc587
@ -86,7 +86,6 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/GrDataUtils.h",
|
||||
"$_src/gpu/GrDefaultGeoProcFactory.cpp",
|
||||
"$_src/gpu/GrDefaultGeoProcFactory.h",
|
||||
"$_src/gpu/GrDeferredProxyUploader.h",
|
||||
"$_src/gpu/GrDeferredUpload.h",
|
||||
"$_src/gpu/GrDirectContext.cpp",
|
||||
"$_src/gpu/GrDirectContextPriv.cpp",
|
||||
@ -253,7 +252,6 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/GrTextureProxy.cpp",
|
||||
"$_src/gpu/GrTextureProxy.h",
|
||||
"$_src/gpu/GrTextureProxyCacheAccess.h",
|
||||
"$_src/gpu/GrTextureProxyPriv.h",
|
||||
"$_src/gpu/GrTextureRenderTargetProxy.cpp",
|
||||
"$_src/gpu/GrTextureRenderTargetProxy.h",
|
||||
"$_src/gpu/GrTextureResolveManager.h",
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "src/gpu/GrSemaphore.h"
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/gl/GrGLTexture.h"
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/core/SkTaskGroup.h"
|
||||
#include "src/gpu/GrClip.h"
|
||||
#include "src/gpu/GrDeferredProxyUploader.h"
|
||||
#include "src/gpu/GrDirectContextPriv.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include "src/gpu/GrAppliedClip.h"
|
||||
#include "src/gpu/GrAttachment.h"
|
||||
#include "src/gpu/GrDeferredProxyUploader.h"
|
||||
#include "src/gpu/GrDirectContextPriv.h"
|
||||
#include "src/gpu/GrDrawingManager.h"
|
||||
#include "src/gpu/GrGpuResourcePriv.h"
|
||||
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrDeferredProxyUploader_DEFINED
|
||||
#define GrDeferredProxyUploader_DEFINED
|
||||
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/private/SkSemaphore.h"
|
||||
#include "src/core/SkAutoPixmapStorage.h"
|
||||
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
|
||||
/**
|
||||
* GrDeferredProxyUploader assists with threaded generation of textures. Currently used by both
|
||||
* software clip masks, and the software path renderer. The calling code typically needs to store
|
||||
* some additional data (T) for use on the worker thread. GrTDeferredProxyUploader allows storing
|
||||
* such data. The common flow is:
|
||||
*
|
||||
* 1) A GrTDeferredProxyUploader is created, with some payload (eg an SkPath to draw).
|
||||
* The uploader is owned by the proxy that it's going to populate.
|
||||
* 2) A task is created with a pointer to the uploader. A worker thread executes that task, using
|
||||
* the payload data to allocate and fill in the fPixels pixmap.
|
||||
* 3) The worker thread calls signalAndFreeData(), which notifies the main thread that the pixmap
|
||||
* is ready, and then deletes the payload data (which is no longer needed).
|
||||
* 4) In parallel to 2-3, on the main thread... Some op is created that refers to the proxy. When
|
||||
* that op is added to an op list, the op list retains a pointer to the "deferred" proxies.
|
||||
* 5) At flush time, the op list ensures that the deferred proxies are instantiated, then calls
|
||||
* scheduleUpload on those proxies, which calls scheduleUpload on the uploader (below).
|
||||
* 6) scheduleUpload defers the upload even further, by adding an ASAPUpload to the flush.
|
||||
* 7) When the ASAP upload happens, we wait to make sure that the pixels are marked ready
|
||||
* (from step #3 on the worker thread). Then we perform the actual upload to the texture.
|
||||
* Finally, we call resetDeferredUploader, which deletes the uploader object, causing fPixels
|
||||
* to be freed.
|
||||
*/
|
||||
class GrDeferredProxyUploader : public SkNoncopyable {
|
||||
public:
|
||||
GrDeferredProxyUploader() : fScheduledUpload(false), fWaited(false) {}
|
||||
|
||||
virtual ~GrDeferredProxyUploader() {
|
||||
// In normal usage (i.e., through GrTDeferredProxyUploader) this will be redundant
|
||||
this->wait();
|
||||
}
|
||||
|
||||
void scheduleUpload(GrOpFlushState* flushState, GrTextureProxy* proxy) {
|
||||
if (fScheduledUpload) {
|
||||
// Multiple references to the owning proxy may have caused us to already execute
|
||||
return;
|
||||
}
|
||||
|
||||
auto uploadMask = [this, proxy](GrDeferredTextureUploadWritePixelsFn& writePixelsFn) {
|
||||
this->wait();
|
||||
GrColorType pixelColorType = SkColorTypeToGrColorType(this->fPixels.info().colorType());
|
||||
// If the worker thread was unable to allocate pixels, this check will fail, and we'll
|
||||
// end up drawing with an uninitialized mask texture, but at least we won't crash.
|
||||
if (this->fPixels.addr()) {
|
||||
writePixelsFn(proxy, 0, 0, this->fPixels.width(), this->fPixels.height(),
|
||||
pixelColorType, this->fPixels.addr(), this->fPixels.rowBytes());
|
||||
}
|
||||
// Upload has finished, so tell the proxy to release this GrDeferredProxyUploader
|
||||
proxy->texPriv().resetDeferredUploader();
|
||||
};
|
||||
flushState->addASAPUpload(std::move(uploadMask));
|
||||
fScheduledUpload = true;
|
||||
}
|
||||
|
||||
void signalAndFreeData() {
|
||||
this->freeData();
|
||||
fPixelsReady.signal();
|
||||
}
|
||||
|
||||
SkAutoPixmapStorage* getPixels() { return &fPixels; }
|
||||
|
||||
protected:
|
||||
void wait() {
|
||||
if (!fWaited) {
|
||||
fPixelsReady.wait();
|
||||
fWaited = true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void freeData() {}
|
||||
|
||||
SkAutoPixmapStorage fPixels;
|
||||
SkSemaphore fPixelsReady;
|
||||
bool fScheduledUpload;
|
||||
bool fWaited;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class GrTDeferredProxyUploader : public GrDeferredProxyUploader {
|
||||
public:
|
||||
template <typename... Args>
|
||||
GrTDeferredProxyUploader(Args&&... args)
|
||||
: fData(std::make_unique<T>(std::forward<Args>(args)...)) {
|
||||
}
|
||||
|
||||
~GrTDeferredProxyUploader() override {
|
||||
// We need to wait here, so that we don't free fData before the worker thread is done
|
||||
// with it. (This happens if the proxy is deleted early due to a full clear or failure
|
||||
// of an op list to instantiate).
|
||||
this->wait();
|
||||
}
|
||||
|
||||
T& data() { return *fData; }
|
||||
|
||||
private:
|
||||
void freeData() override {
|
||||
fData.reset();
|
||||
}
|
||||
|
||||
std::unique_ptr<T> fData;
|
||||
};
|
||||
|
||||
#endif
|
@ -37,7 +37,6 @@
|
||||
#include "src/gpu/GrTTopoSort.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/GrTextureResolveRenderTask.h"
|
||||
#include "src/gpu/GrTracing.h"
|
||||
#include "src/gpu/GrTransferFromRenderTask.h"
|
||||
@ -171,10 +170,9 @@ bool GrDrawingManager::flush(
|
||||
onFlushRenderTask->makeClosed(*fContext->priv().caps());
|
||||
#ifdef SK_DEBUG
|
||||
// OnFlush callbacks are invoked during flush, and are therefore expected to handle
|
||||
// resource allocation & usage on their own. (No deferred or lazy proxies!)
|
||||
// resource allocation & usage on their own. (No lazy proxies!)
|
||||
onFlushRenderTask->visitTargetAndSrcProxies_debugOnly(
|
||||
[](GrSurfaceProxy* p, GrMipmapped mipMapped) {
|
||||
SkASSERT(!p->asTextureProxy() || !p->asTextureProxy()->texPriv().isDeferred());
|
||||
SkASSERT(!p->isLazy());
|
||||
if (p->requiresManualMSAAResolve()) {
|
||||
// The onFlush callback is responsible for ensuring MSAA gets resolved.
|
||||
@ -318,8 +316,6 @@ bool GrDrawingManager::executeRenderTasks(int startIndex, int stopIndex, GrOpFlu
|
||||
continue;
|
||||
}
|
||||
|
||||
SkASSERT(renderTask->deferredProxiesAreInstantiated());
|
||||
|
||||
renderTask->prepare(flushState);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "src/gpu/GrSemaphore.h"
|
||||
#include "src/gpu/GrStagingBufferManager.h"
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/GrTracing.h"
|
||||
#include "src/sksl/SkSLCompiler.h"
|
||||
#include "src/utils/SkJSONWriter.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define GrOpsRenderPass_DEFINED
|
||||
|
||||
#include "include/core/SkDrawable.h"
|
||||
#include "src/gpu/GrDeferredUpload.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/ops/GrDrawOp.h"
|
||||
|
||||
|
@ -432,7 +432,6 @@ void GrOpsTask::endFlush(GrDrawingManager* drawingMgr) {
|
||||
this->deleteOps();
|
||||
fClipAllocators.reset();
|
||||
|
||||
fDeferredProxies.reset();
|
||||
fSampledProxies.reset();
|
||||
fAuditTrail = nullptr;
|
||||
|
||||
@ -676,7 +675,6 @@ void GrOpsTask::setColorLoadOp(GrLoadOp op, std::array<float, 4> color) {
|
||||
|
||||
int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
|
||||
GrOpsTask* last = this;
|
||||
int addlDeferredProxyCount = 0;
|
||||
int addlProxyCount = 0;
|
||||
int addlOpChainCount = 0;
|
||||
int mergedCount = 0;
|
||||
@ -688,7 +686,6 @@ int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
|
||||
SkASSERT(fTargetSwizzle == opsTask->fTargetSwizzle);
|
||||
SkASSERT(fTargetOrigin == opsTask->fTargetOrigin);
|
||||
mergedCount += 1;
|
||||
addlDeferredProxyCount += opsTask->fDeferredProxies.count();
|
||||
addlProxyCount += opsTask->fSampledProxies.count();
|
||||
addlOpChainCount += opsTask->fOpChains.count();
|
||||
fClippedContentBounds.join(opsTask->fClippedContentBounds);
|
||||
@ -701,14 +698,11 @@ int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
|
||||
return 0;
|
||||
}
|
||||
fLastClipStackGenID = SK_InvalidUniqueID;
|
||||
fDeferredProxies.reserve_back(addlDeferredProxyCount);
|
||||
fSampledProxies.reserve_back(addlProxyCount);
|
||||
fOpChains.reserve_back(addlOpChainCount);
|
||||
fClipAllocators.reserve_back(mergedCount);
|
||||
for (const sk_sp<GrRenderTask>& task : tasks.first(mergedCount)) {
|
||||
auto opsTask = reinterpret_cast<GrOpsTask*>(task.get());
|
||||
fDeferredProxies.move_back_n(opsTask->fDeferredProxies.count(),
|
||||
opsTask->fDeferredProxies.data());
|
||||
fSampledProxies.move_back_n(opsTask->fSampledProxies.count(),
|
||||
opsTask->fSampledProxies.data());
|
||||
fOpChains.move_back_n(opsTask->fOpChains.count(),
|
||||
@ -716,7 +710,6 @@ int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
|
||||
SkASSERT(1 == opsTask->fClipAllocators.count());
|
||||
fClipAllocators.push_back(std::move(opsTask->fClipAllocators[0]));
|
||||
opsTask->fClipAllocators.reset();
|
||||
opsTask->fDeferredProxies.reset();
|
||||
opsTask->fSampledProxies.reset();
|
||||
opsTask->fOpChains.reset();
|
||||
}
|
||||
@ -727,7 +720,6 @@ int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
|
||||
bool GrOpsTask::resetForFullscreenClear(CanDiscardPreviousOps canDiscardPreviousOps) {
|
||||
if (CanDiscardPreviousOps::kYes == canDiscardPreviousOps || this->isEmpty()) {
|
||||
this->deleteOps();
|
||||
fDeferredProxies.reset();
|
||||
fSampledProxies.reset();
|
||||
|
||||
// If the opsTask is using a render target which wraps a vulkan command buffer, we can't do
|
||||
@ -865,16 +857,6 @@ void GrOpsTask::handleInternalAllocationFailure() {
|
||||
}
|
||||
|
||||
void GrOpsTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {
|
||||
for (int i = 0; i < fDeferredProxies.count(); ++i) {
|
||||
SkASSERT(!fDeferredProxies[i]->isInstantiated());
|
||||
// We give all the deferred proxies a write usage at the very start of flushing. This
|
||||
// locks them out of being reused for the entire flush until they are read - and then
|
||||
// they can be recycled. This is a bit unfortunate because a flush can proceed in waves
|
||||
// with sub-flushes. The deferred proxies only need to be pinned from the start of
|
||||
// the sub-flush in which they appear.
|
||||
alloc->addInterval(fDeferredProxies[i], 0, 0, GrResourceAllocator::ActualUse::kNo);
|
||||
}
|
||||
|
||||
GrSurfaceProxy* targetProxy = this->target(0);
|
||||
|
||||
// Add the interval for all the writes to this GrOpsTasks's target
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "src/gpu/GrAttachment.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/GrTextureResolveRenderTask.h"
|
||||
|
||||
uint32_t GrRenderTask::CreateUniqueID() {
|
||||
@ -47,15 +46,6 @@ GrRenderTask::~GrRenderTask() {
|
||||
SkASSERT(this->isSetFlag(kDisowned_Flag));
|
||||
}
|
||||
|
||||
bool GrRenderTask::deferredProxiesAreInstantiated() const {
|
||||
for (int i = 0; i < fDeferredProxies.count(); ++i) {
|
||||
if (!fDeferredProxies[i]->isInstantiated()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void GrRenderTask::makeClosed(const GrCaps& caps) {
|
||||
@ -85,14 +75,6 @@ void GrRenderTask::makeClosed(const GrCaps& caps) {
|
||||
this->setFlag(kClosed_Flag);
|
||||
}
|
||||
|
||||
void GrRenderTask::prepare(GrOpFlushState* flushState) {
|
||||
for (int i = 0; i < fDeferredProxies.count(); ++i) {
|
||||
fDeferredProxies[i]->texPriv().scheduleUpload(flushState);
|
||||
}
|
||||
|
||||
this->onPrepare(flushState);
|
||||
}
|
||||
|
||||
// Add a GrRenderTask-based dependency
|
||||
void GrRenderTask::addDependency(GrRenderTask* dependedOn) {
|
||||
SkASSERT(!dependedOn->dependsOn(this)); // loops are bad
|
||||
@ -131,8 +113,6 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
SkASSERT(GrMipmapped::kNo == mipMapped);
|
||||
// We should never attempt a self-read on a surface that has a separate MSAA renderbuffer.
|
||||
SkASSERT(!dependedOn->requiresManualMSAAResolve());
|
||||
SkASSERT(!dependedOn->asTextureProxy() ||
|
||||
!dependedOn->asTextureProxy()->texPriv().isDeferred());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -186,9 +166,6 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
if (dependedOnTask) {
|
||||
SkASSERT(fTextureResolveTask->dependsOn(dependedOnTask));
|
||||
}
|
||||
if (textureProxy && textureProxy->texPriv().isDeferred()) {
|
||||
SkASSERT(fTextureResolveTask->fDeferredProxies.back() == textureProxy);
|
||||
}
|
||||
|
||||
// The GrTextureResolveRenderTask factory should have also marked the proxy clean, set the
|
||||
// last renderTask on the textureProxy to textureResolveTask, and closed textureResolveTask.
|
||||
@ -203,10 +180,6 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
return;
|
||||
}
|
||||
|
||||
if (textureProxy && textureProxy->texPriv().isDeferred()) {
|
||||
fDeferredProxies.push_back(textureProxy);
|
||||
}
|
||||
|
||||
if (dependedOnTask) {
|
||||
this->addDependency(dependedOnTask);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
void prePrepare(GrRecordingContext* context) { this->onPrePrepare(context); }
|
||||
|
||||
// These two methods are only invoked at flush time
|
||||
void prepare(GrOpFlushState* flushState);
|
||||
void prepare(GrOpFlushState* flushState) { this->onPrepare(flushState); }
|
||||
bool execute(GrOpFlushState* flushState) { return this->onExecute(flushState); }
|
||||
|
||||
virtual bool requiresExplicitCleanup() const { return false; }
|
||||
@ -133,8 +133,6 @@ public:
|
||||
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrRenderTask);
|
||||
|
||||
protected:
|
||||
SkDEBUGCODE(bool deferredProxiesAreInstantiated() const;)
|
||||
|
||||
// Add a target surface proxy to the list of targets for this task.
|
||||
// This also informs the drawing manager to update the lastRenderTask association.
|
||||
void addTarget(GrDrawingManager*, sk_sp<GrSurfaceProxy>);
|
||||
@ -158,11 +156,6 @@ protected:
|
||||
|
||||
SkSTArray<1, sk_sp<GrSurfaceProxy>> fTargets;
|
||||
|
||||
// List of texture proxies whose contents are being prepared on a worker thread
|
||||
// TODO: this list exists so we can fire off the proper upload when an renderTask begins
|
||||
// executing. Can this be replaced?
|
||||
SkTArray<GrTextureProxy*, true> fDeferredProxies;
|
||||
|
||||
enum Flags {
|
||||
kClosed_Flag = 0x01, //!< This task can't accept any more dependencies.
|
||||
kDisowned_Flag = 0x02, //!< This task is disowned by its creating GrDrawingManager.
|
||||
|
@ -94,12 +94,7 @@ void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start,
|
||||
if (Interval* intvl = fIntvlHash.find(proxy->uniqueID().asUInt())) {
|
||||
// Revise the interval for an existing use
|
||||
#ifdef SK_DEBUG
|
||||
if (0 == start && 0 == end) {
|
||||
// This interval is for the initial upload to a deferred proxy. Due to the vagaries
|
||||
// of how deferred proxies are collected they can appear as uploads multiple times
|
||||
// in a single opsTasks' list and as uploads in several opsTasks.
|
||||
SkASSERT(0 == intvl->start());
|
||||
} else if (isDirectDstRead) {
|
||||
if (isDirectDstRead) {
|
||||
// Direct reads from the render target itself should occur w/in the existing
|
||||
// interval
|
||||
SkASSERT(intvl->start() <= start && intvl->end() >= end);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrClip.h"
|
||||
#include "src/gpu/GrDeferredProxyUploader.h"
|
||||
#include "src/gpu/GrDirectContextPriv.h"
|
||||
#include "src/gpu/GrGpuResourcePriv.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
|
@ -6,13 +6,12 @@
|
||||
*/
|
||||
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrDeferredProxyUploader.h"
|
||||
#include "src/gpu/GrDirectContextPriv.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
#include "src/gpu/GrSurface.h"
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
|
||||
// Deferred version - no data
|
||||
@ -31,8 +30,7 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
|
||||
, fMipmapStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
, fProxyProvider(nullptr) {
|
||||
SkASSERT(!(fSurfaceFlags & GrInternalSurfaceFlags::kFramebufferOnly));
|
||||
if (this->textureType() == GrTextureType::kExternal) {
|
||||
fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
|
||||
@ -57,8 +55,7 @@ GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
|
||||
, fMipmapStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
, fProxyProvider(nullptr) {
|
||||
SkASSERT(!(fSurfaceFlags & GrInternalSurfaceFlags::kFramebufferOnly));
|
||||
if (this->textureType() == GrTextureType::kExternal) {
|
||||
fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
|
||||
@ -74,8 +71,7 @@ GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf,
|
||||
, fMipmapStatus(fTarget->asTexture()->mipmapStatus())
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
, fProxyProvider(nullptr) {
|
||||
if (fTarget->getUniqueKey().isValid()) {
|
||||
fProxyProvider = fTarget->asTexture()->getContext()->priv().proxyProvider();
|
||||
fProxyProvider->adoptUniqueKeyFromSurface(this, fTarget.get());
|
||||
@ -127,23 +123,6 @@ sk_sp<GrSurface> GrTextureProxy::createSurface(GrResourceProvider* resourceProvi
|
||||
return surface;
|
||||
}
|
||||
|
||||
void GrTextureProxyPriv::setDeferredUploader(std::unique_ptr<GrDeferredProxyUploader> uploader) {
|
||||
SkASSERT(!fTextureProxy->fDeferredUploader);
|
||||
fTextureProxy->fDeferredUploader = std::move(uploader);
|
||||
}
|
||||
|
||||
void GrTextureProxyPriv::scheduleUpload(GrOpFlushState* flushState) {
|
||||
// The texture proxy's contents may already have been uploaded or instantiation may have failed
|
||||
if (fTextureProxy->fDeferredUploader && fTextureProxy->isInstantiated()) {
|
||||
fTextureProxy->fDeferredUploader->scheduleUpload(flushState, fTextureProxy);
|
||||
}
|
||||
}
|
||||
|
||||
void GrTextureProxyPriv::resetDeferredUploader() {
|
||||
SkASSERT(fTextureProxy->fDeferredUploader);
|
||||
fTextureProxy->fDeferredUploader.reset();
|
||||
}
|
||||
|
||||
GrMipmapped GrTextureProxy::mipmapped() const {
|
||||
if (this->isInstantiated()) {
|
||||
return this->peekTexture()->mipmapped();
|
||||
|
@ -12,10 +12,8 @@
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
|
||||
class GrCaps;
|
||||
class GrDeferredProxyUploader;
|
||||
class GrProxyProvider;
|
||||
class GrResourceProvider;
|
||||
class GrTextureProxyPriv;
|
||||
|
||||
// This class delays the acquisition of textures until they are actually required
|
||||
class GrTextureProxy : virtual public GrSurfaceProxy {
|
||||
@ -94,17 +92,12 @@ public:
|
||||
inline CacheAccess cacheAccess();
|
||||
inline const CacheAccess cacheAccess() const; // NOLINT(readability-const-return-type)
|
||||
|
||||
// Provides access to special purpose functions.
|
||||
GrTextureProxyPriv texPriv();
|
||||
const GrTextureProxyPriv texPriv() const; // NOLINT(readability-const-return-type)
|
||||
|
||||
SkDEBUGCODE(GrDDLProvider creatingProvider() const { return fCreatingProvider; })
|
||||
|
||||
protected:
|
||||
// DDL TODO: rm the GrSurfaceProxy friending
|
||||
friend class GrSurfaceProxy; // for ctors
|
||||
friend class GrProxyProvider; // for ctors
|
||||
friend class GrTextureProxyPriv;
|
||||
friend class GrSurfaceProxyPriv; // ability to change key sync state after lazy instantiation.
|
||||
|
||||
// Deferred version - no data.
|
||||
@ -189,11 +182,6 @@ private:
|
||||
|
||||
LazySurfaceDesc callbackDesc() const override;
|
||||
|
||||
// Only used for proxies whose contents are being prepared on a worker thread. This object
|
||||
// stores the texture data, allowing the proxy to remain uninstantiated until flush. At that
|
||||
// point, the proxy is instantiated, and this data is used to perform an ASAP upload.
|
||||
std::unique_ptr<GrDeferredProxyUploader> fDeferredUploader;
|
||||
|
||||
size_t onUninstantiatedGpuMemorySize() const override;
|
||||
|
||||
// Methods made available via GrTextureProxy::CacheAccess
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrTextureProxyPriv_DEFINED
|
||||
#define GrTextureProxyPriv_DEFINED
|
||||
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
|
||||
class GrDeferredProxyUploader;
|
||||
class GrOpFlushState;
|
||||
|
||||
/**
|
||||
* This class hides the more specialized capabilities of GrTextureProxy.
|
||||
*/
|
||||
class GrTextureProxyPriv {
|
||||
public:
|
||||
// Attach a deferred uploader to the proxy. Holds data being prepared by a worker thread.
|
||||
void setDeferredUploader(std::unique_ptr<GrDeferredProxyUploader>);
|
||||
bool isDeferred() const { return SkToBool(fTextureProxy->fDeferredUploader.get()); }
|
||||
// For a deferred proxy (one that has a deferred uploader attached), this schedules an ASAP
|
||||
// upload of that data to the instantiated texture.
|
||||
void scheduleUpload(GrOpFlushState*);
|
||||
// Clears any deferred uploader object on the proxy. Used to free the CPU data after the
|
||||
// contents have been uploaded.
|
||||
void resetDeferredUploader();
|
||||
|
||||
private:
|
||||
explicit GrTextureProxyPriv(GrTextureProxy* textureProxy) : fTextureProxy(textureProxy) {}
|
||||
GrTextureProxyPriv(const GrTextureProxyPriv&) = delete;
|
||||
GrTextureProxyPriv& operator=(const GrTextureProxyPriv&) = delete;
|
||||
|
||||
// No taking addresses of this type.
|
||||
const GrTextureProxyPriv* operator&() const;
|
||||
GrTextureProxyPriv* operator&();
|
||||
|
||||
GrTextureProxy* fTextureProxy;
|
||||
|
||||
friend class GrTextureProxy; // to construct/copy this type.
|
||||
};
|
||||
|
||||
inline GrTextureProxyPriv GrTextureProxy::texPriv() { return GrTextureProxyPriv(this); }
|
||||
|
||||
inline const GrTextureProxyPriv GrTextureProxy::texPriv() const { // NOLINT(readability-const-return-type)
|
||||
return GrTextureProxyPriv(const_cast<GrTextureProxy*>(this));
|
||||
}
|
||||
|
||||
#endif
|
@ -12,7 +12,6 @@
|
||||
#include "src/gpu/GrSurface.h"
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "src/gpu/GrProgramDesc.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/gl/GrGLContext.h"
|
||||
#include "src/gpu/gl/GrGLRenderTarget.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define GrDrawOp_DEFINED
|
||||
|
||||
#include <functional>
|
||||
#include "src/gpu/GrDeferredUpload.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/ops/GrOp.h"
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureAdjuster.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/GrYUVATextureProxies.h"
|
||||
#include "src/gpu/gl/GrGLTexture.h"
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/gl/GrGLGpu.h"
|
||||
#include "src/gpu/gl/GrGLUtil.h"
|
||||
#include "tests/Test.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
#include "src/gpu/mock/GrMockGpu.h"
|
||||
|
||||
// This test verifies that lazy proxy callbacks get invoked during flush, after onFlush callbacks,
|
||||
|
Loading…
Reference in New Issue
Block a user