diff options
author | Ben Wagner <bungeman@google.com> | 2017-01-11 15:32:07 -0500 |
---|---|---|
committer | Ben Wagner <bungeman@google.com> | 2017-01-12 11:52:31 -0500 |
commit | eec27d51d2d8dae2ac54a11229b55cd1da4e84cf (patch) | |
tree | d9512b68c3fbd7a132187e11645d04272eff5acc /libs/hwui/renderthread/VulkanManager.cpp | |
parent | ba5124b48bff2455c089e803ea6ffcc197a26c51 (diff) |
Use FatVector instead of SkAutoMalloc in VulkanManager.
Skia is looking to make SkAutoMalloc private and will be moving it.
Using FatVector instead will make this code both less dependent on Skia
internals and more performant.
Test: refactoring CL. Existing unit tests still pass.
Change-Id: If9de10059775b75e1ab89078eacede2e20e91299
Diffstat (limited to 'libs/hwui/renderthread/VulkanManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/VulkanManager.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp index 2b9074499c2a..454ce4d9e8ff 100644 --- a/libs/hwui/renderthread/VulkanManager.cpp +++ b/libs/hwui/renderthread/VulkanManager.cpp @@ -20,6 +20,7 @@ #include "Properties.h" #include "RenderThread.h" #include "renderstate/RenderState.h" +#include "utils/FatVector.h" #include <GrContext.h> #include <GrTypes.h> @@ -381,10 +382,9 @@ bool VulkanManager::createSwapchain(VulkanSurface* surface) { return false; } - SkAutoMalloc surfaceFormatAlloc(surfaceFormatCount * sizeof(VkSurfaceFormatKHR)); - VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)surfaceFormatAlloc.get(); + FatVector<VkSurfaceFormatKHR, 4> surfaceFormats(surfaceFormatCount); res = mGetPhysicalDeviceSurfaceFormatsKHR(mBackendContext->fPhysicalDevice, surface->mVkSurface, - &surfaceFormatCount, surfaceFormats); + &surfaceFormatCount, surfaceFormats.data()); if (VK_SUCCESS != res) { return false; } @@ -396,10 +396,9 @@ bool VulkanManager::createSwapchain(VulkanSurface* surface) { return false; } - SkAutoMalloc presentModeAlloc(presentModeCount * sizeof(VkPresentModeKHR)); - VkPresentModeKHR* presentModes = (VkPresentModeKHR*)presentModeAlloc.get(); + FatVector<VkPresentModeKHR, VK_PRESENT_MODE_RANGE_SIZE_KHR> presentModes(presentModeCount); res = mGetPhysicalDeviceSurfacePresentModesKHR(mBackendContext->fPhysicalDevice, - surface->mVkSurface, &presentModeCount, presentModes); + surface->mVkSurface, &presentModeCount, presentModes.data()); if (VK_SUCCESS != res) { return false; } |