Пример #1
0
 public static VkResult vkQueueBindSparse(VkQueue queue, ReadOnlySpan <VkBindSparseInfo> bindInfo, VkFence fence)
 {
     fixed(VkBindSparseInfo *bindInfoPtr = bindInfo)
     {
         return(vkQueueBindSparse(queue, (uint)bindInfo.Length, bindInfoPtr, fence));
     }
 }
Пример #2
0
 public static VkResult vkQueueSubmit(VkQueue queue, ReadOnlySpan <VkSubmitInfo> submits, VkFence fence)
 {
     fixed(VkSubmitInfo *submitsPtr = submits)
     {
         return(vkQueueSubmit(queue, (uint)submits.Length, submitsPtr, fence));
     }
 }
Пример #3
0
        public Graphics(Settings settings)
        {
#if DEBUG
            //settings.Validation = true;
#else
            settings.Validation = false;
#endif
            Settings = settings;

            enabledFeatures.samplerAnisotropy = true;
            enabledFeatures.depthClamp        = true;
            enabledFeatures.shaderStorageImageExtendedFormats = true;

            Device.Create(settings, enabledFeatures, EnabledExtensions);

            // Get a graphics queue from the Device
            GraphicsQueue = new VkQueue(Device.QFGraphics, 0);
            WorkQueue     = new VkQueue(Device.QFGraphics, 0);
            ComputeQueue  = new VkQueue(Device.QFCompute, 0);
            TransferQueue = new VkQueue(Device.QFTransfer, 0);

            DepthFormat = Device.GetSupportedDepthFormat();

            primaryCmdPool = new CommandBufferPool(Device.QFGraphics, VkCommandPoolCreateFlags.ResetCommandBuffer);

            DescriptorPoolManager = new DescriptorPoolManager();

            acquireSemaphore = new VkSemaphore(VkSemaphoreCreateFlags.None);
        }
Пример #4
0
        public unsafe void QueuePresent(VkQueue queue, uint imageIndex, VkSemaphore waitSemaphore = default)
        {
            var sc          = swapchain;
            var presentInfo = new VkPresentInfoKHR
            {
                sType          = VkStructureType.PresentInfoKHR,
                pNext          = null,
                swapchainCount = 1,
                pSwapchains    = &sc,
                pImageIndices  = &imageIndex
            };

            // Check if a wait semaphore has been specified to wait for before presenting the image
            if (waitSemaphore != VkSampler.Null)
            {
                presentInfo.pWaitSemaphores    = (VkSemaphore *)Unsafe.AsPointer(ref waitSemaphore);
                presentInfo.waitSemaphoreCount = 1;
            }

            VulkanUtil.CheckResult(vkQueuePresentKHR(queue, &presentInfo));
        }
Пример #5
0
        public static VkResult vkQueuePresentKHR(VkQueue queue, VkSemaphore waitSemaphore, VkSwapchainKHR swapchain, uint imageIndex)
        {
            var presentInfo = new VkPresentInfoKHR
            {
                sType = VkStructureType.PresentInfoKHR,
                pNext = null
            };

            if (waitSemaphore != VkSemaphore.Null)
            {
                presentInfo.waitSemaphoreCount = 1u;
                presentInfo.pWaitSemaphores    = &waitSemaphore;
            }

            if (swapchain != VkSwapchainKHR.Null)
            {
                presentInfo.swapchainCount = 1u;
                presentInfo.pSwapchains    = &swapchain;
                presentInfo.pImageIndices  = &imageIndex;
            }

            return(vkQueuePresentKHR(queue, &presentInfo));
        }
Пример #6
0
 public static VkResult vkQueueSubmit(VkQueue queue, VkSubmitInfo submit, VkFence fence)
 {
     return(vkQueueSubmit(queue, 1, &submit, fence));
 }
Пример #7
0
 public static VkResult vkQueueBindSparse(VkQueue queue, VkBindSparseInfo bindInfo, VkFence fence)
 {
     return(vkQueueBindSparse(queue, 1, &bindInfo, fence));
 }