Exemplo n.º 1
0
        void CreateInstance()
        {
            var extensions = new List <string>(GLFW.GetRequiredInstanceExceptions());

            var appInfo = new VkApplicationInfo {
                apiVersion         = new VkVersion(1, 0, 0),
                applicationVersion = new VkVersion(1, 0, 0),
                engineVersion      = new VkVersion(1, 0, 0),
                applicationName    = "All Colors",
            };

            var info = new VkInstanceCreateInfo {
                applicationInfo = appInfo,
                extensions      = extensions,
                layers          = layers
            };

            instance = new VkInstance(info);
        }
Exemplo n.º 2
0
        void CreateInstance()
        {
            var appName = new InteropString("Hello Triangle");

            var appInfo = new VkApplicationInfo();

            appInfo.sType              = CSGL.Vulkan.VkStructureType.ApplicationInfo;
            appInfo.pApplicationName   = appName.Address;
            appInfo.applicationVersion = new CSGL.Vulkan.VkVersion(1, 0, 0);
            appInfo.engineVersion      = new CSGL.Vulkan.VkVersion(0, 0, 1);
            appInfo.apiVersion         = new CSGL.Vulkan.VkVersion(1, 0, 0);

            var appInfoNative = new Native <VkApplicationInfo>(appInfo);

            var info = new VkInstanceCreateInfo();

            info.sType            = CSGL.Vulkan.VkStructureType.InstanceCreateInfo;
            info.pApplicationInfo = appInfoNative.Address;

            var extensions       = GLFW.GetRequiredInstanceExceptions();
            var extensionsNative = new NativeStringArray(extensions);

            info.ppEnabledExtensionNames = extensionsNative.Address;
            info.enabledExtensionCount   = (uint)extensions.Count;

            var layersNative = new NativeStringArray(layers);

            info.ppEnabledLayerNames = layersNative.Address;
            info.enabledLayerCount   = (uint)layers.Length;

            var result = VK.CreateInstance(ref info, alloc, out instance);

            appName.Dispose();
            appInfoNative.Dispose();
            extensionsNative.Dispose();
            layersNative.Dispose();
        }
Exemplo n.º 3
0
        void CreateInstance()
        {
            var extensions = new List <string>(GLFW.GetRequiredInstanceExceptions());

            foreach (var extension in instanceExtensions)
            {
                extensions.Add(extension);
            }

            var appInfo = new VkApplicationInfo {
                apiVersion         = new VkVersion(1, 0, 0),
                applicationVersion = new VkVersion(1, 0, 0),
                engineVersion      = new VkVersion(1, 0, 0),
                applicationName    = "Hello Triangle"
            };

            var info = new VkInstanceCreateInfo {
                applicationInfo = appInfo,
                extensions      = extensions,
                layers          = layers
            };

            instance = new VkInstance(info);
        }