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

Side by Side Diff: src/gpu/GrProgramResource.cpp

Issue 543833002: Add method to GrProgramResource to record that pending a execution was completed. (Closed) Base URL: https://skia.googlesource.com/skia.git@progelem
Patch Set: rebase Created 6 years, 3 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 | « src/gpu/GrProgramElement.cpp ('k') | no next file » | 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 #include "GrProgramResource.h" 8 #include "GrProgramResource.h"
9 #include "GrGpuResource.h" 9 #include "GrGpuResource.h"
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 fIOType = kNone_IOType; 67 fIOType = kNone_IOType;
68 } else { 68 } else {
69 SkASSERT(kNone_IOType != ioType); 69 SkASSERT(kNone_IOType != ioType);
70 fResource = resource; 70 fResource = resource;
71 fOwnRef = true; 71 fOwnRef = true;
72 fIOType = ioType; 72 fIOType = ioType;
73 } 73 }
74 } 74 }
75 75
76 void GrProgramResource::markPendingIO() const { 76 void GrProgramResource::markPendingIO() const {
77 // This should only be called once, when the owning GrProgramElement gets it s first 77 // This should only be called when the owning GrProgramElement gets its firs t
78 // pendingExecution ref. 78 // pendingExecution ref.
79 SkASSERT(!fPendingIO); 79 SkASSERT(!fPendingIO);
80 SkASSERT(NULL != fResource); 80 SkASSERT(NULL != fResource);
81 fPendingIO = true; 81 fPendingIO = true;
82 switch (fIOType) { 82 switch (fIOType) {
83 case kNone_IOType: 83 case kNone_IOType:
84 SkFAIL("GrProgramResource with neither reads nor writes?"); 84 SkFAIL("GrProgramResource with neither reads nor writes?");
85 break; 85 break;
86 case kRead_IOType: 86 case kRead_IOType:
87 fResource->addPendingRead(); 87 fResource->addPendingRead();
88 break; 88 break;
89 case kWrite_IOType: 89 case kWrite_IOType:
90 fResource->addPendingWrite(); 90 fResource->addPendingWrite();
91 break; 91 break;
92 case kRW_IOType: 92 case kRW_IOType:
93 fResource->addPendingRead(); 93 fResource->addPendingRead();
94 fResource->addPendingWrite(); 94 fResource->addPendingWrite();
95 break; 95 break;
96 96
97 } 97 }
98 } 98 }
99 99
100 void GrProgramResource::pendingIOComplete() const {
101 // This should only be called when the owner's pending executions have ocurr ed but it is still
102 // reffed.
103 SkASSERT(fOwnRef);
104 SkASSERT(fPendingIO);
105 switch (fIOType) {
106 case kNone_IOType:
107 SkFAIL("GrProgramResource with neither reads nor writes?");
108 break;
109 case kRead_IOType:
110 fResource->completedRead();
111 break;
112 case kWrite_IOType:
113 fResource->completedWrite();
114 break;
115 case kRW_IOType:
116 fResource->completedRead();
117 fResource->completedWrite();
118 break;
119
120 }
121 fPendingIO = false;
122 }
123
100 void GrProgramResource::removeRef() const { 124 void GrProgramResource::removeRef() const {
101 // This should only be called once, when the owners last ref goes away and 125 // This should only be called once, when the owners last ref goes away and
102 // there is a pending execution. 126 // there is a pending execution.
103 SkASSERT(fOwnRef); 127 SkASSERT(fOwnRef);
104 SkASSERT(fPendingIO); 128 SkASSERT(fPendingIO);
105 SkASSERT(kNone_IOType != fIOType); 129 SkASSERT(kNone_IOType != fIOType);
106 SkASSERT(NULL != fResource); 130 SkASSERT(NULL != fResource);
107 fResource->unref(); 131 fResource->unref();
108 fOwnRef = false; 132 fOwnRef = false;
109 } 133 }
OLDNEW
« no previous file with comments | « src/gpu/GrProgramElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698