From 82712282891fae6fba3c0fc8e41750e1d77d997e Mon Sep 17 00:00:00 2001 From: Yusuf Khan Date: Tue, 23 Aug 2022 09:28:39 -0500 Subject: [PATCH] nvk: implement GetDeviceMemoryCommitment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vulkan spec says: If the memory object is allocated from a heap with the VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT bit set, that object’s backing memory may be provided by the implementation lazily. The actual committed size of the memory may initially be as small as zero (or as large as the requested size), and monotonically increases as additional memory is needed. As far as I can tell we ignore the bit meaning that we allocate the requested size so return that as the size. Signed-off-by: Yusuf Khan Part-of: --- src/nouveau/vulkan/nvk_device_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nouveau/vulkan/nvk_device_memory.c b/src/nouveau/vulkan/nvk_device_memory.c index b9eceda7b6e..40869e5fea1 100644 --- a/src/nouveau/vulkan/nvk_device_memory.c +++ b/src/nouveau/vulkan/nvk_device_memory.c @@ -276,3 +276,13 @@ nvk_InvalidateMappedMemoryRanges( { return VK_SUCCESS; } + +VKAPI_ATTR void VKAPI_CALL nvk_GetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory _mem, + VkDeviceSize* pCommittedMemoryInBytes) +{ + VK_FROM_HANDLE(nvk_device_memory, mem, _mem); + + *pCommittedMemoryInBytes = mem->bo->size; +}