예제 #1
0
        private void CreateInstance()
        {
            var enabledLayers = new List <string>();

            if (Instance.EnumerateLayerProperties().Any(x => x.LayerName == "VK_LAYER_LUNARG_standard_validation"))
            {
                enabledLayers.Add("VK_LAYER_LUNARG_standard_validation");
            }

            var glfwExtensions = Glfw3.glfwGetRequiredInstanceExtensions();

            this.instance = Instance.Create(new InstanceCreateInfo
            {
                ApplicationInfo = new ApplicationInfo
                {
                    ApplicationName    = "Ludum Dare 38",
                    ApplicationVersion = new SharpVk.Version(1, 0, 0),
                    EngineName         = "SharpVk",
                    EngineVersion      = Constants.SharpVkVersion,
                    ApiVersion         = Constants.ApiVersion10
                },
                EnabledExtensionNames = glfwExtensions.Concat(new[] { ExtDebugReport.ExtensionName }).ToArray(),
                EnabledLayerNames     = enabledLayers.ToArray()
            }, null);

            this.reportCallback = this.instance.CreateDebugReportCallback(new DebugReportCallbackCreateInfo
            {
                Flags       = DebugReportFlags.Error | DebugReportFlags.Warning,
                PfnCallback = this.debugReportDelegate
            });
        }