VKGETPHYSICALDEVICEM(3)

NAME
vkGetPhysicalDeviceMemoryProperties - Reports memory information for the specified physical device.

C SPECIFICATION

    void vkGetPhysicalDeviceMemoryProperties(
        VkPhysicalDevice                            physicalDevice,
        VkPhysicalDeviceMemoryProperties*           pMemoryProperties);

PARAMETERS

physicalDevice
    A handle to the physical device about which information is to be retrieved.

pMemoryProperties
    A pointer to a structure that is to receive the memory information.

DESCRIPTION

vkGetPhysicalDeviceMemoryProperties retrieves information about the memory of the physical device whose handle is given in physicalDevice. pMemoryProperties should point to an instance of the VkPhysicalDeviceMemoryProperties structure, into which will be stored the information about the device. The definition of VkPhysicalDeviceMemoryProperties is as follows.

    typedef struct VkPhysicalDeviceMemoryProperties {
        uint32_t        memoryTypeCount;
        VkMemoryType    memoryTypes[VK_MAX_MEMORY_TYPES];
        uint32_t        memoryHeapCount;
        VkMemoryHeap    memoryHeaps[VK_MAX_MEMORY_HEAPS];
    } VkPhysicalDeviceMemoryProperties;

    • memoryTypeCount will be filled with the number of memory types supported by the device.

    • memoryTypes is an array of VK_MAX_MEMORY_TYPES instances of the VkMemoryType structures. Upon return from vkGetPhysicalDeviceMemoryProperties, the first memoryTypeCount elements of memoryTypes will contain valid data.

    • memoryHeapCount will be filled with the number of memory heaps supported by the device.

    • memoryHeaps is an array of VK_MAX_MEMORY_HEAPS VkMemoryHeap structures which describe the heaps available to the device.

The definition of the VkMemoryType structure is as follows:

    typedef struct VkMemoryType {
        VkMemoryPropertyFlags    propertyFlags;
        uint32_t                 heapIndex;
    } VkMemoryType;

    • propertyFlags is a bitfield made up from members of the VkMemoryPropertyFlagBits enumeration, which is described below.

    • heapIndex is the index into the memoryHeaps array returned through this command from which the memory type will be allocated.

The VkMemoryPropertyFlagBits enumeration, which forms the available bits for use in the propertyFlags member of the VkMemoryType structure is defined as follows:

    typedef enum VkMemoryPropertyFlagBits {
        VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
        VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
        VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
        VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
        VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
    } VkMemoryPropertyFlagBits;

    • VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT signifies that the memory is the most efficient type for device access (e.g. local device memory).

    • VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT indicates that memory with this property is visible to the host. That is, a valid host address may be obtained and allocations from this memory type may be mapped.

    • VK_MEMORY_PROPERTY_HOST_COHERENT_BIT indicates that accesses to mapped memory of this type is coherent with accesses to the same memory by the device. Such access do not need to be marshalled using calls to vkFlushMappedMemoryRanges or by unmapping the memory.

    • VK_MEMORY_PROPERTY_HOST_CACHED_BIT indicates that data stored in memory of this type is cached by the host and as such, it is likely that reads from such regions by the host will be faster than reads from uncached memory.

    • VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT indicates that allocations from this type of memory may be made on an as-needed basis. In general, allocations from this type of memory will almost always succeed and return quickly, but first access to such a region may take longer than expected.

The definition of the VkMemoryHeap structure is as follows:

    typedef struct VkMemoryHeap {
        VkDeviceSize         size;
        VkMemoryHeapFlags    flags;
    } VkMemoryHeap;

    • size specifies the size in bytes of the memory heap.

    • flags is a bitfield made up of the members of the VkMemoryHeapFlagBits enumeration, the definition of which is:

    typedef enum VkMemoryHeapFlagBits {
        VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
    } VkMemoryHeapFlagBits;

    • If the flags member of VkMemoryHeap contains VK_MEMORY_HEAP_HOST_LOCAL_BIT, then the memory for that heap is located closer to the host than to the device in NUMA (Non-Unified Memory Architecture) systems. Even in unified architectures, this flag may indicate that access to this heap is more efficient from the host than from the device.

VALID USAGE

    • physicalDevice must be a valid VkPhysicalDevice handle

    • pMemoryProperties must be a pointer to a VkPhysicalDeviceMemoryProperties structure

SEE ALSO

vkGetPhysicalDeviceProperties

COPYRIGHT

Copyright © 2014-2016 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

AUTHOR

Khronos Group
    Author.