internal static void Init() { Vulkan.Load(ref createInstance); Vulkan.Load(ref enumerateExtensionProperties); Vulkan.Load(ref enumerateLayerProperties); initialized = true; }
public Device(PhysicalDevice physicalDevice, DeviceCreateInfo info) { if (physicalDevice == null) { throw new ArgumentNullException(nameof(physicalDevice)); } if (info == null) { throw new ArgumentNullException(nameof(info)); } PhysicalDevice = physicalDevice; Instance = physicalDevice.Instance; queues = new Dictionary <QueueID, Queue>(); if (info.extensions == null) { Extensions = new List <string>(); } else { Extensions = new List <string>(info.extensions); } ValidateExtensions(); CreateDevice(info); Vulkan.Load(ref getDeviceProcAddr, Instance); Commands = new DeviceCommands(this); }
internal InstanceCommands(Instance instance) { Type t = typeof(InstanceCommands); FieldInfo[] fields = t.GetFields(); for (int i = 0; i < fields.Length; i++) { string command = Vulkan.GetCommand(fields[i].FieldType); IntPtr ptr = instance.GetProcAddress(command); fields[i].SetValue(this, Marshal.GetDelegateForFunctionPointer(ptr, fields[i].FieldType)); } }
void Init(InstanceCreateInfo mInfo) { if (!GLFW.GLFW.VulkanSupported()) { throw new InstanceException("Vulkan not supported"); } if (!initialized) { Init(); } if (mInfo.extensions == null) { extensions = new List <string>(); } else { extensions = new List <string>(mInfo.extensions); } if (mInfo.layers == null) { layers = new List <string>(); } else { layers = new List <string>(mInfo.layers); } CreateInstance(mInfo); Extensions = extensions.AsReadOnly(); Layers = layers.AsReadOnly(); Vulkan.Load(ref getProcAddrDel, instance); Commands = new InstanceCommands(this); GetPhysicalDevices(); }