Rename allocation functions
vk::allocate() -> vk::allocateHostMemory()
vk::deallocate() -> vk::freeHostMemory()
sw::deallocate() -> sw::freeMemory()
Vulkan has vkAllocateMemory() and vkFreeMemory(), so cases of
"deallocate" have been replace by "free". To avoid confusion and
potential bugs due to overlap with ::free(), host memory allocations
are now also more explicitly named, which is symmetrical with
vk::allocateDeviceMemory().
Bug: b/134584057
Change-Id: Ia997bde6e1117b05f985be9211f956ea0601d09b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/57888
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp
index 2402337..02812fa 100644
--- a/src/Device/Renderer.cpp
+++ b/src/Device/Renderer.cpp
@@ -148,13 +148,13 @@
{
// TODO(b/140991626): Use allocateZeroOrPoison() instead of allocateZero() to detect MemorySanitizer errors.
// TODO(b/140991626): Use allocateUninitialized() instead of allocateZeroOrPoison() to improve startup peformance.
- data = (DrawData *)allocateZero(sizeof(DrawData));
+ data = (DrawData *)sw::allocateZero(sizeof(DrawData));
data->constants = &Constants::Get();
}
DrawCall::~DrawCall()
{
- deallocate(data);
+ sw::freeMemory(data);
}
Renderer::Renderer(vk::Device *device)
@@ -174,12 +174,12 @@
void *Renderer::operator new(size_t size)
{
ASSERT(size == sizeof(Renderer)); // This operator can't be called from a derived class
- return vk::allocate(sizeof(Renderer), alignof(Renderer), vk::NULL_ALLOCATION_CALLBACKS, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
+ return vk::allocateHostMemory(sizeof(Renderer), alignof(Renderer), vk::NULL_ALLOCATION_CALLBACKS, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
}
void Renderer::operator delete(void *mem)
{
- vk::deallocate(mem, vk::NULL_ALLOCATION_CALLBACKS);
+ vk::freeHostMemory(mem, vk::NULL_ALLOCATION_CALLBACKS);
}
void Renderer::draw(const vk::GraphicsPipeline *pipeline, const vk::DynamicState &dynamicState, unsigned int count, int baseVertex,
diff --git a/src/System/Memory.cpp b/src/System/Memory.cpp
index 0c6c52b..0333afb 100644
--- a/src/System/Memory.cpp
+++ b/src/System/Memory.cpp
@@ -116,7 +116,7 @@
return allocate(bytes, alignment, !__has_feature(memory_sanitizer));
}
-void deallocate(void *memory)
+void freeMemory(void *memory)
{
if(memory)
{
diff --git a/src/System/Memory.hpp b/src/System/Memory.hpp
index 53c2409..9a12a4f 100644
--- a/src/System/Memory.hpp
+++ b/src/System/Memory.hpp
@@ -26,7 +26,7 @@
void *allocateZero(size_t bytes, size_t alignment = 16); // Always initialized to zero.
void *allocateZeroOrPoison(size_t bytes, size_t alignment = 16); // Initialized to zero, except in MemorySanitizer builds.
-void deallocate(void *memory);
+void freeMemory(void *memory);
void clear(uint16_t *memory, uint16_t element, size_t count);
void clear(uint32_t *memory, uint32_t element, size_t count);
diff --git a/src/Vulkan/VkBuffer.cpp b/src/Vulkan/VkBuffer.cpp
index f913942..4602ebe 100644
--- a/src/Vulkan/VkBuffer.cpp
+++ b/src/Vulkan/VkBuffer.cpp
@@ -48,7 +48,7 @@
void Buffer::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(queueFamilyIndices, pAllocator);
+ vk::freeHostMemory(queueFamilyIndices, pAllocator);
}
size_t Buffer::ComputeRequiredAllocationSize(const VkBufferCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkCommandPool.cpp b/src/Vulkan/VkCommandPool.cpp
index e747df0..57c799b 100644
--- a/src/Vulkan/VkCommandPool.cpp
+++ b/src/Vulkan/VkCommandPool.cpp
@@ -13,8 +13,10 @@
// limitations under the License.
#include "VkCommandPool.hpp"
+
#include "VkCommandBuffer.hpp"
#include "VkDestroy.hpp"
+
#include <algorithm>
#include <new>
@@ -43,8 +45,8 @@
for(uint32_t i = 0; i < commandBufferCount; i++)
{
// TODO(b/119409619): Allocate command buffers from the pool memory.
- void *deviceMemory = vk::allocate(sizeof(DispatchableCommandBuffer), REQUIRED_MEMORY_ALIGNMENT,
- NULL_ALLOCATION_CALLBACKS, DispatchableCommandBuffer::GetAllocationScope());
+ void *deviceMemory = vk::allocateHostMemory(sizeof(DispatchableCommandBuffer), REQUIRED_MEMORY_ALIGNMENT,
+ NULL_ALLOCATION_CALLBACKS, DispatchableCommandBuffer::GetAllocationScope());
ASSERT(deviceMemory);
DispatchableCommandBuffer *commandBuffer = new(deviceMemory) DispatchableCommandBuffer(device, level);
if(commandBuffer)
diff --git a/src/Vulkan/VkDescriptorPool.cpp b/src/Vulkan/VkDescriptorPool.cpp
index eaa96b1..5e7e699 100644
--- a/src/Vulkan/VkDescriptorPool.cpp
+++ b/src/Vulkan/VkDescriptorPool.cpp
@@ -39,7 +39,7 @@
void DescriptorPool::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(pool, pAllocator);
+ vk::freeHostMemory(pool, pAllocator);
}
size_t DescriptorPool::ComputeRequiredAllocationSize(const VkDescriptorPoolCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkDescriptorSetLayout.cpp b/src/Vulkan/VkDescriptorSetLayout.cpp
index 7a1079f..63a8a90 100644
--- a/src/Vulkan/VkDescriptorSetLayout.cpp
+++ b/src/Vulkan/VkDescriptorSetLayout.cpp
@@ -90,7 +90,7 @@
void DescriptorSetLayout::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(bindings, pAllocator); // This allocation also contains pImmutableSamplers
+ vk::freeHostMemory(bindings, pAllocator); // This allocation also contains pImmutableSamplers
}
size_t DescriptorSetLayout::ComputeRequiredAllocationSize(const VkDescriptorSetLayoutCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkDestroy.hpp b/src/Vulkan/VkDestroy.hpp
index 272ca14..17516b8 100644
--- a/src/Vulkan/VkDestroy.hpp
+++ b/src/Vulkan/VkDestroy.hpp
@@ -62,7 +62,7 @@
// object may not point to the same pointer as vkObject, for dispatchable objects,
// for example, so make sure to deallocate based on the vkObject pointer, which
// should always point to the beginning of the allocated memory
- vk::deallocate(vkObject, pAllocator);
+ vk::freeHostMemory(vkObject, pAllocator);
}
}
@@ -79,7 +79,7 @@
// object may not point to the same pointer as vkObject, for dispatchable objects,
// for example, so make sure to deallocate based on the vkObject pointer, which
// should always point to the beginning of the allocated memory
- vk::deallocate(vkObject, pAllocator);
+ vk::freeHostMemory(vkObject, pAllocator);
}
}
}
diff --git a/src/Vulkan/VkDevice.cpp b/src/Vulkan/VkDevice.cpp
index 4a742cf..80caad3 100644
--- a/src/Vulkan/VkDevice.cpp
+++ b/src/Vulkan/VkDevice.cpp
@@ -193,7 +193,7 @@
queues[i].~Queue();
}
- vk::deallocate(queues, pAllocator);
+ vk::freeHostMemory(queues, pAllocator);
}
size_t Device::ComputeRequiredAllocationSize(const VkDeviceCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkDeviceMemory.cpp b/src/Vulkan/VkDeviceMemory.cpp
index de386dd..871fec7 100644
--- a/src/Vulkan/VkDeviceMemory.cpp
+++ b/src/Vulkan/VkDeviceMemory.cpp
@@ -18,6 +18,7 @@
#include "VkConfig.hpp"
#include "VkDevice.hpp"
#include "VkImage.hpp"
+#include "VkMemory.hpp"
#include "VkStringify.hpp"
// Host-allocated memory and host-mapped foreign memory
@@ -387,7 +388,7 @@
// Deallocate previously allocated memory at |buffer|.
void DeviceMemory::deallocate(void *buffer, size_t size)
{
- vk::deallocateDeviceMemory(buffer);
+ vk::freeDeviceMemory(buffer);
buffer = nullptr;
}
diff --git a/src/Vulkan/VkFramebuffer.cpp b/src/Vulkan/VkFramebuffer.cpp
index 2f75d7c..a1b7ec3 100644
--- a/src/Vulkan/VkFramebuffer.cpp
+++ b/src/Vulkan/VkFramebuffer.cpp
@@ -66,7 +66,7 @@
void Framebuffer::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(attachments, pAllocator);
+ vk::freeHostMemory(attachments, pAllocator);
}
void Framebuffer::executeLoadOp(const RenderPass *renderPass, uint32_t clearValueCount, const VkClearValue *pClearValues, const VkRect2D &renderArea)
diff --git a/src/Vulkan/VkImage.cpp b/src/Vulkan/VkImage.cpp
index c45e52e..9dad47b 100644
--- a/src/Vulkan/VkImage.cpp
+++ b/src/Vulkan/VkImage.cpp
@@ -197,7 +197,7 @@
{
if(decompressedImage)
{
- vk::deallocate(decompressedImage, pAllocator);
+ vk::freeHostMemory(decompressedImage, pAllocator);
}
}
diff --git a/src/Vulkan/VkMemory.cpp b/src/Vulkan/VkMemory.cpp
index 2b8518e..74de72c 100644
--- a/src/Vulkan/VkMemory.cpp
+++ b/src/Vulkan/VkMemory.cpp
@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef VK_OBJECT_HPP_
-#define VK_OBJECT_HPP_
-
#include "VkMemory.hpp"
#include "VkConfig.hpp"
@@ -22,31 +19,29 @@
namespace vk {
-void *allocateDeviceMemory(size_t count, size_t alignment)
+void *allocateDeviceMemory(size_t bytes, size_t alignment)
{
// TODO(b/140991626): Use allocateZeroOrPoison() instead of allocateZero() to detect MemorySanitizer errors.
// TODO(b/140991626): Use allocateUninitialized() instead of allocateZeroOrPoison() to improve startup peformance.
- return sw::allocateZero(count, alignment);
+ return sw::allocateZero(bytes, alignment);
}
-void deallocateDeviceMemory(void *ptr)
+void freeDeviceMemory(void *ptr)
{
- sw::deallocate(ptr);
+ sw::freeMemory(ptr);
}
-void *allocate(size_t count, size_t alignment, const VkAllocationCallbacks *pAllocator, VkSystemAllocationScope allocationScope)
+void *allocateHostMemory(size_t bytes, size_t alignment, const VkAllocationCallbacks *pAllocator, VkSystemAllocationScope allocationScope)
{
// TODO(b/140991626): Use allocateZeroOrPoison() instead of allocateZero() to detect MemorySanitizer errors.
// TODO(b/140991626): Use allocateUninitialized() instead of allocateZeroOrPoison() to improve startup peformance.
- return pAllocator ? pAllocator->pfnAllocation(pAllocator->pUserData, count, alignment, allocationScope)
- : sw::allocateZero(count, alignment);
+ return pAllocator ? pAllocator->pfnAllocation(pAllocator->pUserData, bytes, alignment, allocationScope)
+ : sw::allocateZero(bytes, alignment);
}
-void deallocate(void *ptr, const VkAllocationCallbacks *pAllocator)
+void freeHostMemory(void *ptr, const VkAllocationCallbacks *pAllocator)
{
- pAllocator ? pAllocator->pfnFree(pAllocator->pUserData, ptr) : sw::deallocate(ptr);
+ pAllocator ? pAllocator->pfnFree(pAllocator->pUserData, ptr) : sw::freeMemory(ptr);
}
} // namespace vk
-
-#endif // VK_OBJECT_HPP_
diff --git a/src/Vulkan/VkMemory.hpp b/src/Vulkan/VkMemory.hpp
index 91d0ae3..990df7d 100644
--- a/src/Vulkan/VkMemory.hpp
+++ b/src/Vulkan/VkMemory.hpp
@@ -22,20 +22,20 @@
// TODO(b/192449828): Pass VkDeviceDeviceMemoryReportCreateInfoEXT into these functions to
// centralize device memory report callback usage.
void *allocateDeviceMemory(size_t bytes, size_t alignment);
-void deallocateDeviceMemory(void *ptr);
+void freeDeviceMemory(void *ptr);
// TODO(b/201798871): Fix host allocation callback usage. Uses of this symbolic constant indicate
// places where we should use an allocator instead of unaccounted memory allocations.
constexpr VkAllocationCallbacks *NULL_ALLOCATION_CALLBACKS = nullptr;
-void *allocate(size_t bytes, size_t alignment, const VkAllocationCallbacks *pAllocator,
- VkSystemAllocationScope allocationScope);
-void deallocate(void *ptr, const VkAllocationCallbacks *pAllocator);
+void *allocateHostMemory(size_t bytes, size_t alignment, const VkAllocationCallbacks *pAllocator,
+ VkSystemAllocationScope allocationScope);
+void freeHostMemory(void *ptr, const VkAllocationCallbacks *pAllocator);
template<typename T>
-T *allocate(size_t bytes, const VkAllocationCallbacks *pAllocator)
+T *allocateHostmemory(size_t bytes, const VkAllocationCallbacks *pAllocator)
{
- return static_cast<T *>(allocate(bytes, alignof(T), pAllocator, T::GetAllocationScope()));
+ return static_cast<T *>(allocateHostMemory(bytes, alignof(T), pAllocator, T::GetAllocationScope()));
}
} // namespace vk
diff --git a/src/Vulkan/VkObject.hpp b/src/Vulkan/VkObject.hpp
index 5019387..ab00949 100644
--- a/src/Vulkan/VkObject.hpp
+++ b/src/Vulkan/VkObject.hpp
@@ -17,7 +17,6 @@
#include "VkConfig.hpp"
#include "VkMemory.hpp"
-
#include "System/Debug.hpp"
#include <vulkan/vk_icd.h>
@@ -49,17 +48,17 @@
void *memory = nullptr;
if(size)
{
- memory = vk::allocate(size, REQUIRED_MEMORY_ALIGNMENT, pAllocator, T::GetAllocationScope());
+ memory = vk::allocateHostMemory(size, REQUIRED_MEMORY_ALIGNMENT, pAllocator, T::GetAllocationScope());
if(!memory)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
- void *objectMemory = vk::allocate(sizeof(T), alignof(T), pAllocator, T::GetAllocationScope());
+ void *objectMemory = vk::allocateHostMemory(sizeof(T), alignof(T), pAllocator, T::GetAllocationScope());
if(!objectMemory)
{
- vk::deallocate(memory, pAllocator);
+ vk::freeHostMemory(memory, pAllocator);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@@ -67,7 +66,7 @@
if(!object)
{
- vk::deallocate(memory, pAllocator);
+ vk::freeHostMemory(memory, pAllocator);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
diff --git a/src/Vulkan/VkPipelineCache.cpp b/src/Vulkan/VkPipelineCache.cpp
index 06de756..c4e9c31 100644
--- a/src/Vulkan/VkPipelineCache.cpp
+++ b/src/Vulkan/VkPipelineCache.cpp
@@ -83,7 +83,7 @@
void PipelineCache::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(data, pAllocator);
+ vk::freeHostMemory(data, pAllocator);
}
size_t PipelineCache::ComputeRequiredAllocationSize(const VkPipelineCacheCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkPipelineLayout.cpp b/src/Vulkan/VkPipelineLayout.cpp
index 4d12cc5..e89cb75 100644
--- a/src/Vulkan/VkPipelineLayout.cpp
+++ b/src/Vulkan/VkPipelineLayout.cpp
@@ -62,14 +62,14 @@
void PipelineLayout::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(descriptorSets[0].bindings, pAllocator); // pushConstantRanges are in the same allocation
+ vk::freeHostMemory(descriptorSets[0].bindings, pAllocator); // pushConstantRanges are in the same allocation
}
bool PipelineLayout::release(const VkAllocationCallbacks *pAllocator)
{
if(decRefCount() == 0)
{
- vk::deallocate(descriptorSets[0].bindings, pAllocator); // pushConstantRanges are in the same allocation
+ vk::freeHostMemory(descriptorSets[0].bindings, pAllocator); // pushConstantRanges are in the same allocation
return true;
}
return false;
diff --git a/src/Vulkan/VkQueryPool.cpp b/src/Vulkan/VkQueryPool.cpp
index 912afb7..b532ae8 100644
--- a/src/Vulkan/VkQueryPool.cpp
+++ b/src/Vulkan/VkQueryPool.cpp
@@ -110,7 +110,7 @@
pool[i].~Query();
}
- vk::deallocate(pool, pAllocator);
+ vk::freeHostMemory(pool, pAllocator);
}
size_t QueryPool::ComputeRequiredAllocationSize(const VkQueryPoolCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkQueue.cpp b/src/Vulkan/VkQueue.cpp
index 6b3ceb1..57d2bdb 100644
--- a/src/Vulkan/VkQueue.cpp
+++ b/src/Vulkan/VkQueue.cpp
@@ -13,6 +13,7 @@
// limitations under the License.
#include "VkQueue.hpp"
+
#include "VkCommandBuffer.hpp"
#include "VkFence.hpp"
#include "VkSemaphore.hpp"
@@ -62,7 +63,7 @@
}
uint8_t *mem = static_cast<uint8_t *>(
- vk::allocate(totalSize, vk::REQUIRED_MEMORY_ALIGNMENT, vk::NULL_ALLOCATION_CALLBACKS, vk::Fence::GetAllocationScope()));
+ vk::allocateHostMemory(totalSize, vk::REQUIRED_MEMORY_ALIGNMENT, vk::NULL_ALLOCATION_CALLBACKS, vk::Fence::GetAllocationScope()));
auto submits = new(mem) VkSubmitInfo[submitCount];
memcpy(mem, pSubmits, submitSize);
@@ -303,7 +304,7 @@
{
auto v = toDelete.tryTake();
if(!v.second) { break; }
- vk::deallocate(v.first, NULL_ALLOCATION_CALLBACKS);
+ vk::freeHostMemory(v.first, NULL_ALLOCATION_CALLBACKS);
}
}
diff --git a/src/Vulkan/VkRenderPass.cpp b/src/Vulkan/VkRenderPass.cpp
index d2836c3..750c89a 100644
--- a/src/Vulkan/VkRenderPass.cpp
+++ b/src/Vulkan/VkRenderPass.cpp
@@ -364,7 +364,7 @@
void RenderPass::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(subpasses, pAllocator); // attachments and dependencies are in the same allocation
+ vk::freeHostMemory(subpasses, pAllocator); // attachments and dependencies are in the same allocation
}
size_t RenderPass::ComputeRequiredAllocationSize(const VkRenderPassCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkSemaphore.cpp b/src/Vulkan/VkSemaphore.cpp
index 872f285..bb61a3d 100644
--- a/src/Vulkan/VkSemaphore.cpp
+++ b/src/Vulkan/VkSemaphore.cpp
@@ -224,7 +224,7 @@
BinarySemaphore::External *BinarySemaphore::allocateExternal()
{
auto *ext = reinterpret_cast<BinarySemaphore::External *>(
- vk::allocate(sizeof(EXTERNAL), alignof(EXTERNAL), allocator, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
+ vk::allocateHostMemory(sizeof(EXTERNAL), alignof(EXTERNAL), allocator, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
new(ext) EXTERNAL();
return ext;
}
@@ -232,7 +232,7 @@
void BinarySemaphore::deallocateExternal(BinarySemaphore::External *ext)
{
ext->~External();
- vk::deallocate(ext, allocator);
+ vk::freeHostMemory(ext, allocator);
}
template<typename ALLOC_FUNC, typename IMPORT_FUNC>
diff --git a/src/Vulkan/VkShaderModule.cpp b/src/Vulkan/VkShaderModule.cpp
index e90b360..a49f824 100644
--- a/src/Vulkan/VkShaderModule.cpp
+++ b/src/Vulkan/VkShaderModule.cpp
@@ -41,7 +41,7 @@
void ShaderModule::destroy(const VkAllocationCallbacks *pAllocator)
{
- vk::deallocate(code, pAllocator);
+ vk::freeHostMemory(code, pAllocator);
}
size_t ShaderModule::ComputeRequiredAllocationSize(const VkShaderModuleCreateInfo *pCreateInfo)
diff --git a/src/Vulkan/VkSpecializationInfo.cpp b/src/Vulkan/VkSpecializationInfo.cpp
index dd56b17..ff8cf8b 100644
--- a/src/Vulkan/VkSpecializationInfo.cpp
+++ b/src/Vulkan/VkSpecializationInfo.cpp
@@ -44,8 +44,8 @@
SpecializationInfo::~SpecializationInfo()
{
- sw::deallocate(const_cast<VkSpecializationMapEntry *>(info.pMapEntries));
- sw::deallocate(const_cast<void *>(info.pData));
+ sw::freeMemory(const_cast<VkSpecializationMapEntry *>(info.pMapEntries));
+ sw::freeMemory(const_cast<void *>(info.pData));
}
bool SpecializationInfo::operator<(const SpecializationInfo &rhs) const
diff --git a/src/WSI/MetalSurface.mm b/src/WSI/MetalSurface.mm
index 82e4f87..563618c 100644
--- a/src/WSI/MetalSurface.mm
+++ b/src/WSI/MetalSurface.mm
@@ -136,7 +136,7 @@
metalLayer->release();
}
- vk::deallocate(metalLayer, pAllocator);
+ vk::freeHostMemory(metalLayer, pAllocator);
}
size_t MetalSurface::ComputeRequiredAllocationSize(const void *pCreateInfo) API_AVAILABLE(macosx(10.11))
diff --git a/src/WSI/VkSurfaceKHR.cpp b/src/WSI/VkSurfaceKHR.cpp
index 3e0745c..822dbf2 100644
--- a/src/WSI/VkSurfaceKHR.cpp
+++ b/src/WSI/VkSurfaceKHR.cpp
@@ -39,7 +39,7 @@
namespace vk {
-VkResult PresentImage::allocateImage(VkDevice device, const VkImageCreateInfo &createInfo)
+VkResult PresentImage::createImage(VkDevice device, const VkImageCreateInfo &createInfo)
{
VkImage image;
VkResult status = vkCreateImage(device, &createInfo, nullptr, &image);
@@ -71,7 +71,7 @@
return VK_SUCCESS;
}
-void PresentImage::clear()
+void PresentImage::release()
{
if(imageMemory)
{
diff --git a/src/WSI/VkSurfaceKHR.hpp b/src/WSI/VkSurfaceKHR.hpp
index 8508455..cb788d0 100644
--- a/src/WSI/VkSurfaceKHR.hpp
+++ b/src/WSI/VkSurfaceKHR.hpp
@@ -38,9 +38,9 @@
class PresentImage
{
public:
- VkResult allocateImage(VkDevice device, const VkImageCreateInfo &createInfo);
+ VkResult createImage(VkDevice device, const VkImageCreateInfo &createInfo);
VkResult allocateAndBindImageMemory(VkDevice device, const VkMemoryAllocateInfo &allocateInfo);
- void clear();
+ void release();
VkImage asVkImage() const;
const Image *getImage() const { return image; }
diff --git a/src/WSI/VkSwapchainKHR.cpp b/src/WSI/VkSwapchainKHR.cpp
index 57d9cdd..423ce50 100644
--- a/src/WSI/VkSwapchainKHR.cpp
+++ b/src/WSI/VkSwapchainKHR.cpp
@@ -41,7 +41,7 @@
if(currentImage.exists())
{
surface->detachImage(¤tImage);
- currentImage.clear();
+ currentImage.release();
}
}
@@ -50,7 +50,7 @@
surface->disassociateSwapchain();
}
- vk::deallocate(images, pAllocator);
+ vk::freeHostMemory(images, pAllocator);
}
size_t SwapchainKHR::ComputeRequiredAllocationSize(const VkSwapchainCreateInfoKHR *pCreateInfo)
@@ -71,7 +71,7 @@
if(currentImage.isAvailable())
{
surface->detachImage(¤tImage);
- currentImage.clear();
+ currentImage.release();
}
}
}
@@ -81,7 +81,7 @@
{
for(uint32_t i = 0; i < imageCount; i++)
{
- images[i].clear();
+ images[i].release();
}
}
@@ -127,7 +127,7 @@
{
PresentImage ¤tImage = images[i];
- status = currentImage.allocateImage(device, imageInfo);
+ status = currentImage.createImage(device, imageInfo);
if(status != VK_SUCCESS)
{
return status;
@@ -207,7 +207,7 @@
if(retired)
{
surface->detachImage(&image);
- image.clear();
+ image.release();
}
return result;