/// <summary> /// Submits a sequence of semaphores or command buffers to a queue. /// </summary> public void Submit(ArrayProxy <SubmitInfo> submits, Fence fence) { unsafe { try { Result commandResult; Interop.SubmitInfo *marshalledSubmits = null; if (submits.Contents != ProxyContents.Null) { Interop.SubmitInfo *arrayPointer = stackalloc Interop.SubmitInfo[submits.Length]; if (submits.Contents == ProxyContents.Single) { submits.GetSingleValue().MarshalTo(arrayPointer); } else { var arrayValue = submits.GetArrayValue(); for (int index = 0; index < submits.Length; index++) { arrayValue.Array[arrayValue.Offset + index].MarshalTo(&arrayPointer[index]); } } marshalledSubmits = arrayPointer; } else { marshalledSubmits = null; } Interop.Fence marshalledFence = default(Interop.Fence); fence?.MarshalTo(&marshalledFence); commandResult = Interop.Commands.vkQueueSubmit(this.handle, (uint)(submits.Length), marshalledSubmits, marshalledFence); if (SharpVkException.IsError(commandResult)) { throw SharpVkException.Create(commandResult); } } finally { Interop.HeapUtil.FreeLog(); } } }
internal unsafe void MarshalTo(Interop.SubmitInfo *pointer) { pointer->SType = StructureType.SubmitInfo; pointer->Next = null; //WaitSemaphores if (this.WaitSemaphores != null) { var fieldPointer = (Interop.Semaphore *)Interop.HeapUtil.AllocateAndClear <Interop.Semaphore>(this.WaitSemaphores.Length); for (int index = 0; index < this.WaitSemaphores.Length; index++) { this.WaitSemaphores[index].MarshalTo(&fieldPointer[index]); } pointer->WaitSemaphores = fieldPointer; } else { pointer->WaitSemaphores = null; } //WaitDestinationStageMask if (this.WaitDestinationStageMask != null) { pointer->WaitDestinationStageMask = (PipelineStageFlags *)Interop.HeapUtil.Allocate <int>(this.WaitDestinationStageMask.Length).ToPointer(); for (int index = 0; index < this.WaitDestinationStageMask.Length; index++) { pointer->WaitDestinationStageMask[index] = this.WaitDestinationStageMask[index]; } } else { pointer->WaitDestinationStageMask = null; } //CommandBuffers if (this.CommandBuffers != null) { var fieldPointer = (Interop.CommandBuffer *)Interop.HeapUtil.AllocateAndClear <Interop.CommandBuffer>(this.CommandBuffers.Length); for (int index = 0; index < this.CommandBuffers.Length; index++) { this.CommandBuffers[index].MarshalTo(&fieldPointer[index]); } pointer->CommandBuffers = fieldPointer; } else { pointer->CommandBuffers = null; } //SignalSemaphores if (this.SignalSemaphores != null) { var fieldPointer = (Interop.Semaphore *)Interop.HeapUtil.AllocateAndClear <Interop.Semaphore>(this.SignalSemaphores.Length); for (int index = 0; index < this.SignalSemaphores.Length; index++) { this.SignalSemaphores[index].MarshalTo(&fieldPointer[index]); } pointer->SignalSemaphores = fieldPointer; } else { pointer->SignalSemaphores = null; } pointer->WaitSemaphoreCount = (uint)(this.WaitDestinationStageMask?.Length ?? 0); pointer->CommandBufferCount = (uint)(this.CommandBuffers?.Length ?? 0); pointer->SignalSemaphoreCount = (uint)(this.SignalSemaphores?.Length ?? 0); }
internal SubmitInfo(Interop.SubmitInfo* ptr) { m = ptr; Initialize (); }
public SubmitInfo() { m = (Interop.SubmitInfo*) Interop.Structure.Allocate (typeof (Interop.SubmitInfo)); Initialize (); }