Exemplo n.º 1
0
        internal VulkanGraphicsContext(VulkanGraphicsDevice device, int index)
            : base(device, index)
        {
            _fence = new VulkanGraphicsFence(device);
            _waitForExecuteCompletionFence = new VulkanGraphicsFence(device);

            _vulkanCommandBuffer      = new ValueLazy <VkCommandBuffer>(CreateVulkanCommandBuffer);
            _vulkanCommandPool        = new ValueLazy <VkCommandPool>(CreateVulkanCommandPool);
            _vulkanFramebuffer        = new ValueLazy <VkFramebuffer>(CreateVulkanFramebuffer);
            _vulkanSwapChainImageView = new ValueLazy <VkImageView>(CreateVulkanSwapChainImageView);

            _ = _state.Transition(to: Initialized);
        }
Exemplo n.º 2
0
        internal VulkanGraphicsDevice(VulkanGraphicsAdapter graphicsAdapter, IGraphicsSurface graphicsSurface, int graphicsContextCount)
            : base(graphicsAdapter, graphicsSurface)
        {
            _presentCompletionGraphicsFence = new VulkanGraphicsFence(this);

            _vulkanCommandQueue            = new ValueLazy <VkQueue>(GetVulkanCommandQueue);
            _vulkanCommandQueueFamilyIndex = new ValueLazy <uint>(GetVulkanCommandQueueFamilyIndex);
            _vulkanDevice          = new ValueLazy <VkDevice>(CreateVulkanDevice);
            _vulkanRenderPass      = new ValueLazy <VkRenderPass>(CreateVulkanRenderPass);
            _vulkanSurface         = new ValueLazy <VkSurfaceKHR>(CreateVulkanSurface);
            _vulkanSwapchain       = new ValueLazy <VkSwapchainKHR>(CreateVulkanSwapchain);
            _vulkanSwapchainImages = new ValueLazy <VkImage[]>(GetVulkanSwapchainImages);

            _graphicsContexts = CreateGraphicsContexts(this, graphicsContextCount);

            _ = _state.Transition(to: Initialized);

            PresentCompletionGraphicsFence.Reset();
            graphicsSurface.SizeChanged += OnGraphicsSurfaceSizeChanged;