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

Unified Diff: src/gpu/vk/GrVkImage.cpp

Issue 2029763002: Create free list heap for suballocation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments; clean up debug code Created 4 years, 6 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/GrVkImage.h ('k') | src/gpu/vk/GrVkMemory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkImage.cpp
diff --git a/src/gpu/vk/GrVkImage.cpp b/src/gpu/vk/GrVkImage.cpp
index bbef1b40e8b136b1182a60d33e6009895d054980..70dd4486ae3dee89c1eb057d6ae4d8498cfb4875 100644
--- a/src/gpu/vk/GrVkImage.cpp
+++ b/src/gpu/vk/GrVkImage.cpp
@@ -64,9 +64,9 @@ bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr
VkImage image = 0;
GrVkAlloc alloc;
- VkImageLayout initialLayout = (VK_IMAGE_TILING_LINEAR == imageDesc.fImageTiling)
- ? VK_IMAGE_LAYOUT_PREINITIALIZED
- : VK_IMAGE_LAYOUT_UNDEFINED;
+ bool isLinear = VK_IMAGE_TILING_LINEAR == imageDesc.fImageTiling;
+ VkImageLayout initialLayout = isLinear ? VK_IMAGE_LAYOUT_PREINITIALIZED
+ : VK_IMAGE_LAYOUT_UNDEFINED;
// Create Image
VkSampleCountFlagBits vkSamples;
@@ -102,7 +102,7 @@ bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr
GR_VK_CALL_ERRCHECK(gpu->vkInterface(), CreateImage(gpu->device(), &imageCreateInfo, nullptr,
&image));
- if (!GrVkMemory::AllocAndBindImageMemory(gpu, image, imageDesc.fMemProps, &alloc)) {
+ if (!GrVkMemory::AllocAndBindImageMemory(gpu, image, isLinear, &alloc)) {
VK_CALL(gpu, DestroyImage(gpu->device(), image, nullptr));
return false;
}
@@ -118,11 +118,12 @@ bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr
void GrVkImage::DestroyImageInfo(const GrVkGpu* gpu, GrVkImageInfo* info) {
VK_CALL(gpu, DestroyImage(gpu->device(), info->fImage, nullptr));
- GrVkMemory::FreeImageMemory(gpu, info->fAlloc);
+ bool isLinear = VK_IMAGE_TILING_LINEAR == info->fImageTiling;
+ GrVkMemory::FreeImageMemory(gpu, isLinear, info->fAlloc);
}
-void GrVkImage::setNewResource(VkImage image, const GrVkAlloc& alloc) {
- fResource = new Resource(image, alloc);
+void GrVkImage::setNewResource(VkImage image, const GrVkAlloc& alloc, VkImageTiling tiling) {
+ fResource = new Resource(image, alloc, tiling);
}
GrVkImage::~GrVkImage() {
@@ -146,7 +147,8 @@ void GrVkImage::abandonImage() {
void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const {
VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr));
- GrVkMemory::FreeImageMemory(gpu, fAlloc);
+ bool isLinear = (VK_IMAGE_TILING_LINEAR == fImageTiling);
+ GrVkMemory::FreeImageMemory(gpu, isLinear, fAlloc);
}
void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const {
« no previous file with comments | « src/gpu/vk/GrVkImage.h ('k') | src/gpu/vk/GrVkMemory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698