jpbruyere / vk.net

Vulkan binding for .net
MIT License
32 stars 3 forks source link

Crash on call to Vk.vkEnumeratePhysicalDevices #7

Closed SamHSmith closed 4 years ago

SamHSmith commented 4 years ago

Hi, my code crashes when I try to use the Vk.vkEnumeratePhysicalDevices function. Here is my code:


        VkInstance inst = CreateInstance();

        uint deviceCount = 0;
        Assert(Vk.vkEnumeratePhysicalDevices(inst, (IntPtr)(&deviceCount), IntPtr.Zero));

        VkPhysicalDevice[] physicalDevices = new VkPhysicalDevice[deviceCount];

        fixed (VkPhysicalDevice* devPtr = &physicalDevices[0])
        {
            Assert(Vk.vkEnumeratePhysicalDevices(inst, (IntPtr)(&deviceCount), (IntPtr)devPtr));
        }

        VkPhysicalDevice physicalDevice = _PickPhysicsDevice(physicalDevices, deviceCount);

Am I using the api the correct way? Or else why is it crashing inside of Vk.vkEnumeratePhysicalDevices?

jpbruyere commented 4 years ago

I recommend you to check the PhysicalDeviceCollection class of vke.net to have a working example. Vke.net has several examples inspired from Sacha Willems samples. vke.net is a higher level api using vk.net which is quiet raw to use, Maybe you'll find easier to start programming with that api.

jpbruyere commented 4 years ago

I had some trouble for vke.net on github due to git lfs quotas. I've recreated the repo on github and added a download script for the samples datas.

SamHSmith commented 4 years ago

I solved the issue and moved on. Cant remember what fixed my issue.