AppDev AppDevInit(AppGpu gpu) { DeviceCreateInfo info = new DeviceCreateInfo { QueueCreateInfoCount = 0, // TODO : this sould not be QueueCreateInfos = new DeviceQueueCreateInfo[0], EnabledLayerCount = 0, EnabledLayerNames = new string[0], }; // Scan layers List <LayerExtensionList> layers = new List <LayerExtensionList>(); LayerProperties[] layerProperties = gpu.Obj.EnumerateDeviceLayerProperties(); if (layerProperties != null) { foreach (LayerProperties layer in layerProperties) { LayerExtensionList layerExtList = new LayerExtensionList { LayerProperties = layer, ExtensionProperties = gpu.Obj.EnumerateDeviceExtensionProperties(layer.LayerName), }; if (layerExtList.ExtensionProperties == null) { layerExtList.ExtensionProperties = new ExtensionProperties[0]; } layers.Add(layerExtList); } } ExtensionProperties[] extensions = gpu.Obj.EnumerateDeviceExtensionProperties(""); foreach (string knownExtName in KnownDeviceExtensions) { bool extensionFound = false; foreach (ExtensionProperties extention in extensions) { if (extention.ExtensionName == knownExtName) { extensionFound = true; break; } } if (!extensionFound) { throw new Exception("Cannot find extension: " + knownExtName); } } gpu.DeviceLayers = layers.ToArray(); gpu.DeviceExtensions = extensions; info.QueueCreateInfoCount = (uint)gpu.QueueReqs.Length; info.QueueCreateInfos = gpu.QueueReqs; info.EnabledExtensionNames = KnownDeviceExtensions; info.EnabledExtensionCount = (uint)KnownDeviceExtensions.Length; Device device = gpu.Obj.CreateDevice(info, null); return(new AppDev { Gpu = gpu, Obj = device, }); }
AppInstance AppCreateInstance(uint apiVersion) { ApplicationInfo appInfo = new ApplicationInfo { ApplicationName = ApplicationName, ApplicationVersion = ApplicationVersion, EngineName = EngineName, EngineVersion = EnginveVersion, ApiVersion = apiVersion, }; InstanceCreateInfo createInfo = new InstanceCreateInfo { ApplicationInfo = appInfo, EnabledLayerCount = 0, EnabledExtensionCount = 0, }; // Scan layers List <LayerExtensionList> layers = new List <LayerExtensionList>(); LayerProperties[] layerProperties = Commands.EnumerateInstanceLayerProperties(); if (layerProperties != null) { foreach (LayerProperties layer in layerProperties) { LayerExtensionList layerExtList = new LayerExtensionList { LayerProperties = layer, ExtensionProperties = Commands.EnumerateInstanceExtensionProperties(layer.LayerName), }; if (layerExtList.ExtensionProperties == null) { layerExtList.ExtensionProperties = new ExtensionProperties[0]; } layers.Add(layerExtList); } } ExtensionProperties[] extensions = Commands.EnumerateInstanceExtensionProperties(""); if (extensions == null) { extensions = new ExtensionProperties[0]; } foreach (string knownExtName in KnownExtensions) { bool extensionFound = false; foreach (ExtensionProperties extention in extensions) { if (extention.ExtensionName == knownExtName) { extensionFound = true; break; } } if (!extensionFound) { throw new Exception("Cannot find extension: " + knownExtName); } } createInfo.EnabledExtensionNames = KnownExtensions; createInfo.EnabledExtensionCount = (uint)KnownExtensions.Length; // TODO : Register debug callback Instance instance = new Instance(createInfo); return(new AppInstance { Instance = instance, Layers = layers.ToArray(), Extensions = extensions, }); }