diff options
| author | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-07-09 21:57:28 -0600 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-07-17 10:05:19 -0600 |
| commit | 9e016efe62abd37bb16febfde7f5bdc505a4a1e4 (patch) | |
| tree | 527e5fe50bee5ef2349a54cac007f2f235c36d05 | |
| parent | 194bf287e512a5ec9b85f1a821f88589d1ba5f71 (diff) | |
| download | usermoji-9e016efe62abd37bb16febfde7f5bdc505a4a1e4.tar.xz | |
bug-14184: Transient memory allocations
| -rw-r--r-- | icd/nulldrv/nulldrv.c | 8 | ||||
| -rw-r--r-- | include/vk_layer.h | 1 | ||||
| -rw-r--r-- | include/vulkan.h | 8 | ||||
| -rw-r--r-- | layers/param_checker.cpp | 10 | ||||
| -rw-r--r-- | loader/table_ops.h | 3 | ||||
| -rw-r--r-- | loader/trampoline.c | 9 | ||||
| -rwxr-xr-x | vulkan.py | 5 |
7 files changed, 44 insertions, 0 deletions
diff --git a/icd/nulldrv/nulldrv.c b/icd/nulldrv/nulldrv.c index eb35263f..4b6b2230 100644 --- a/icd/nulldrv/nulldrv.c +++ b/icd/nulldrv/nulldrv.c @@ -1637,6 +1637,14 @@ ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges( return VK_SUCCESS; } +ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes) +{ + return VK_SUCCESS; +} + ICD_EXPORT VkResult VKAPI vkCreateInstance( const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance) diff --git a/include/vk_layer.h b/include/vk_layer.h index 0881d24f..6d1945bf 100644 --- a/include/vk_layer.h +++ b/include/vk_layer.h @@ -41,6 +41,7 @@ typedef struct VkLayerDispatchTable_ PFN_vkUnmapMemory UnmapMemory; PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges; PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges; + PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment; PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements; PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements; PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements; diff --git a/include/vulkan.h b/include/vulkan.h index 78b0152c..62049412 100644 --- a/include/vulkan.h +++ b/include/vulkan.h @@ -876,6 +876,7 @@ typedef enum VkMemoryPropertyFlagBits_ // vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache VK_MEMORY_PROPERTY_HOST_UNCACHED_BIT = VK_BIT(2), // Memory should not be cached by the host VK_MEMORY_PROPERTY_HOST_WRITE_COMBINED_BIT = VK_BIT(3), // Memory should support host write combining + VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, // Memory may be allocated by the driver when it is required } VkMemoryPropertyFlagBits; // Memory output flags passed to resource transition commands @@ -2286,6 +2287,7 @@ typedef VkResult (VKAPI *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory mem, V typedef VkResult (VKAPI *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory mem); typedef VkResult (VKAPI *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges); typedef VkResult (VKAPI *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges); +typedef VkResult (VKAPI *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes); typedef VkResult (VKAPI *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset); typedef VkResult (VKAPI *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset); typedef VkResult (VKAPI *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements); @@ -2546,6 +2548,12 @@ VkResult VKAPI vkInvalidateMappedMemoryRanges( uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges); +VkResult VKAPI vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes); + + // Memory management API functions VkResult VKAPI vkBindBufferMemory( diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp index 49c1beaf..17ccad40 100644 --- a/layers/param_checker.cpp +++ b/layers/param_checker.cpp @@ -2537,6 +2537,16 @@ VK_LAYER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges( return result; } +VK_LAYER_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes) +{ + VkResult result = get_dispatch_table(pc_device_table_map, device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); + + return result; +} + bool PostBindBufferMemory( VkDevice device, VkBuffer buffer, diff --git a/loader/table_ops.h b/loader/table_ops.h index 8e8ce9bf..601be425 100644 --- a/loader/table_ops.h +++ b/loader/table_ops.h @@ -49,6 +49,7 @@ static inline void loader_init_device_dispatch_table(VkLayerDispatchTable *table table->UnmapMemory = (PFN_vkUnmapMemory) gpa(dev, "vkUnmapMemory"); table->FlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) gpa(dev, "vkFlushMappedMemoryRanges"); table->InvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) gpa(dev, "vkInvalidateMappedMemoryRanges"); + table->GetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) gpa(dev, "vkGetDeviceMemoryCommitment"); table->GetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) gpa(dev, "vkGetBufferMemoryRequirements"); table->GetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) gpa(dev, "vkGetImageMemoryRequirements"); table->BindBufferMemory = (PFN_vkBindBufferMemory) gpa(dev, "vkBindBufferMemory"); @@ -208,6 +209,8 @@ static inline void *loader_lookup_device_dispatch_table( return (void *) table->FlushMappedMemoryRanges; if (!strcmp(name, "InvalidateMappedMemoryRanges")) return (void *) table->InvalidateMappedMemoryRanges; + if (!strcmp(name, "GetDeviceMemoryCommitment")) + return (void *) table->GetDeviceMemoryCommitment; if (!strcmp(name, "GetBufferMemoryRequirements")) return (void *) table->GetBufferMemoryRequirements; if (!strcmp(name, "GetImageMemoryRequirements")) diff --git a/loader/trampoline.c b/loader/trampoline.c index 13d4e680..0e102741 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -420,6 +420,15 @@ LOADER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(VkDevice device, uin return disp->InvalidateMappedMemoryRanges(device, memRangeCount, pMemRanges); } +LOADER_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) +{ + const VkLayerDispatchTable *disp; + + disp = loader_get_dispatch(device); + + return disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); +} + LOADER_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) { const VkLayerDispatchTable *disp; @@ -346,6 +346,11 @@ core = Extension( Param("uint32_t", "memRangeCount"), Param("const VkMappedMemoryRange*", "pMemRanges")]), + Proto("VkResult", "GetDeviceMemoryCommitment", + [Param("VkDevice", "device"), + Param("VkDeviceMemory", "memory"), + Param("VkDeviceSize*", "pCommittedMemoryInBytes")]), + Proto("VkResult", "BindBufferMemory", [Param("VkDevice", "device"), Param("VkBuffer", "buffer"), |
