Example #1
0
        public Result AcquireNextImageKHR(IMgSwapchainKHR swapchain, ulong timeout, IMgSemaphore semaphore, IMgFence fence, out uint pImageIndex)
        {
            if (swapchain == null)
            {
                throw new ArgumentNullException(nameof(swapchain));
            }

            // TODO : make it variable
            var bSwapchain = (AmtSwapchainKHR)swapchain;
            var nextIndex  = bSwapchain.GetAvailableImageIndex();

            if (timeout == ulong.MaxValue)
            {
                bSwapchain.Images[nextIndex].Inflight.WaitOne();
            }
            else
            {
                var ticks    = (long)timeout / 10000L;
                var timespan = TimeSpan.FromTicks(ticks);
                bSwapchain.Images[nextIndex].Inflight.WaitOne(timespan);
            }

            bSwapchain.RefreshImageView(nextIndex);
            pImageIndex = nextIndex;
            return(Result.SUCCESS);
        }
Example #2
0
        //public IMgCommandBuffer PostPresent { get; set; }

        //public IMgCommandBuffer PrePresent { get; set; }

        uint AcquireNextImage(IMgSemaphore presentComplete, ulong timeout)
        {
            uint   nextImage;
            Result err = mGraphicsConfiguration.Device.AcquireNextImageKHR(mCollection.Swapchain, timeout, presentComplete, null, out nextImage);

            Debug.Assert(err == Result.SUCCESS);
            return(nextImage);
        }
Example #3
0
        public uint BeginDraw(IMgCommandBuffer postPresent, IMgSemaphore presentComplete, ulong timeout)
        {
            var currentIndex = 0U;

            mLayers[currentIndex].Inflight.WaitOne();
            if (mLayers[currentIndex].Drawable != null)
            {
                mLayers[currentIndex].Drawable.Dispose();
            }
            mLayers[currentIndex].Drawable = mView.CurrentDrawable;
            return(currentIndex);
        }
Example #4
0
        public Result AcquireNextImageKHR(IMgSwapchainKHR swapchain, ulong timeout, IMgSemaphore semaphore, IMgFence fence, out uint pImageIndex)
        {
            if (swapchain == null)
            {
                throw new ArgumentNullException("swapchain");
            }

            var sc = swapchain as IGLSwapchainKHR;

            if (sc == null)
            {
                throw new InvalidCastException("swapchain is not GLSwapchainKHR");
            }

            pImageIndex = sc.GetNextImage();
            // TODO : fence stuff
            return(Result.SUCCESS);
        }
Example #5
0
        public uint BeginDraw(IMgCommandBuffer postPresent, IMgSemaphore presentComplete, ulong timeout)
        {
            // Get next image in the swap chain (back/front buffer)
            //err = swapChain.acquireNextImage(semaphores.presentComplete, &currentBuffer);
            var nextImage     = AcquireNextImage(presentComplete, timeout);
            var currentBuffer = mCollection.Buffers [nextImage];

            mBarrier.SubmitPostPresentBarrier(postPresent, currentBuffer.Image);
            var submitInfo = new[] {
                new MgSubmitInfo
                {
                    CommandBuffers = new []
                    {
                        postPresent
                    },
                }
            };

            var result = mGraphicsConfiguration.Queue.QueueSubmit(submitInfo, null);

            Debug.Assert(result == Result.SUCCESS, result + " != Result.SUCCESS");

            return(nextImage);
        }
Example #6
0
 public Result CreateSemaphore(MgSemaphoreCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgSemaphore pSemaphore)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public uint BeginDraw(IMgCommandBuffer postPresent, IMgSemaphore presentComplete)
 {
     return(BeginDraw(postPresent, presentComplete, ulong.MaxValue));
 }
Example #8
0
 public Result AcquireNextImageKHR(IMgSwapchainKHR swapchain, ulong timeout, IMgSemaphore semaphore, IMgFence fence, out uint pImageIndex)
 {
     throw new NotImplementedException();
 }
Example #9
0
 public Result CreateSemaphore(MgSemaphoreCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgSemaphore pSemaphore)
 {
     pSemaphore = mEntrypoint.Semaphore.CreateSemaphore();
     return(Result.SUCCESS);
 }
Example #10
0
 public IMgSemaphore[] Render(IMgQueue queue, uint layerNo, IMgSemaphore semaphore)
 {
     return(new IMgSemaphore[] { });
 }