Esempio n. 1
0
        /// <summary>
        /// Initialize the graphic library.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            // - Create a Vulkan instance, this instance must be alive during all the game execution
            Library.Initialize(TargetSurface);

            // - Makes a new device manager
            PhysicalDevice.Initialize(TargetSurface);

            // - Initialize the physical device on this drawing area
            GraphicDevice.Initialize();

            // - Initialize index and vert manager
            VertexManager.Setup();
            IndexManager.Setup();

            // - Makes syncronization semaphores and fances CPU<->GPU
            for (int i = 0; i < MaxFrameInFlight; ++i)
            {
                CommandBuffers.Add(null);
                Commands.Add(GraphicDevice.Handle.CreateCommandPool(GraphicDevice.GraphicQueueIndex, CommandPoolCreateFlags.ResetCommandBuffer));
                ImageAvailableSemaphores.Add(GraphicDevice.Handle.CreateSemaphore());
                RenderFinishedSemaphores.Add(GraphicDevice.Handle.CreateSemaphore());
                InFlightFences.Add(GraphicDevice.Handle.CreateFence(FenceCreateFlags.Signaled));
            }
        }