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

Unified Diff: src/gpu/gl/GrGLTexture.cpp

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLTexture.cpp
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index aff91ebe223fb113ca5e986f45cb50e96b952494..44dbd7967e81a12a5bf209b4d49e42ee2b5680db 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -26,24 +26,33 @@ inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrG
}
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
-GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
- : GrSurface(gpu, idDesc.fLifeCycle, desc)
- , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), false) {
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
+ const IDDesc& idDesc)
+ : GrSurface(gpu, desc)
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) {
this->init(desc, idDesc);
- this->registerWithCache();
+ this->registerWithCache(budgeted);
}
-GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc,
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
+ const IDDesc& idDesc,
bool wasMipMapDataProvided)
- : GrSurface(gpu, idDesc.fLifeCycle, desc)
- , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), wasMipMapDataProvided) {
+ : GrSurface(gpu, desc)
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), wasMipMapDataProvided) {
+ this->init(desc, idDesc);
+ this->registerWithCache(budgeted);
+}
+
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, Wrapped, const GrSurfaceDesc& desc, const IDDesc& idDesc)
+ : GrSurface(gpu, desc)
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) {
this->init(desc, idDesc);
- this->registerWithCache();
+ this->registerWithCacheWrapped();
}
-GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, Derived)
- : GrSurface(gpu, idDesc.fLifeCycle, desc)
- , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), false) {
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
+ : GrSurface(gpu, desc)
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) {
this->init(desc, idDesc);
}
@@ -57,7 +66,7 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
void GrGLTexture::onRelease() {
if (fInfo.fID) {
- if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) {
+ if (GrBackendObjectLifeCycle::kBorrowed != fTextureIDLifecycle) {
if (this->desc().fTextureStorageAllocator.fDeallocateTextureStorage) {
this->desc().fTextureStorageAllocator.fDeallocateTextureStorage(
this->desc().fTextureStorageAllocator.fCtx,
@@ -92,3 +101,9 @@ void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture",
texture_id.c_str());
}
+
+GrGLTexture* GrGLTexture::CreateWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc,
+ const IDDesc& idDesc) {
+ return new GrGLTexture(gpu, kWrapped, desc, idDesc);
+}
+

Powered by Google App Engine
This is Rietveld 408576698