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>
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp
index 405679d..532e065 100644
--- a/src/gpu/GrGpuResourceRef.cpp
+++ b/src/gpu/GrGpuResourceRef.cpp
@@ -66,10 +66,13 @@
}
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::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::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;
}