Auto-generated low level Vulkan bindings for .NET.
vk.net is designed to be used with vke.net to ease building vulkan applications in c#.
The nuget package is available under the name Vulkan.
Compiling Options:
-p:AutoSetSType
=true
Vulkan binding for .net
License: MIT License
Auto-generated low level Vulkan bindings for .NET.
vk.net is designed to be used with vke.net to ease building vulkan applications in c#.
The nuget package is available under the name Vulkan.
Compiling Options:
-p:AutoSetSType
=true
Running vke on windows cause Unhandled exception when trying to allocate a GCHandle for enum arrays. This should be solve in future version of ms .net runtimes. But in current development version of ms runtime (5.0.0-dev), enum isn't already blittale.
So I will start by saying I'm not sure what I'm about to say is right but please stick with me.
This is the code I'm using to call the vkEnumerateInstanceLayerProperties
if (vkEnumerateInstanceLayerProperties(out var count, IntPtr.Zero) != VkResult.Success) return;
var sizeStruct = Marshal.SizeOf<VkLayerProperties>();
var ptrSupLayers = Marshal.AllocHGlobal(sizeStruct * (int) count);
if (vkEnumerateInstanceLayerProperties(out count, ptrSupLayers) != VkResult.Success) return;
var result = new string[count];
var tmp = ptrSupLayers;
for (var i = 0; i < count; i++) {
result[i] = Marshal.PtrToStringAnsi(tmp);
tmp += sizeStruct;
}
Marshal.FreeHGlobal(ptrSupLayers);
This is effectivally your code from VKE for vkEnumerateInstanceExtensionProperties but for Layers.
Looking at the generated code
[CalliRewrite]
public static unsafe VkResult vkEnumerateInstanceLayerProperties(out uint pPropertyCount, IntPtr pProperties)
{
fixed (uint* numPtr = &pPropertyCount)
{
IntPtr num = pProperties;
// ISSUE: cast to a function pointer type
// ISSUE: function pointer call
return __calli((__FnPtr<VkResult (uint*, IntPtr)>) Vk.vkEnumerateInstanceLayerProperties_ptr)((IntPtr) numPtr, (uint*) num);
}
}
To my unaware of how such things work but learning mind this looks like things are the wrong cast in that
return __calli((__FnPtr<VkResult (uint*, IntPtr)>) Vk.vkEnumerateInstanceLayerProperties_ptr)((IntPtr) numPtr, (uint*) num);
should be
return __calli((__FnPtr<VkResult (uint*, IntPtr)>) Vk.vkEnumerateInstanceLayerProperties_ptr)((uint*) numPtr, (IntPtr) num);
But I'm happy to accept if I'm wrong please let me know
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.