aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-25 08:53:09 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-25 13:52:55 +0000
commit6d36370c06fac5da22e6d7ea68b47ffee0d672aa (patch)
treecc387851327f72b48535725b7a6613b221650fdd
parent93ae2337732bf206e6ef4faecc6b30c3881e8359 (diff)
Add bullet proofing for preAbandonContext
With the more agressive abandonment of the GrContext state in https://skia-review.googlesource.com/c/skia/+/137121 (Fix abandonment of programs) (i.e., nulling out of the interface) it is necessary to add more guards so that we don't try calling GL methods when the context has been abandoned. Change-Id: Ib2a3c17b9eaebd1eb84eb82a2781cf9d5a6a34a3 Reviewed-on: https://skia-review.googlesource.com/137362 Reviewed-by: Joe Gregorio <jcgregorio@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r--gm/imagefromyuvtextures.cpp7
-rw-r--r--gm/rectangletexture.cpp3
-rw-r--r--tools/gpu/ProxyUtils.cpp4
3 files changed, 14 insertions, 0 deletions
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 4139ca802b..87ab51ec1d 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -94,6 +94,10 @@ protected:
}
void createYUVTextures(GrContext* context, GrBackendTexture yuvTextures[3]) {
+ if (context->contextPriv().abandoned()) {
+ return;
+ }
+
GrGpu* gpu = context->contextPriv().getGpu();
if (!gpu) {
return;
@@ -111,6 +115,9 @@ protected:
}
void deleteYUVTextures(GrContext* context, GrBackendTexture yuvTextures[3]) {
+ if (context->contextPriv().abandoned()) {
+ return;
+ }
GrGpu* gpu = context->contextPriv().getGpu();
if (!gpu) {
diff --git a/gm/rectangletexture.cpp b/gm/rectangletexture.cpp
index a603be7bdc..d6bf1fb87e 100644
--- a/gm/rectangletexture.cpp
+++ b/gm/rectangletexture.cpp
@@ -60,6 +60,9 @@ protected:
if (!context) {
return nullptr;
}
+ if (context->contextPriv().abandoned()) {
+ return nullptr;
+ }
GrGpu* gpu = context->contextPriv().getGpu();
if (!gpu) {
return nullptr;
diff --git a/tools/gpu/ProxyUtils.cpp b/tools/gpu/ProxyUtils.cpp
index bba17de939..64af648068 100644
--- a/tools/gpu/ProxyUtils.cpp
+++ b/tools/gpu/ProxyUtils.cpp
@@ -18,6 +18,10 @@ sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, in
GrColorType ct, GrSRGBEncoded srgbEncoded,
GrSurfaceOrigin origin, const void* data,
size_t rowBytes) {
+ if (context->contextPriv().abandoned()) {
+ return nullptr;
+ }
+
auto config = GrColorTypeToPixelConfig(ct, srgbEncoded);
sk_sp<GrTextureProxy> proxy;
if (kBottomLeft_GrSurfaceOrigin == origin) {