Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: include/gpu/GrGpuResource.h

Issue 586073002: Don't flush on read/write pixels unless necessary (Closed) Base URL: https://skia.googlesource.com/skia.git@iotype
Patch Set: Flush when drawing direct to GrGpu in GrContext Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/GrSurface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGpuResource_DEFINED 8 #ifndef GrGpuResource_DEFINED
9 #define GrGpuResource_DEFINED 9 #define GrGpuResource_DEFINED
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 void validate() const { 74 void validate() const {
75 #ifdef SK_DEBUG 75 #ifdef SK_DEBUG
76 SkASSERT(fRefCnt >= 0); 76 SkASSERT(fRefCnt >= 0);
77 SkASSERT(fPendingReads >= 0); 77 SkASSERT(fPendingReads >= 0);
78 SkASSERT(fPendingWrites >= 0); 78 SkASSERT(fPendingWrites >= 0);
79 SkASSERT(fRefCnt + fPendingReads + fPendingWrites > 0); 79 SkASSERT(fRefCnt + fPendingReads + fPendingWrites > 0);
80 #endif 80 #endif
81 } 81 }
82 82
83
83 protected: 84 protected:
84 GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {} 85 GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0) {}
85 86
87 bool internalHasPendingRead() const { return SkToBool(fPendingReads); }
88 bool internalHasPendingWrite() const { return SkToBool(fPendingWrites); }
89 bool internalHasPendingIO() const { return SkToBool(fPendingWrites | fPendin gReads); }
90
86 private: 91 private:
87 void addPendingRead() const { 92 void addPendingRead() const {
88 this->validate(); 93 this->validate();
89 ++fPendingReads; 94 ++fPendingReads;
90 } 95 }
91 96
92 void completedRead() const { 97 void completedRead() const {
93 this->validate(); 98 this->validate();
94 --fPendingReads; 99 --fPendingReads;
95 if (0 == fRefCnt && 0 == fPendingReads && 0 == fPendingWrites) { 100 if (0 == fRefCnt && 0 == fPendingReads && 0 == fPendingWrites) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 250
246 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache 251 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
247 const uint32_t fUniqueID; 252 const uint32_t fUniqueID;
248 253
249 GrResourceKey fScratchKey; 254 GrResourceKey fScratchKey;
250 255
251 typedef GrIORef INHERITED; 256 typedef GrIORef INHERITED;
252 }; 257 };
253 258
254 #endif 259 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698