Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void UpdateBuffer(SharpVk.Buffer destinationBuffer, DeviceSize destinationOffset, byte[] data)
 {
     try
     {
         byte *marshalledData = default(byte *);
         if (data != null)
         {
             var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(data.Length).ToPointer());
             for (int index = 0; index < (uint)(data.Length); index++)
             {
                 fieldPointer[index] = data[index];
             }
             marshalledData = fieldPointer;
         }
         else
         {
             marshalledData = null;
         }
         Interop.Commands.vkCmdUpdateBuffer(this.handle, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, (DeviceSize)(data?.Length ?? 0), marshalledData);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void CopyBufferToImage(SharpVk.Buffer sourceBuffer, SharpVk.Image destinationImage, SharpVk.ImageLayout destinationImageLayout, SharpVk.BufferImageCopy[] regions)
 {
     try
     {
         SharpVk.BufferImageCopy *marshalledRegions = default(SharpVk.BufferImageCopy *);
         if (regions != null)
         {
             var fieldPointer = (SharpVk.BufferImageCopy *)(Interop.HeapUtil.AllocateAndClear <SharpVk.BufferImageCopy>(regions.Length).ToPointer());
             for (int index = 0; index < (uint)(regions.Length); index++)
             {
                 fieldPointer[index] = regions[index];
             }
             marshalledRegions = fieldPointer;
         }
         else
         {
             marshalledRegions = null;
         }
         Interop.Commands.vkCmdCopyBufferToImage(this.handle, sourceBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationImage?.handle ?? default(SharpVk.Interop.Image), destinationImageLayout, (uint)(regions?.Length ?? 0), marshalledRegions);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void FillBuffer(SharpVk.Buffer destinationBuffer, DeviceSize destinationOffset, DeviceSize size, uint data)
 {
     try
     {
         Interop.Commands.vkCmdFillBuffer(this.handle, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, size, data);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void DispatchIndirect(SharpVk.Buffer buffer, DeviceSize offset)
 {
     try
     {
         Interop.Commands.vkCmdDispatchIndirect(this.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void DrawIndexedIndirect(SharpVk.Buffer buffer, DeviceSize offset, uint drawCount, uint stride)
 {
     try
     {
         Interop.Commands.vkCmdDrawIndexedIndirect(this.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset, drawCount, stride);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void BindIndexBuffer(SharpVk.Buffer buffer, DeviceSize offset, SharpVk.IndexType indexType)
 {
     try
     {
         Interop.Commands.vkCmdBindIndexBuffer(this.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset, indexType);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="buffer">
 /// </param>
 /// <param name="offset">
 /// </param>
 /// <param name="countBuffer">
 /// </param>
 /// <param name="countBufferOffset">
 /// </param>
 /// <param name="maxDrawCount">
 /// </param>
 /// <param name="stride">
 /// </param>
 public static unsafe void DrawMeshTasksIndirectCount(this SharpVk.CommandBuffer extendedHandle, SharpVk.Buffer buffer, ulong offset, SharpVk.Buffer countBuffer, ulong countBufferOffset, uint maxDrawCount, uint stride)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.NVidia.VkCommandBufferDrawMeshTasksIndirectCountDelegate commandDelegate = commandCache.Cache.vkCmdDrawMeshTasksIndirectCountNV;
         commandDelegate(extendedHandle.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset, countBuffer?.handle ?? default(SharpVk.Interop.Buffer), countBufferOffset, maxDrawCount, stride);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="raygenShaderBindingTableBuffer">
 /// </param>
 /// <param name="raygenShaderBindingOffset">
 /// </param>
 /// <param name="missShaderBindingTableBuffer">
 /// </param>
 /// <param name="missShaderBindingOffset">
 /// </param>
 /// <param name="missShaderBindingStride">
 /// </param>
 /// <param name="hitShaderBindingTableBuffer">
 /// </param>
 /// <param name="hitShaderBindingOffset">
 /// </param>
 /// <param name="hitShaderBindingStride">
 /// </param>
 /// <param name="callableShaderBindingTableBuffer">
 /// </param>
 /// <param name="callableShaderBindingOffset">
 /// </param>
 /// <param name="callableShaderBindingStride">
 /// </param>
 /// <param name="width">
 /// </param>
 /// <param name="height">
 /// </param>
 /// <param name="depth">
 /// </param>
 public static unsafe void TraceRays(this SharpVk.CommandBuffer extendedHandle, SharpVk.Buffer raygenShaderBindingTableBuffer, ulong raygenShaderBindingOffset, SharpVk.Buffer missShaderBindingTableBuffer, ulong missShaderBindingOffset, ulong missShaderBindingStride, SharpVk.Buffer hitShaderBindingTableBuffer, ulong hitShaderBindingOffset, ulong hitShaderBindingStride, SharpVk.Buffer callableShaderBindingTableBuffer, ulong callableShaderBindingOffset, ulong callableShaderBindingStride, uint width, uint height, uint depth)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.NVidia.VkCommandBufferTraceRaysDelegate commandDelegate = commandCache.Cache.vkCmdTraceRaysNV;
         commandDelegate(extendedHandle.handle, raygenShaderBindingTableBuffer?.handle ?? default(SharpVk.Interop.Buffer), raygenShaderBindingOffset, missShaderBindingTableBuffer?.handle ?? default(SharpVk.Interop.Buffer), missShaderBindingOffset, missShaderBindingStride, hitShaderBindingTableBuffer?.handle ?? default(SharpVk.Interop.Buffer), hitShaderBindingOffset, hitShaderBindingStride, callableShaderBindingTableBuffer?.handle ?? default(SharpVk.Interop.Buffer), callableShaderBindingOffset, callableShaderBindingStride, width, height, depth);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="info">
 /// </param>
 /// <param name="instanceData">
 /// </param>
 /// <param name="instanceOffset">
 /// </param>
 /// <param name="update">
 /// </param>
 /// <param name="destination">
 /// </param>
 /// <param name="source">
 /// </param>
 /// <param name="scratch">
 /// </param>
 /// <param name="scratchOffset">
 /// </param>
 public static unsafe void BuildAccelerationStructure(this SharpVk.CommandBuffer extendedHandle, SharpVk.NVidia.AccelerationStructureInfo info, SharpVk.Buffer instanceData, ulong instanceOffset, bool update, SharpVk.NVidia.AccelerationStructure destination, SharpVk.NVidia.AccelerationStructure source, SharpVk.Buffer scratch, ulong scratchOffset)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.AccelerationStructureInfo *marshalledInfo = default(SharpVk.Interop.NVidia.AccelerationStructureInfo *);
         commandCache   = extendedHandle.commandCache;
         marshalledInfo = (SharpVk.Interop.NVidia.AccelerationStructureInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.AccelerationStructureInfo>());
         info.MarshalTo(marshalledInfo);
         SharpVk.Interop.NVidia.VkCommandBufferBuildAccelerationStructureDelegate commandDelegate = commandCache.Cache.vkCmdBuildAccelerationStructureNV;
         commandDelegate(extendedHandle.handle, marshalledInfo, instanceData?.handle ?? default(SharpVk.Interop.Buffer), instanceOffset, update, destination?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure), source?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure), scratch?.handle ?? default(SharpVk.Interop.Buffer), scratchOffset);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Perform an indexed indirect draw with the draw count sourced from a
 /// buffer.
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 public static unsafe void DrawIndexedIndirectCount(this SharpVk.CommandBuffer extendedHandle, SharpVk.Buffer buffer, DeviceSize offset, SharpVk.Buffer countBuffer, DeviceSize countBufferOffset, uint maxDrawCount, uint stride)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Amd.VkCommandBufferDrawIndexedIndirectCountDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Amd.VkCommandBufferDrawIndexedIndirectCountDelegate>("vkCmdDrawIndexedIndirectCountAMD", "device");
         commandDelegate(extendedHandle.handle, buffer?.handle ?? default(SharpVk.Interop.Buffer), offset, countBuffer?.handle ?? default(SharpVk.Interop.Buffer), countBufferOffset, maxDrawCount, stride);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// Execute a pipelined write of a marker value into a buffer.
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 /// <param name="pipelineStage">
 /// One of the PipelineStageFlags values, specifying the pipeline stage
 /// whose completion triggers the marker write.
 /// </param>
 /// <param name="destinationBuffer">
 /// The buffer where the marker will be written to.
 /// </param>
 /// <param name="destinationOffset">
 /// The byte offset into the buffer where the marker will be written
 /// to.
 /// </param>
 /// <param name="marker">
 /// The 32-bit value of the marker.
 /// </param>
 public static unsafe void WriteBufferMarker(this SharpVk.CommandBuffer extendedHandle, SharpVk.PipelineStageFlags pipelineStage, SharpVk.Buffer destinationBuffer, ulong destinationOffset, uint marker)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Amd.VkCommandBufferWriteBufferMarkerDelegate commandDelegate = commandCache.Cache.vkCmdWriteBufferMarkerAMD;
         commandDelegate(extendedHandle.handle, pipelineStage, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, marker);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 public static unsafe void BeginConditionalRendering(this SharpVk.CommandBuffer extendedHandle, SharpVk.Buffer buffer, ulong offset, SharpVk.Multivendor.ConditionalRenderingFlags?flags = default(SharpVk.Multivendor.ConditionalRenderingFlags?))
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.ConditionalRenderingBeginInfo *marshalledConditionalRenderingBegin = default(SharpVk.Interop.Multivendor.ConditionalRenderingBeginInfo *);
         void *nextPointer = default(void *);
         commandCache = extendedHandle.commandCache;
         marshalledConditionalRenderingBegin         = (SharpVk.Interop.Multivendor.ConditionalRenderingBeginInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ConditionalRenderingBeginInfo>());
         marshalledConditionalRenderingBegin->SType  = StructureType.ConditionalRenderingBeginInfo;
         marshalledConditionalRenderingBegin->Next   = nextPointer;
         marshalledConditionalRenderingBegin->Buffer = buffer?.handle ?? default(SharpVk.Interop.Buffer);
         marshalledConditionalRenderingBegin->Offset = offset;
         if (flags != null)
         {
             marshalledConditionalRenderingBegin->Flags = flags.Value;
         }
         else
         {
             marshalledConditionalRenderingBegin->Flags = default(SharpVk.Multivendor.ConditionalRenderingFlags);
         }
         SharpVk.Interop.Multivendor.VkCommandBufferBeginConditionalRenderingDelegate commandDelegate = commandCache.Cache.vkCmdBeginConditionalRenderingEXT;
         commandDelegate(extendedHandle.handle, marshalledConditionalRenderingBegin);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The CommandBuffer handle to extend.
 /// </param>
 public static unsafe void DrawIndirectByteCount(this SharpVk.CommandBuffer extendedHandle, uint instanceCount, uint firstInstance, SharpVk.Buffer counterBuffer, ulong counterBufferOffset, uint counterOffset, uint vertexStride)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Multivendor.VkCommandBufferDrawIndirectByteCountDelegate commandDelegate = commandCache.Cache.vkCmdDrawIndirectByteCountEXT;
         commandDelegate(extendedHandle.handle, instanceCount, firstInstance, counterBuffer?.handle ?? default(SharpVk.Interop.Buffer), counterBufferOffset, counterOffset, vertexStride);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 14
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void CopyQueryPoolResults(SharpVk.QueryPool queryPool, uint firstQuery, uint queryCount, SharpVk.Buffer destinationBuffer, DeviceSize destinationOffset, DeviceSize stride, SharpVk.QueryResultFlags?flags = default(SharpVk.QueryResultFlags?))
 {
     try
     {
         SharpVk.QueryResultFlags marshalledFlags = default(SharpVk.QueryResultFlags);
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.QueryResultFlags);
         }
         Interop.Commands.vkCmdCopyQueryPoolResults(this.handle, queryPool?.handle ?? default(SharpVk.Interop.QueryPool), firstQuery, queryCount, destinationBuffer?.handle ?? default(SharpVk.Interop.Buffer), destinationOffset, stride, marshalledFlags);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }