/// <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();
     }
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="compactedSize">
 /// </param>
 /// <param name="info">
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.NVidia.AccelerationStructure CreateAccelerationStructure(this SharpVk.Device extendedHandle, ulong compactedSize, SharpVk.NVidia.AccelerationStructureInfo info, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.AccelerationStructure result = default(SharpVk.NVidia.AccelerationStructure);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *);
         void *vkAccelerationStructureCreateInfoNVNextPointer                         = default(void *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator             = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.AccelerationStructure marshalledAccelerationStructure = default(SharpVk.Interop.NVidia.AccelerationStructure);
         commandCache                        = extendedHandle.commandCache;
         marshalledCreateInfo                = (SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.AccelerationStructureCreateInfo>());
         marshalledCreateInfo->SType         = StructureType.AccelerationStructureCreateInfo;
         marshalledCreateInfo->Next          = vkAccelerationStructureCreateInfoNVNextPointer;
         marshalledCreateInfo->CompactedSize = compactedSize;
         info.MarshalTo(&marshalledCreateInfo->Info);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.NVidia.VkDeviceCreateAccelerationStructureDelegate commandDelegate = commandCache.Cache.vkCreateAccelerationStructureNV;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledAccelerationStructure);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.AccelerationStructure(extendedHandle, marshalledAccelerationStructure);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }