Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void Submit(SharpVk.SubmitInfo[] submits, SharpVk.Fence fence)
 {
     try
     {
         SharpVk.Interop.SubmitInfo *marshalledSubmits = default(SharpVk.Interop.SubmitInfo *);
         if (submits != null)
         {
             var fieldPointer = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.SubmitInfo>(submits.Length).ToPointer());
             for (int index = 0; index < (uint)(submits.Length); index++)
             {
                 submits[index].MarshalTo(&fieldPointer[index]);
             }
             marshalledSubmits = fieldPointer;
         }
         else
         {
             marshalledSubmits = null;
         }
         Result methodResult = Interop.Commands.vkQueueSubmit(this.handle, (uint)(submits?.Length ?? 0), marshalledSubmits, fence?.handle ?? default(SharpVk.Interop.Fence));
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemple #2
0
 internal unsafe void MarshalTo(SharpVk.Interop.SubmitInfo *pointer)
 {
     pointer->SType = StructureType.SubmitInfo;
     pointer->Next  = null;
     pointer->WaitSemaphoreCount = (uint)(this.WaitSemaphores?.Length ?? 0);
     if (this.WaitSemaphores != null)
     {
         var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(this.WaitSemaphores.Length).ToPointer());
         for (int index = 0; index < (uint)(this.WaitSemaphores.Length); index++)
         {
             fieldPointer[index] = this.WaitSemaphores[index]?.handle ?? default(SharpVk.Interop.Semaphore);
         }
         pointer->WaitSemaphores = fieldPointer;
     }
     else
     {
         pointer->WaitSemaphores = null;
     }
     if (this.WaitDestinationStageMask != null)
     {
         var fieldPointer = (SharpVk.PipelineStageFlags *)(Interop.HeapUtil.AllocateAndClear <SharpVk.PipelineStageFlags>(this.WaitDestinationStageMask.Length).ToPointer());
         for (int index = 0; index < (uint)(this.WaitDestinationStageMask.Length); index++)
         {
             fieldPointer[index] = this.WaitDestinationStageMask[index];
         }
         pointer->WaitDestinationStageMask = fieldPointer;
     }
     else
     {
         pointer->WaitDestinationStageMask = null;
     }
     pointer->CommandBufferCount = (uint)(this.CommandBuffers?.Length ?? 0);
     if (this.CommandBuffers != null)
     {
         var fieldPointer = (SharpVk.Interop.CommandBuffer *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.CommandBuffer>(this.CommandBuffers.Length).ToPointer());
         for (int index = 0; index < (uint)(this.CommandBuffers.Length); index++)
         {
             fieldPointer[index] = this.CommandBuffers[index]?.handle ?? default(SharpVk.Interop.CommandBuffer);
         }
         pointer->CommandBuffers = fieldPointer;
     }
     else
     {
         pointer->CommandBuffers = null;
     }
     pointer->SignalSemaphoreCount = (uint)(this.SignalSemaphores?.Length ?? 0);
     if (this.SignalSemaphores != null)
     {
         var fieldPointer = (SharpVk.Interop.Semaphore *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Semaphore>(this.SignalSemaphores.Length).ToPointer());
         for (int index = 0; index < (uint)(this.SignalSemaphores.Length); index++)
         {
             fieldPointer[index] = this.SignalSemaphores[index]?.handle ?? default(SharpVk.Interop.Semaphore);
         }
         pointer->SignalSemaphores = fieldPointer;
     }
     else
     {
         pointer->SignalSemaphores = null;
     }
 }
Exemple #3
0
 /// <summary>
 /// Submits a sequence of semaphores or command buffers to a queue.
 /// </summary>
 /// <param name="submits">
 /// </param>
 public unsafe void Submit(ArrayProxy <SharpVk.SubmitInfo>?submits, SharpVk.Fence fence)
 {
     try
     {
         SharpVk.Interop.SubmitInfo *marshalledSubmits = default(SharpVk.Interop.SubmitInfo *);
         if (submits.IsNull())
         {
             marshalledSubmits = null;
         }
         else
         {
             if (submits.Value.Contents == ProxyContents.Single)
             {
                 marshalledSubmits = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.SubmitInfo>());
                 submits.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.SubmitInfo *)(marshalledSubmits));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.SubmitInfo>(Interop.HeapUtil.GetLength(submits.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(submits.Value)); index++)
                 {
                     submits.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledSubmits = fieldPointer;
             }
         }
         SharpVk.Interop.VkQueueSubmitDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkQueueSubmitDelegate>("vkQueueSubmit", "");
         Result methodResult = commandDelegate(this.handle, (uint)(Interop.HeapUtil.GetLength(submits)), marshalledSubmits, fence?.handle ?? default(SharpVk.Interop.Fence));
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemple #4
0
 public static extern SharpVk.Result vkQueueSubmit(SharpVk.Interop.Queue queue, uint submitCount, SharpVk.Interop.SubmitInfo *submits, SharpVk.Interop.Fence fence);