Ejemplo n.º 1
0
 /// <summary>
 /// Copy results of queries in a query pool to a host memory region.
 /// </summary>
 /// <param name="data">
 /// </param>
 public unsafe Result GetResults(uint firstQuery, uint queryCount, ArrayProxy <byte>?data, DeviceSize stride, SharpVk.QueryResultFlags?flags = default(SharpVk.QueryResultFlags?))
 {
     try
     {
         Result result         = default(Result);
         byte * marshalledData = default(byte *);
         SharpVk.QueryResultFlags marshalledFlags = default(SharpVk.QueryResultFlags);
         if (data.IsNull())
         {
             marshalledData = null;
         }
         else
         {
             if (data.Value.Contents == ProxyContents.Single)
             {
                 marshalledData            = (byte *)(Interop.HeapUtil.Allocate <byte>());
                 *(byte *)(marshalledData) = data.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(Interop.HeapUtil.GetLength(data.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(data.Value)); index++)
                 {
                     fieldPointer[index] = data.Value[index];
                 }
                 marshalledData = fieldPointer;
             }
         }
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.QueryResultFlags);
         }
         SharpVk.Interop.VkQueryPoolGetResultsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkQueryPoolGetResultsDelegate>("vkGetQueryPoolResults", "");
         result = commandDelegate(this.parent.handle, this.handle, firstQuery, queryCount, (HostSize)(Interop.HeapUtil.GetLength(data)), marshalledData, stride, marshalledFlags);
         if (SharpVkException.IsError(result))
         {
             throw SharpVkException.Create(result);
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 2
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();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 public unsafe void GetResults(uint firstQuery, uint queryCount, byte[] data, DeviceSize stride, SharpVk.QueryResultFlags?flags = default(SharpVk.QueryResultFlags?))
 {
     try
     {
         byte *marshalledData = default(byte *);
         SharpVk.QueryResultFlags marshalledFlags = default(SharpVk.QueryResultFlags);
         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;
         }
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.QueryResultFlags);
         }
         Result methodResult = Interop.Commands.vkGetQueryPoolResults(this.parent.handle, this.handle, firstQuery, queryCount, (HostSize)(data?.Length ?? 0), marshalledData, stride, marshalledFlags);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 4
0
 public static extern void vkCmdCopyQueryPoolResults(SharpVk.Interop.CommandBuffer commandBuffer, SharpVk.Interop.QueryPool queryPool, uint firstQuery, uint queryCount, SharpVk.Interop.Buffer destinationBuffer, DeviceSize destinationOffset, DeviceSize stride, SharpVk.QueryResultFlags flags);
Ejemplo n.º 5
0
 public static extern SharpVk.Result vkGetQueryPoolResults(SharpVk.Interop.Device device, SharpVk.Interop.QueryPool queryPool, uint firstQuery, uint queryCount, HostSize dataSize, void *data, DeviceSize stride, SharpVk.QueryResultFlags flags);