Setup system in Vulkan to reuse VkDescriptorSet allocations.
This CL uses the new system for uniform buffers. In a follow up CL I will
add support for samplers.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2163673002
Review-Url: https://codereview.chromium.org/2163673002
diff --git a/src/gpu/vk/GrVkResource.h b/src/gpu/vk/GrVkResource.h
index 190ee36..fde3e37 100644
--- a/src/gpu/vk/GrVkResource.h
+++ b/src/gpu/vk/GrVkResource.h
@@ -195,13 +195,14 @@
class GrVkRecycledResource : public GrVkResource {
public:
// When recycle is called and there is only one ref left on the resource, we will signal that
- // the resource can be recycled for reuse. This function will always unref the object. Thus
- // if the object is recycled it should be ref'd inside the onRecycle call.
+ // the resource can be recycled for reuse. If the sublass (or whoever is managing this resource)
+ // decides not to recycle the objects, it is their responsibility to call unref on the object.
void recycle(GrVkGpu* gpu) const {
if (this->unique()) {
this->onRecycle(gpu);
+ } else {
+ this->unref(gpu);
}
- this->unref(gpu);
}
private: