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

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: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error 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
« no previous file with comments | « src/gpu/gl/GrGLTexture.h ('k') | src/gpu/gl/GrGLTextureRenderTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLTexture.cpp
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index ea02274ad72ad046295c78e70ba1effbcafcbdee..6c8f901e3f1ebccc71f10dc79845303f6037ab71 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);
}
@@ -52,12 +61,12 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
fTexParams.invalidate();
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
fInfo = idDesc.fInfo;
- fTextureIDLifecycle = idDesc.fLifeCycle;
+ fTextureIDOwnership = idDesc.fOwnership;
}
void GrGLTexture::onRelease() {
if (fInfo.fID) {
- if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) {
+ if (GrBackendObjectOwnership::kBorrowed != fTextureIDOwnership) {
GL_CALL(DeleteTextures(1, &fInfo.fID));
}
fInfo.fID = 0;
@@ -86,3 +95,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);
+}
+
« no previous file with comments | « src/gpu/gl/GrGLTexture.h ('k') | src/gpu/gl/GrGLTextureRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698