/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> /// <param name="counterBuffers"> /// </param> /// <param name="counterBufferOffsets"> /// </param> public static unsafe void EndTransformFeedback(this SharpVk.CommandBuffer extendedHandle, uint firstCounterBuffer, ArrayProxy <SharpVk.Buffer>?counterBuffers, ArrayProxy <ulong>?counterBufferOffsets = null) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Buffer *marshalledCounterBuffers = default(SharpVk.Interop.Buffer *); ulong *marshalledCounterBufferOffsets = default(ulong *); commandCache = extendedHandle.commandCache; if (counterBuffers.IsNull()) { marshalledCounterBuffers = null; } else { if (counterBuffers.Value.Contents == ProxyContents.Single) { marshalledCounterBuffers = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Buffer>()); *(SharpVk.Interop.Buffer *)(marshalledCounterBuffers) = counterBuffers.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Buffer); } else { var fieldPointer = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Buffer>(Interop.HeapUtil.GetLength(counterBuffers.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(counterBuffers.Value)); index++) { fieldPointer[index] = counterBuffers.Value[index]?.handle ?? default(SharpVk.Interop.Buffer); } marshalledCounterBuffers = fieldPointer; } } if (counterBufferOffsets.IsNull()) { marshalledCounterBufferOffsets = null; } else { if (counterBufferOffsets.Value.Contents == ProxyContents.Single) { marshalledCounterBufferOffsets = (ulong *)(Interop.HeapUtil.Allocate <ulong>()); *(ulong *)(marshalledCounterBufferOffsets) = counterBufferOffsets.Value.GetSingleValue(); } else { var fieldPointer = (ulong *)(Interop.HeapUtil.AllocateAndClear <ulong>(Interop.HeapUtil.GetLength(counterBufferOffsets.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(counterBufferOffsets.Value)); index++) { fieldPointer[index] = counterBufferOffsets.Value[index]; } marshalledCounterBufferOffsets = fieldPointer; } } SharpVk.Interop.Multivendor.VkCommandBufferEndTransformFeedbackDelegate commandDelegate = commandCache.Cache.vkCmdEndTransformFeedbackEXT; commandDelegate(extendedHandle.handle, firstCounterBuffer, (uint)(Interop.HeapUtil.GetLength(counterBuffers)), marshalledCounterBuffers, marshalledCounterBufferOffsets); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void BindVertexBuffers(uint firstBinding, SharpVk.Buffer[] buffers, DeviceSize[] offsets) { try { SharpVk.Interop.Buffer *marshalledBuffers = default(SharpVk.Interop.Buffer *); DeviceSize * marshalledOffsets = default(DeviceSize *); if (buffers != null) { var fieldPointer = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Buffer>(buffers.Length).ToPointer()); for (int index = 0; index < (uint)(buffers.Length); index++) { fieldPointer[index] = buffers[index]?.handle ?? default(SharpVk.Interop.Buffer); } marshalledBuffers = fieldPointer; } else { marshalledBuffers = null; } if (offsets != null) { var fieldPointer = (DeviceSize *)(Interop.HeapUtil.AllocateAndClear <DeviceSize>(offsets.Length).ToPointer()); for (int index = 0; index < (uint)(offsets.Length); index++) { fieldPointer[index] = offsets[index]; } marshalledOffsets = fieldPointer; } else { marshalledOffsets = null; } Interop.Commands.vkCmdBindVertexBuffers(this.handle, firstBinding, (uint)(buffers?.Length ?? 0), marshalledBuffers, marshalledOffsets); } finally { Interop.HeapUtil.FreeAll(); } }
public static extern void vkCmdBindVertexBuffers(SharpVk.Interop.CommandBuffer commandBuffer, uint firstBinding, uint bindingCount, SharpVk.Interop.Buffer *buffers, DeviceSize *offsets);
public static extern SharpVk.Result vkCreateBuffer(SharpVk.Interop.Device device, SharpVk.Interop.BufferCreateInfo *createInfo, SharpVk.Interop.AllocationCallbacks *allocator, SharpVk.Interop.Buffer *buffer);
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> /// <param name="buffers"> /// </param> /// <param name="offsets"> /// </param> /// <param name="sizes"> /// </param> public static unsafe void BindTransformFeedbackBuffers(this SharpVk.CommandBuffer extendedHandle, uint firstBinding, ArrayProxy <SharpVk.Buffer>?buffers, ArrayProxy <DeviceSize>?offsets, ArrayProxy <DeviceSize>?sizes = null) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Buffer *marshalledBuffers = default(SharpVk.Interop.Buffer *); DeviceSize * marshalledOffsets = default(DeviceSize *); DeviceSize * marshalledSizes = default(DeviceSize *); commandCache = extendedHandle.commandCache; if (buffers.IsNull()) { marshalledBuffers = null; } else { if (buffers.Value.Contents == ProxyContents.Single) { marshalledBuffers = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Buffer>()); *(SharpVk.Interop.Buffer *)(marshalledBuffers) = buffers.Value.GetSingleValue()?.handle ?? default(SharpVk.Interop.Buffer); } else { var fieldPointer = (SharpVk.Interop.Buffer *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Buffer>(Interop.HeapUtil.GetLength(buffers.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(buffers.Value)); index++) { fieldPointer[index] = buffers.Value[index]?.handle ?? default(SharpVk.Interop.Buffer); } marshalledBuffers = fieldPointer; } } if (offsets.IsNull()) { marshalledOffsets = null; } else { if (offsets.Value.Contents == ProxyContents.Single) { marshalledOffsets = (DeviceSize *)(Interop.HeapUtil.Allocate <DeviceSize>()); *(DeviceSize *)(marshalledOffsets) = offsets.Value.GetSingleValue(); } else { var fieldPointer = (DeviceSize *)(Interop.HeapUtil.AllocateAndClear <DeviceSize>(Interop.HeapUtil.GetLength(offsets.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(offsets.Value)); index++) { fieldPointer[index] = offsets.Value[index]; } marshalledOffsets = fieldPointer; } } if (sizes.IsNull()) { marshalledSizes = null; } else { if (sizes.Value.Contents == ProxyContents.Single) { marshalledSizes = (DeviceSize *)(Interop.HeapUtil.Allocate <DeviceSize>()); *(DeviceSize *)(marshalledSizes) = sizes.Value.GetSingleValue(); } else { var fieldPointer = (DeviceSize *)(Interop.HeapUtil.AllocateAndClear <DeviceSize>(Interop.HeapUtil.GetLength(sizes.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(sizes.Value)); index++) { fieldPointer[index] = sizes.Value[index]; } marshalledSizes = fieldPointer; } } SharpVk.Interop.Multivendor.VkCommandBufferBindTransformFeedbackBuffersDelegate commandDelegate = commandCache.Cache.vkCmdBindTransformFeedbackBuffersEXT; commandDelegate(extendedHandle.handle, firstBinding, (uint)(Interop.HeapUtil.GetLength(buffers)), marshalledBuffers, marshalledOffsets, marshalledSizes); } finally { Interop.HeapUtil.FreeAll(); } }