CodingRays
CodingRays

Reputation: 109

Vulkan no device memory reports host visible

I am currently trying to get into vulkan. For now all i want to do is create a buffer clear it and read its content back to the host. My problem now is that i cannot find a single memory that is host visible. I tested my program on my laptop and desktop running a GT 750M/GTX 970 both with the same results. I get 2 memories one 2GB/4GB that reports as beeing device local and a 17GB that is not device local, so far so good, but neither of them reports host visible. I would be surprised enough that i cannot read data from my 970 but what really makes me think that i made a big mistake somewhere is that not even the 17GB system memory are host visible.

I am using the latest version of the LunarG SDK(1.0.49) and the latest GeForece drivers.

Here is my instance creation code:

VkInstance instance;
{
    char *extName = VK_EXT_DEBUG_REPORT_EXTENSION_NAME;
    char *layName = "VK_LAYER_LUNARG_standard_validation";

    VkInstanceCreateInfo info;
    info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
    info.enabledExtensionCount = 1;
    info.enabledLayerCount = 1;
    info.pNext = nullptr;
    info.ppEnabledExtensionNames = &extName;
    info.ppEnabledLayerNames = &layName;
    info.flags = 0;

    VkApplicationInfo appinfo;
    appinfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
    appinfo.apiVersion = VK_MAKE_VERSION(1, 0, 0);
    appinfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
    appinfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
    appinfo.pApplicationName = "Vulkan Test";
    appinfo.pEngineName = "Vulkan Test";
    appinfo.pNext = nullptr;

    info.pApplicationInfo = &appinfo;

    VkResult res = vkCreateInstance(&info, nullptr, &instance);
    if (res != VK_SUCCESS) {
        std::cerr << "Failed to create instance " << res << std::endl;
        return;
    }
}

Upvotes: 2

Views: 1059

Answers (1)

Sascha Willems
Sascha Willems

Reputation: 5798

I get 2 memories one 2GB/4GB that reports as beeing device local and a 17GB that is not device local, so far so good, but neither of them reports host visible.

From your description it sounds like the list of memory heaps (VkPhysicalDeviceMemoryProperties.memoryHeaps) which is correct for your GTX750/970.

But what you actually need to check for memory allocations you want to do in your appliation are the memory types instead (VkPhysicalDeviceMemoryProperties.memoryTypes).

These memory types (based of the heaps) contain the flags specifying how that memory (on the heap) can be accessed. Here are the memory types available for a GTX 970 including host visible types.

Upvotes: 5

Related Questions