Exemplo n.º 1
0
        public VkGraphicsDevice(GraphicsDeviceOptions options, VkSurfaceSource surfaceSource, uint width, uint height)
        {
            CreateInstance(options.Debug);
            CreateSurface(surfaceSource);
            CreatePhysicalDevice();
            CreateLogicalDevice();
            _memoryManager  = new VkDeviceMemoryManager(_device, _physicalDevice);
            ResourceFactory = new VkResourceFactory(this);
            _scFB           = new VkSwapchainFramebuffer(
                this,
                _surface,
                width,
                height,
                options.SyncToVerticalBlank,
                options.SwapchainDepthFormat);
            CreateDescriptorPool();
            CreateGraphicsCommandPool();
            for (int i = 0; i < SharedCommandPoolCount; i++)
            {
                _sharedGraphicsCommandPools.Push(new SharedCommandPool(this, true));
            }
            CreateFences();

            _scFB.AcquireNextImage(_device, VkSemaphore.Null, _imageAvailableFence);
            vkWaitForFences(_device, 1, ref _imageAvailableFence, true, ulong.MaxValue);
            vkResetFences(_device, 1, ref _imageAvailableFence);

            PostDeviceCreated();
        }
Exemplo n.º 2
0
        public VkGraphicsDevice(VkSurfaceSource surfaceSource, uint width, uint height, bool debugDevice)
        {
            CreateInstance(debugDevice);
            CreateSurface(surfaceSource);
            CreatePhysicalDevice();
            CreateLogicalDevice();
            _memoryManager  = new VkDeviceMemoryManager(_device, _physicalDevice);
            ResourceFactory = new VkResourceFactory(this);
            _scFB           = new VkSwapchainFramebuffer(this, _surface, width, height);
            CreateDescriptorPool();
            CreateGraphicsCommandPool();
            CreateFences();

            _scFB.AcquireNextImage(_device, VkSemaphore.Null, _imageAvailableFence);
            vkWaitForFences(_device, 1, ref _imageAvailableFence, true, ulong.MaxValue);
            vkResetFences(_device, 1, ref _imageAvailableFence);

            PostContextCreated();
        }
Exemplo n.º 3
0
 private void CreateSurface(VkSurfaceSource surfaceSource)
 {
     _surface = surfaceSource.CreateSurface(_instance);
 }