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

Unified Diff: src/gpu/vk/GrVkBuffer.h

Issue 2344323002: Refactor vulkan buffer mapping and unmapping (Closed)
Patch Set: inner->internal Created 4 years, 3 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 | « no previous file | src/gpu/vk/GrVkBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkBuffer.h
diff --git a/src/gpu/vk/GrVkBuffer.h b/src/gpu/vk/GrVkBuffer.h
index 473a837646efcb6a5ebcabdd2224d76ab26244e9..e58d5e40ff1bd6df21d3acff5de20fe7d52ab5df 100644
--- a/src/gpu/vk/GrVkBuffer.h
+++ b/src/gpu/vk/GrVkBuffer.h
@@ -23,6 +23,7 @@ public:
virtual ~GrVkBuffer() {
// either release or abandon should have been called by the owner of this object.
SkASSERT(!fResource);
+ delete [] (unsigned char*)fMapPtr;
}
VkBuffer buffer() const { return fResource->fBuffer; }
@@ -83,8 +84,12 @@ protected:
: fDesc(desc), fResource(resource), fOffset(0), fMapPtr(nullptr) {
}
- void* vkMap(const GrVkGpu* gpu);
- void vkUnmap(GrVkGpu* gpu);
+ void* vkMap(GrVkGpu* gpu) {
+ this->internalMap(gpu, fDesc.fSizeInBytes);
+ return fMapPtr;
+ }
+ void vkUnmap(GrVkGpu* gpu) { this->internalUnmap(gpu, this->size()); }
+
// If the caller passes in a non null createdNewBuffer, this function will set the bool to true
// if it creates a new VkBuffer to upload the data to.
bool vkUpdateData(GrVkGpu* gpu, const void* src, size_t srcSizeInBytes,
@@ -99,6 +104,9 @@ private:
return Create(gpu, descriptor);
}
+ void internalMap(GrVkGpu* gpu, size_t size, bool* createdNewBuffer = nullptr);
+ void internalUnmap(GrVkGpu* gpu, size_t size);
+
void validate() const;
bool vkIsMapped() const;
« no previous file with comments | « no previous file | src/gpu/vk/GrVkBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698