Rename GrProgramResource to GrGpuResourceRef
BUG=skia:2889
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/574333003
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index f04d592..4d72062 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -9,7 +9,7 @@
#define GrDrawState_DEFINED
#include "GrBlend.h"
-#include "GrProgramResource.h"
+#include "GrGpuResourceRef.h"
#include "GrRODrawState.h"
#include "effects/GrSimpleTextureEffect.h"
@@ -405,7 +405,7 @@
* @param target The render target to set.
*/
void setRenderTarget(GrRenderTarget* target) {
- fRenderTarget.set(SkSafeRef(target), GrProgramResource::kWrite_IOType);
+ fRenderTarget.set(SkSafeRef(target), GrGpuResourceRef::kWrite_IOType);
this->invalidateOptState();
}
diff --git a/src/gpu/GrEffect.cpp b/src/gpu/GrEffect.cpp
index 50a1980..28c23d7 100644
--- a/src/gpu/GrEffect.cpp
+++ b/src/gpu/GrEffect.cpp
@@ -72,7 +72,7 @@
void GrEffect::addTextureAccess(const GrTextureAccess* access) {
fTextureAccesses.push_back(access);
- this->addProgramResource(access->getProgramTexture());
+ this->addGpuResource(access->getProgramTexture());
}
void* GrEffect::operator new(size_t size) {
diff --git a/src/gpu/GrProgramResource.cpp b/src/gpu/GrGpuResourceRef.cpp
similarity index 83%
rename from src/gpu/GrProgramResource.cpp
rename to src/gpu/GrGpuResourceRef.cpp
index 482caff..74b1ef0 100644
--- a/src/gpu/GrProgramResource.cpp
+++ b/src/gpu/GrGpuResourceRef.cpp
@@ -5,24 +5,24 @@
* found in the LICENSE file.
*/
-#include "GrProgramResource.h"
+#include "GrGpuResourceRef.h"
#include "GrGpuResource.h"
-GrProgramResource::GrProgramResource() {
+GrGpuResourceRef::GrGpuResourceRef() {
fResource = NULL;
fOwnRef = false;
fPendingIO = false;
fIOType = kNone_IOType;
}
-GrProgramResource::GrProgramResource(GrGpuResource* resource, IOType ioType) {
+GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, IOType ioType) {
fResource = NULL;
fOwnRef = false;
fPendingIO = false;
this->setResource(resource, ioType);
}
-GrProgramResource::~GrProgramResource() {
+GrGpuResourceRef::~GrGpuResourceRef() {
if (fOwnRef) {
SkASSERT(fResource);
fResource->unref();
@@ -46,7 +46,7 @@
}
}
-void GrProgramResource::reset() {
+void GrGpuResourceRef::reset() {
SkASSERT(!fPendingIO);
SkASSERT(SkToBool(fResource) == fOwnRef);
if (fOwnRef) {
@@ -57,7 +57,7 @@
}
}
-void GrProgramResource::setResource(GrGpuResource* resource, IOType ioType) {
+void GrGpuResourceRef::setResource(GrGpuResource* resource, IOType ioType) {
SkASSERT(!fPendingIO);
SkASSERT(SkToBool(fResource) == fOwnRef);
SkSafeUnref(fResource);
@@ -73,7 +73,7 @@
}
}
-void GrProgramResource::markPendingIO() const {
+void GrGpuResourceRef::markPendingIO() const {
// This should only be called when the owning GrProgramElement gets its first
// pendingExecution ref.
SkASSERT(!fPendingIO);
@@ -81,7 +81,7 @@
fPendingIO = true;
switch (fIOType) {
case kNone_IOType:
- SkFAIL("GrProgramResource with neither reads nor writes?");
+ SkFAIL("GrGpuResourceRef with neither reads nor writes?");
break;
case kRead_IOType:
fResource->addPendingRead();
@@ -97,14 +97,14 @@
}
}
-void GrProgramResource::pendingIOComplete() const {
+void GrGpuResourceRef::pendingIOComplete() const {
// This should only be called when the owner's pending executions have ocurred but it is still
// reffed.
SkASSERT(fOwnRef);
SkASSERT(fPendingIO);
switch (fIOType) {
case kNone_IOType:
- SkFAIL("GrProgramResource with neither reads nor writes?");
+ SkFAIL("GrGpuResourceRef with neither reads nor writes?");
break;
case kRead_IOType:
fResource->completedRead();
@@ -121,7 +121,7 @@
fPendingIO = false;
}
-void GrProgramResource::removeRef() const {
+void GrGpuResourceRef::removeRef() const {
// This should only be called once, when the owners last ref goes away and
// there is a pending execution.
SkASSERT(fOwnRef);
diff --git a/src/gpu/GrProgramElement.cpp b/src/gpu/GrProgramElement.cpp
index 20a957f..2c3085f 100644
--- a/src/gpu/GrProgramElement.cpp
+++ b/src/gpu/GrProgramElement.cpp
@@ -6,7 +6,7 @@
*/
#include "GrProgramElement.h"
-#include "GrProgramResource.h"
+#include "GrGpuResourceRef.h"
uint32_t GrProgramElement::CreateUniqueID() {
static int32_t gUniqueID = SK_InvalidUniqueID;
@@ -18,21 +18,21 @@
}
void GrProgramElement::convertRefToPendingExecution() const {
- // This function makes it so that all the GrProgramResources own a single ref to their
+ // This function makes it so that all the GrGpuResourceRefs own a single ref to their
// underlying GrGpuResource if there are any refs to the GrProgramElement and a single
// pending read/write if there are any pending executions of the GrProgramElement. The
- // GrProgramResource will give up its single ref and/or pending read/write in its destructor.
+ // GrGpuResourceRef will give up its single ref and/or pending read/write in its destructor.
SkASSERT(fRefCnt > 0);
if (0 == fPendingExecutions) {
- for (int i = 0; i < fProgramResources.count(); ++i) {
- fProgramResources[i]->markPendingIO();
+ for (int i = 0; i < fGpuResources.count(); ++i) {
+ fGpuResources[i]->markPendingIO();
}
}
++fPendingExecutions;
this->unref();
if (0 == fRefCnt) {
- for (int i = 0; i < fProgramResources.count(); ++i) {
- fProgramResources[i]->removeRef();
+ for (int i = 0; i < fGpuResources.count(); ++i) {
+ fGpuResources[i]->removeRef();
}
}
}
@@ -46,8 +46,8 @@
} else {
// Now our pending executions have ocurred and we still have refs. Convert
// ownership of our resources back to regular refs.
- for (int i = 0; i < fProgramResources.count(); ++i) {
- fProgramResources[i]->pendingIOComplete();
+ for (int i = 0; i < fGpuResources.count(); ++i) {
+ fGpuResources[i]->pendingIOComplete();
}
}
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp
index 26edb18..4d35684 100644
--- a/src/gpu/GrRODrawState.cpp
+++ b/src/gpu/GrRODrawState.cpp
@@ -14,7 +14,7 @@
GrRODrawState::GrRODrawState(const GrRODrawState& drawState) : INHERITED() {
fRenderTarget.setResource(SkSafeRef(drawState.fRenderTarget.getResource()),
- GrProgramResource::kWrite_IOType);
+ GrGpuResourceRef::kWrite_IOType);
}
bool GrRODrawState::isEqual(const GrRODrawState& that) const {
diff --git a/src/gpu/GrRODrawState.h b/src/gpu/GrRODrawState.h
index 7e57b08..75e36a6 100644
--- a/src/gpu/GrRODrawState.h
+++ b/src/gpu/GrRODrawState.h
@@ -397,7 +397,7 @@
GrBlendCoeff* srcCoeff = NULL,
GrBlendCoeff* dstCoeff = NULL) const;
- typedef GrProgramTResource<GrRenderTarget> ProgramRenderTarget;
+ typedef GrTGpuResourceRef<GrRenderTarget> ProgramRenderTarget;
// These fields are roughly sorted by decreasing likelihood of being different in op==
ProgramRenderTarget fRenderTarget;
GrColor fColor;
diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp
index c4cde3d..3e543ca 100644
--- a/src/gpu/GrTextureAccess.cpp
+++ b/src/gpu/GrTextureAccess.cpp
@@ -46,7 +46,7 @@
SkASSERT(strlen(swizzle) >= 1 && strlen(swizzle) <= 4);
fParams = params;
- fTexture.set(SkRef(texture), GrProgramResource::kRead_IOType);
+ fTexture.set(SkRef(texture), GrGpuResourceRef::kRead_IOType);
this->setSwizzle(swizzle);
}
@@ -58,14 +58,14 @@
SkASSERT(strlen(swizzle) >= 1 && strlen(swizzle) <= 4);
fParams.reset(tileXAndY, filterMode);
- fTexture.set(SkRef(texture), GrProgramResource::kRead_IOType);
+ fTexture.set(SkRef(texture), GrGpuResourceRef::kRead_IOType);
this->setSwizzle(swizzle);
}
void GrTextureAccess::reset(GrTexture* texture,
const GrTextureParams& params) {
SkASSERT(texture);
- fTexture.set(SkRef(texture), GrProgramResource::kRead_IOType);
+ fTexture.set(SkRef(texture), GrGpuResourceRef::kRead_IOType);
fParams = params;
memcpy(fSwizzle, "rgba", 5);
fSwizzleMask = kRGBA_GrColorComponentFlags;
@@ -75,7 +75,7 @@
GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
SkASSERT(texture);
- fTexture.set(SkRef(texture), GrProgramResource::kRead_IOType);
+ fTexture.set(SkRef(texture), GrGpuResourceRef::kRead_IOType);
fParams.reset(tileXAndY, filterMode);
memcpy(fSwizzle, "rgba", 5);
fSwizzleMask = kRGBA_GrColorComponentFlags;