public static bool InitAllAvaliableInstances(AbstractionDesc desc, out List <InstanceBase> instances)
        {
            instances = new List <InstanceBase>();
            if (desc.supportedAPIs == null)
            {
                return(false);
            }

            foreach (var api in desc.supportedAPIs)
            {
                switch (api)
                {
                                        #if WIN32 || WIN32
                case AbstractionAPI.D3D12:
                {
                    if (!LoadNativeLib(Path.Combine(desc.nativeLibPathD3D12, D3D12.Instance.lib)))
                    {
                        continue;
                    }
                    var instanceD3D12 = new D3D12.Instance();
                    if (instanceD3D12.Init(desc.instanceDescD3D12))
                    {
                        instances.Add(instanceD3D12);
                    }
                    else
                    {
                        instanceD3D12.Dispose();
                    }
                }
                break;

                case AbstractionAPI.Vulkan:
                {
                    if (!LoadNativeLib(Path.Combine(desc.nativeLibPathVulkan, Vulkan.Instance.lib)))
                    {
                        continue;
                    }
                    var instanceVulkan = new Vulkan.Instance();
                    if (instanceVulkan.Init(desc.instanceDescVulkan))
                    {
                        instances.Add(instanceVulkan);
                    }
                    else
                    {
                        instanceVulkan.Dispose();
                    }
                }
                break;
                                        #endif
                }
            }

            return(true);
        }
        public static bool InitFirstAvaliable(AbstractionDesc desc, out InstanceBase instance, out DeviceBase device)
        {
            if (desc.supportedAPIs == null)
            {
                instance = null;
                device   = null;
                return(false);
            }

            foreach (var api in desc.supportedAPIs)
            {
                switch (api)
                {
                                        #if WIN32 || WIN32
                case AbstractionAPI.D3D12:
                {
                    if (!LoadNativeLib(Path.Combine(desc.nativeLibPathD3D12, D3D12.Instance.lib)))
                    {
                        continue;
                    }
                    var instanceD3D12 = new D3D12.Instance();
                    if (instanceD3D12.Init(desc.instanceDescD3D12))
                    {
                        var deviceD3D12 = new D3D12.Device(instanceD3D12, desc.type);
                        if (deviceD3D12.Init(desc.deviceDescD3D12))
                        {
                            instance = instanceD3D12;
                            device   = deviceD3D12;
                            return(true);
                        }

                        deviceD3D12.Dispose();
                        instanceD3D12.Dispose();
                    }
                    else
                    {
                        instanceD3D12.Dispose();
                    }
                }
                break;

                case AbstractionAPI.Vulkan:
                {
                    if (!LoadNativeLib(Path.Combine(desc.nativeLibPathVulkan, "vulkan-1.dll")))
                    {
                        continue;
                    }
                    if (!LoadNativeLib(Path.Combine(desc.nativeLibPathVulkan, Vulkan.Instance.lib)))
                    {
                        continue;
                    }
                    var instanceVulkan = new Vulkan.Instance();
                    if (instanceVulkan.Init(desc.instanceDescVulkan))
                    {
                        var deviceVulkan = new Vulkan.Device(instanceVulkan, desc.type);
                        if (deviceVulkan.Init(desc.deviceDescVulkan))
                        {
                            instance = instanceVulkan;
                            device   = deviceVulkan;
                            return(true);
                        }

                        deviceVulkan.Dispose();
                        instanceVulkan.Dispose();
                    }
                    else
                    {
                        instanceVulkan.Dispose();
                    }
                }
                break;
                                        #endif
                }
            }

            instance = null;
            device   = null;
            return(false);
        }