aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawOpAtlas.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-09 09:56:56 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-09 16:32:31 +0000
commitcd5099c75fd9ddc530347b976cb0e91abf85da00 (patch)
treee32c4a8af36233c0cf7fecfc923e28ca61b345ec /src/gpu/GrDrawOpAtlas.cpp
parent7af65446a085f9525c8cecc66aef49a831440875 (diff)
Make atlases instantiate themselves at flush time
Change-Id: I5ed9794bd78c8e5d999e892f5672b9c590b44285 Reviewed-on: https://skia-review.googlesource.com/106000 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrDrawOpAtlas.cpp')
-rw-r--r--src/gpu/GrDrawOpAtlas.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index e564e63b04..b2780e6635 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -9,6 +9,7 @@
#include "GrContext.h"
#include "GrContextPriv.h"
+#include "GrOnFlushResourceProvider.h"
#include "GrOpFlushState.h"
#include "GrRectanizer.h"
#include "GrProxyProvider.h"
@@ -16,6 +17,23 @@
#include "GrTexture.h"
#include "GrTracing.h"
+// When proxy allocation is deferred until flush time the proxies acting as atlases require
+// special handling. This is because the usage that can be determined from the ops themselves
+// isn't sufficient. Independent of the ops there will be ASAP and inline uploads to the
+// atlases. Extending the usage interval of any op that uses an atlas to the start of the
+// flush (as is done for proxies that are used for sw-generated masks) also won't work because
+// the atlas persists even beyond the last use in an op - for a given flush. Given this, atlases
+// must explicitly manage the lifetime of their backing proxies via the onFlushCallback system
+// (which calls this method).
+void GrDrawOpAtlas::instantiate(GrOnFlushResourceProvider* onFlushResourceProvider) {
+ for (int i = 0; i < GrDrawOpAtlas::kMaxMultitexturePages; ++i) {
+ if (fProxies[i] && !fProxies[i]->priv().isInstantiated()) {
+ // If instantiation fails we expect the ops that rely on the atlas to be dropped
+ onFlushResourceProvider->instatiateProxy(fProxies[i].get());
+ }
+ }
+}
+
std::unique_ptr<GrDrawOpAtlas> GrDrawOpAtlas::Make(GrContext* ctx, GrPixelConfig config, int width,
int height, int numPlotsX, int numPlotsY,
AllowMultitexturing allowMultitexturing,