Vulkan: Make free part of DescriptorPool.

This also fixes a missed VkResult error. In order to do this
we also return an error from ProgramImpl::destroy.

Bug: angleproject:2396
Change-Id: I649b19e64732785bb33eebadea7f361245137d0f
Reviewed-on: https://chromium-review.googlesource.com/958406
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index 24578e9..5b2411d 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -154,13 +154,13 @@
 {
 }
 
-void ProgramVk::destroy(const gl::Context *contextImpl)
+gl::Error ProgramVk::destroy(const gl::Context *contextImpl)
 {
     ContextVk *contextVk = vk::GetImpl(contextImpl);
-    reset(contextVk);
+    return reset(contextVk);
 }
 
-void ProgramVk::reset(ContextVk *contextVk)
+vk::Error ProgramVk::reset(ContextVk *contextVk)
 {
     // TODO(jmadill): Handle re-linking a program that is in-use. http://anglebug.com/2397
 
@@ -184,12 +184,14 @@
     if (!mDescriptorSets.empty())
     {
         vk::DescriptorPool *descriptorPool = contextVk->getDescriptorPool();
-        vkFreeDescriptorSets(device, descriptorPool->getHandle(),
-                             static_cast<uint32_t>(mDescriptorSets.size()), mDescriptorSets.data());
+        ANGLE_TRY(descriptorPool->freeDescriptorSets(
+            device, static_cast<uint32_t>(mDescriptorSets.size()), mDescriptorSets.data()));
     }
     mDescriptorSets.clear();
     mUsedDescriptorSetRange.invalidate();
     mDirtyTextures       = false;
+
+    return vk::NoError();
 }
 
 gl::LinkResult ProgramVk::load(const gl::Context *contextImpl,
@@ -224,7 +226,7 @@
     GlslangWrapper *glslangWrapper = renderer->getGlslangWrapper();
     VkDevice device                = renderer->getDevice();
 
-    reset(contextVk);
+    ANGLE_TRY(reset(contextVk));
 
     std::vector<uint32_t> vertexCode;
     std::vector<uint32_t> fragmentCode;