Пример #1
0
        internal Instance(string appName, string engName,
                          VER appVer, VER engVer, VER apiVer, bool bDebug)
        {
            string vlName = "";

            if (bDebug)
            {
                if (!bCheckValidation(out vlName))
                {
                    return;
                }
            }

            ApplicationInfo ai = new ApplicationInfo();

            ai.ApplicationName    = appName;
            ai.ApplicationVersion = appVer;
            ai.EngineName         = engName;
            ai.EngineVersion      = engVer;
            ai.ApiVersion         = apiVer;

            InstanceCreateInfo ici = new InstanceCreateInfo();

            ici.Next            = IntPtr.Zero;
            ici.ApplicationInfo = ai;

            List <string> extensions = new List <string>();

            extensions.AddRange(Vulkan.GetRequiredInstanceExtensions());
            if (bDebug)
            {
                extensions.Add(Constant.InstanceExtension.ExtDebugReport);
            }

            //get extension stuff from glfw
            ici.EnabledExtensionNames = extensions.ToArray();

            if (bDebug)
            {
                ici.EnabledLayerNames = new string[1] {
                    vlName
                };
            }

            mInstance = new INST(ici, null);
        }
Пример #2
0
        public bool InitVulkan(string appName, VER appVer, bool bDebug)
        {
            Glfw.Init();

            mInstance = new Instance(appName, EngineName,
                                     appVer, mEngineVer, mAPIVer, bDebug);

            if (!mInstance.IsValid())
            {
                Misc.SafeInvoke(eErrorSpam, "Couldn't create Vulkan instance.");
                return(false);
            }

            if (bDebug)
            {
                //set up debug callback to talk to validation stuff
                DebugReportCallbackCreateInfoExt drcbci = new DebugReportCallbackCreateInfoExt(
                    DebugReportFlagsExt.All, DebugReportCallback, IntPtr.Zero);
                mDebugCB = mInstance.AttachDebugCallback(drcbci);
            }

            return(true);
        }