Revert "Remove deferred proxy machinery"
This reverts commit a3987cc5873c9bce758fa3843bb801c95d282bbd.
Reason for revert: Keeping it
Original change's description:
> 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>
TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
Bug: skia:11288
Change-Id: Iafa9ed18a772e451349dfad61ee462df963028be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 4884d45..d7be2fe 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -6,12 +6,13 @@
*/
#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
@@ -30,7 +31,8 @@
, fMipmapStatus(mipmapStatus)
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
, fCreatingProvider(creatingProvider)
- , fProxyProvider(nullptr) {
+ , fProxyProvider(nullptr)
+ , fDeferredUploader(nullptr) {
SkASSERT(!(fSurfaceFlags & GrInternalSurfaceFlags::kFramebufferOnly));
if (this->textureType() == GrTextureType::kExternal) {
fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
@@ -55,7 +57,8 @@
, fMipmapStatus(mipmapStatus)
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
, fCreatingProvider(creatingProvider)
- , fProxyProvider(nullptr) {
+ , fProxyProvider(nullptr)
+ , fDeferredUploader(nullptr) {
SkASSERT(!(fSurfaceFlags & GrInternalSurfaceFlags::kFramebufferOnly));
if (this->textureType() == GrTextureType::kExternal) {
fSurfaceFlags |= GrInternalSurfaceFlags::kReadOnly;
@@ -71,7 +74,8 @@
, fMipmapStatus(fTarget->asTexture()->mipmapStatus())
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
, fCreatingProvider(creatingProvider)
- , fProxyProvider(nullptr) {
+ , fProxyProvider(nullptr)
+ , fDeferredUploader(nullptr) {
if (fTarget->getUniqueKey().isValid()) {
fProxyProvider = fTarget->asTexture()->getContext()->priv().proxyProvider();
fProxyProvider->adoptUniqueKeyFromSurface(this, fTarget.get());
@@ -123,6 +127,23 @@
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();