Properly recycle uniform buffers in vulkan
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2195713002
Review-Url: https://codereview.chromium.org/2195713002
diff --git a/src/gpu/vk/GrVkBuffer.h b/src/gpu/vk/GrVkBuffer.h
index b400e09..bb529b3 100644
--- a/src/gpu/vk/GrVkBuffer.h
+++ b/src/gpu/vk/GrVkBuffer.h
@@ -25,11 +25,11 @@
SkASSERT(!fResource);
}
- VkBuffer buffer() const { return fResource->fBuffer; }
- const GrVkAlloc& alloc() const { return fResource->fAlloc; }
- const GrVkResource* resource() const { return fResource; }
- size_t size() const { return fDesc.fSizeInBytes; }
- VkDeviceSize offset() const { return fOffset; }
+ VkBuffer buffer() const { return fResource->fBuffer; }
+ const GrVkAlloc& alloc() const { return fResource->fAlloc; }
+ const GrVkRecycledResource* resource() const { return fResource; }
+ size_t size() const { return fDesc.fSizeInBytes; }
+ VkDeviceSize offset() const { return fOffset; }
void addMemoryBarrier(const GrVkGpu* gpu,
VkAccessFlags srcAccessMask,
@@ -94,6 +94,11 @@
void vkRelease(const GrVkGpu* gpu);
private:
+ virtual const Resource* createResource(GrVkGpu* gpu,
+ const Desc& descriptor) {
+ return Create(gpu, descriptor);
+ }
+
void validate() const;
bool vkIsMapped() const;