aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResourceRef.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-05-01 13:12:20 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-03 16:59:37 +0000
commita91e0b7cc2537dc57ccf67914638e13b4612ffd1 (patch)
tree858fb3b4d98cb07461468f9b9ea1935f7950392e /src/gpu/GrGpuResourceRef.cpp
parent7eb86981a954c500fa4a4d8425496a5beb789e5d (diff)
Allow TextureSamplers to have null GrTexture pointer
Bug: 715488 Change-Id: I69775cbb50d334d81872e236e59368fe65e698ff Reviewed-on: https://skia-review.googlesource.com/14605 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrGpuResourceRef.cpp')
-rw-r--r--src/gpu/GrGpuResourceRef.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp
index 405679d4f1..532e0655d8 100644
--- a/src/gpu/GrGpuResourceRef.cpp
+++ b/src/gpu/GrGpuResourceRef.cpp
@@ -66,10 +66,13 @@ void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType) {
}
void GrGpuResourceRef::markPendingIO() const {
+ if (!fResource) {
+ return;
+ }
+
// This should only be called when the owning GrProgramElement gets its first
// pendingExecution ref.
SkASSERT(!fPendingIO);
- SkASSERT(fResource);
fPendingIO = true;
switch (fIOType) {
case kRead_GrIOType:
@@ -86,6 +89,10 @@ void GrGpuResourceRef::markPendingIO() const {
}
void GrGpuResourceRef::pendingIOComplete() const {
+ if (!fResource) {
+ return;
+ }
+
// This should only be called when the owner's pending executions have ocurred but it is still
// reffed.
SkASSERT(fOwnRef);
@@ -107,11 +114,14 @@ void GrGpuResourceRef::pendingIOComplete() const {
}
void GrGpuResourceRef::removeRef() const {
+ if (!fResource) {
+ return;
+ }
+
// This should only be called once, when the owners last ref goes away and
// there is a pending execution.
SkASSERT(fOwnRef);
SkASSERT(fPendingIO);
- SkASSERT(fResource);
fResource->unref();
fOwnRef = false;
}