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

Unified Diff: src/gpu/vk/GrVkGpu.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/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkIndexBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index eebb5898863d31fc8d6c298d99026077d3ec7487..4d0ecbf5ea14b096ff164e4d75438caf0f0b8fed 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -438,7 +438,7 @@ bool GrVkGpu::uploadTexData(GrVkTexture* tex,
}
////////////////////////////////////////////////////////////////////////////////
-GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle lifeCycle,
+GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
const SkTArray<GrMipLevel>& texels) {
bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
@@ -493,10 +493,10 @@ GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::Li
GrVkTexture* tex;
if (renderTarget) {
- tex = GrVkTextureRenderTarget::CreateNewTextureRenderTarget(this, desc, lifeCycle,
+ tex = GrVkTextureRenderTarget::CreateNewTextureRenderTarget(this, budgeted, desc,
imageDesc);
} else {
- tex = GrVkTexture::CreateNewTexture(this, desc, lifeCycle, imageDesc);
+ tex = GrVkTexture::CreateNewTexture(this, budgeted, desc, imageDesc);
}
if (!tex) {
@@ -548,10 +548,6 @@ GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
return nullptr;
}
- GrGpuResource::LifeCycle lifeCycle = (kAdopt_GrWrapOwnership == ownership)
- ? GrGpuResource::kAdopted_LifeCycle
- : GrGpuResource::kBorrowed_LifeCycle;
-
GrSurfaceDesc surfDesc;
// next line relies on GrBackendTextureDesc's flags matching GrTexture's
surfDesc.fFlags = (GrSurfaceFlags)desc.fFlags;
@@ -567,11 +563,10 @@ GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
GrVkTexture* texture = nullptr;
if (renderTarget) {
texture = GrVkTextureRenderTarget::CreateWrappedTextureRenderTarget(this, surfDesc,
- lifeCycle, format,
+ ownership, format,
info);
} else {
- texture = GrVkTexture::CreateWrappedTexture(this, surfDesc, lifeCycle, format,
- info);
+ texture = GrVkTexture::CreateWrappedTexture(this, surfDesc, ownership, format, info);
}
if (!texture) {
return nullptr;
@@ -590,10 +585,6 @@ GrRenderTarget* GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
return nullptr;
}
- GrGpuResource::LifeCycle lifeCycle = (kAdopt_GrWrapOwnership == ownership)
- ? GrGpuResource::kAdopted_LifeCycle
- : GrGpuResource::kBorrowed_LifeCycle;
-
GrSurfaceDesc desc;
desc.fConfig = wrapDesc.fConfig;
desc.fFlags = kCheckAllocation_GrSurfaceFlag;
@@ -604,7 +595,7 @@ GrRenderTarget* GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
desc.fOrigin = resolve_origin(wrapDesc.fOrigin);
GrVkRenderTarget* tgt = GrVkRenderTarget::CreateWrappedRenderTarget(this, desc,
- lifeCycle,
+ ownership,
info);
if (tgt && wrapDesc.fStencilBits) {
if (!createStencilAttachmentForRenderTarget(tgt, desc.fWidth, desc.fHeight)) {
@@ -652,7 +643,6 @@ GrStencilAttachment* GrVkGpu::createStencilAttachmentForRenderTarget(const GrRen
const GrVkCaps::StencilFormat& sFmt = this->vkCaps().preferedStencilFormat();
GrVkStencilAttachment* stencil(GrVkStencilAttachment::Create(this,
- GrGpuResource::kCached_LifeCycle,
width,
height,
samples,
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkIndexBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698