예제 #1
0
        void PrepareSynchronizationPrimitives()
        {
            var semaphoreCreateInfo = new MgSemaphoreCreateInfo {
            };

            Debug.Assert(mConfiguration.Device != null);

            var err = mConfiguration.Device.CreateSemaphore(semaphoreCreateInfo, null, out mPresentCompleteSemaphore);

            Debug.Assert(err == Result.SUCCESS);

            err = mConfiguration.Device.CreateSemaphore(semaphoreCreateInfo, null, out mRenderCompleteSemaphore);
            Debug.Assert(err == Result.SUCCESS);

            var fenceCreateInfo = new MgFenceCreateInfo {
                Flags = MgFenceCreateFlagBits.SIGNALED_BIT,
            };

            var noOfCommandBuffers = drawCmdBuffers.Length;

            for (var i = 0; i < noOfCommandBuffers; ++i)
            {
                IMgFence fence;
                err = mConfiguration.Device.CreateFence(fenceCreateInfo, null, out fence);
                Debug.Assert(err == Result.SUCCESS);
                mWaitFences.Add(fence);
            }
        }
예제 #2
0
        void flushCommandBuffer(IMgCommandBuffer commandBuffer)
        {
            Debug.Assert(commandBuffer != null);

            var err = commandBuffer.EndCommandBuffer();

            Debug.Assert(err == Result.SUCCESS);

            var submitInfos = new []
            {
                new MgSubmitInfo
                {
                    CommandBuffers = new []
                    {
                        commandBuffer
                    }
                }
            };

            var fenceCreateInfo = new MgFenceCreateInfo();

            err = mConfiguration.Device.CreateFence(fenceCreateInfo, null, out IMgFence fence);
            Debug.Assert(err == Result.SUCCESS);

            err = mConfiguration.Queue.QueueSubmit(submitInfos, fence);
            Debug.Assert(err == Result.SUCCESS);

            err = mConfiguration.Queue.QueueWaitIdle();
            Debug.Assert(err == Result.SUCCESS);

            err = mConfiguration.Device.WaitForFences(new[] { fence }, true, ulong.MaxValue);
            Debug.Assert(err == Result.SUCCESS);

            fence.DestroyFence(mConfiguration.Device, null);
            mConfiguration.Device.FreeCommandBuffers(mConfiguration.Partition.CommandPool, new[] { commandBuffer });
        }
예제 #3
0
 public Result CreateFence(MgFenceCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgFence fence)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 public Result CreateFence(MgFenceCreateInfo pCreateInfo, IMgAllocationCallbacks allocator, out IMgFence fence)
 {
     fence = mEntrypoint.Fence.CreateFence();
     return(Result.SUCCESS);
 }